<?xml version="1.0" encoding="UTF-8"?>
<refentry version="5.0-subset Scilab" xml:id="gf_mesh" xml:lang="en"
          xmlns="http://docbook.org/ns/docbook"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:xi="http://www.w3.org/2001/XInclude"
          xmlns:svg="http://www.w3.org/2000/svg"
          xmlns:mml="http://www.w3.org/1998/Math/MathML"
          xmlns:html="http://www.w3.org/1999/xhtml"
          xmlns:db="http://docbook.org/ns/docbook">
  <refnamediv>
    <refname>gf_mesh</refname>
    <refpurpose>  This object is able to store any element in any dimension even if you mix
  elements with different dimensions.

  
</refpurpose>
  </refnamediv>

  <refsynopsisdiv>
    <title>Calling Sequence</title>

    <synopsis>M = gf_mesh('empty', int dim)</synopsis>
    <synopsis>M = gf_mesh('cartesian', vec X[, vec Y[, vec Z,..]])</synopsis>
    <synopsis>M = gf_mesh('cartesian Q1', vec X, vec Y[, vec Z,..])</synopsis>
    <synopsis>M = gf_mesh('triangles grid', vec X, vec Y)</synopsis>
    <synopsis>M = gf_mesh('regular simplices', vec X[, vec Y[, vec Z,...]]['degree', int k]['noised'])</synopsis>
    <synopsis>M = gf_mesh('curved', mesh m, vec F)</synopsis>
    <synopsis>M = gf_mesh('prismatic', mesh m, int nl)</synopsis>
    <synopsis>M = gf_mesh('pt2D', mat P, imat T[, int n])</synopsis>
    <synopsis>M = gf_mesh('ptND', mat P, imat T)</synopsis>
    <synopsis>M = gf_mesh('load', string filename)</synopsis>
    <synopsis>M = gf_mesh('from string', string s)</synopsis>
    <synopsis>M = gf_mesh('import', string format, string filename)</synopsis>
    <synopsis>M = gf_mesh('clone', mesh m2)</synopsis>
    <synopsis>M = gf_mesh('generate', mesher_object mo, scalar h[, int K = 1[, mat vertices]])</synopsis>
  </refsynopsisdiv>

  <refsection>
    <title>Description</title>
    <para>General constructor for mesh objects.</para>

    <para>  This object is able to store any element in any dimension even if you mix
  elements with different dimensions.

  
</para>
  </refsection>

  <refsection>
    <title>Command list</title>

    <itemizedlist>
    <listitem>
    <para><literal>M = gf_mesh('empty', int dim)</literal></para>

    <para>         Create a new empty mesh.
    </para>
    </listitem>

    <listitem>
    <para><literal>M = gf_mesh('cartesian', vec X[, vec Y[, vec Z,..]])</literal></para>

    <para>         Build quickly a regular mesh of quadrangles, cubes, etc.
    </para>
    </listitem>

    <listitem>
    <para><literal>M = gf_mesh('cartesian Q1', vec X, vec Y[, vec Z,..])</literal></para>

    <para>         Build quickly a regular mesh of quadrangles, cubes, etc. with
      Q1 elements.
    </para>
    </listitem>

    <listitem>
    <para><literal>M = gf_mesh('triangles grid', vec X, vec Y)</literal></para>

    <para>         Build quickly a regular mesh of triangles.

      This is a very limited and somehow deprecated function (See also
      <literal></literal>gf_mesh('ptND')<literal></literal>, <literal></literal>gf_mesh('regular simplices')<literal></literal> and
      <literal></literal>gf_mesh('cartesian')<literal></literal>).
    </para>
    </listitem>

    <listitem>
    <para><literal>M = gf_mesh('regular simplices', vec X[, vec Y[, vec Z,...]]['degree', int k]['noised'])</literal></para>

    <para>         Mesh a n-dimensionnal parallelepipeded with simplices (triangles,
      tetrahedrons etc) .

      The optional degree may be used to build meshes with non linear
      geometric transformations.
    </para>
    </listitem>

    <listitem>
    <para><literal>M = gf_mesh('curved', mesh m, vec F)</literal></para>

    <para>         Build a curved (n+1)-dimensions mesh from a n-dimensions mesh <literal>m</literal>.

      The points of the new mesh have one additional coordinate, given by
      the vector <literal>F</literal>. This can be used to obtain meshes for shells. <literal>m</literal> may
      be a mesh_fem object, in that case its linked mesh will be used.
    </para>
    </listitem>

    <listitem>
    <para><literal>M = gf_mesh('prismatic', mesh m, int nl)</literal></para>

    <para>         Extrude a prismatic mesh <literal>M</literal> from a mesh <literal>m</literal>.

      In the additional dimension there are <literal>nl</literal> layers of elements built
      from <literal></literal>0<literal></literal> to <literal></literal>1<literal></literal>.
    </para>
    </listitem>

    <listitem>
    <para><literal>M = gf_mesh('pt2D', mat P, imat T[, int n])</literal></para>

    <para>         Build a mesh from a 2D triangulation.

      Each column of <literal>P</literal> contains a point coordinate, and each column of <literal>T</literal>
      contains the point indices of a triangle. <literal>n</literal> is optional and is a
      zone number. If <literal>n</literal> is specified then only the zone number <literal>n</literal> is
      converted (in that case, <literal>T</literal> is expected to have 4 rows, the fourth
      containing these zone numbers).

      
    </para>
    </listitem>

    <listitem>
    <para><literal>M = gf_mesh('ptND', mat P, imat T)</literal></para>

    <para>         Build a mesh from a n-dimensional "triangulation".

      Similar function to 'pt2D', for building simplexes meshes from a
      triangulation given in <literal>T</literal>, and a list of points given in <literal>P</literal>. The
      dimension of the mesh will be the number of rows of <literal>P</literal>, and the
      dimension of the simplexes will be the number of rows of <literal>T</literal>.
    </para>
    </listitem>

    <listitem>
    <para><literal>M = gf_mesh('load', string filename)</literal></para>

    <para>         Load a mesh from a getfem++ ascii mesh file.

      See also <literal></literal>gf_mesh_get(mesh M, 'save', string filename)<literal></literal>.
    </para>
    </listitem>

    <listitem>
    <para><literal>M = gf_mesh('from string', string s)</literal></para>

    <para>         Load a mesh from a string description.

      For example, a string returned by <literal></literal>gf_mesh_get(mesh M, 'char')<literal></literal>.
    </para>
    </listitem>

    <listitem>
    <para><literal>M = gf_mesh('import', string format, string filename)</literal></para>

    <para>         Import a mesh.

      <literal>format</literal> may be:

      - 'gmsh' for a mesh created with <literal>Gmsh</literal>
      - 'gid' for a mesh created with <literal>GiD</literal>
      - 'am_fmt' for a mesh created with <literal>EMC2</literal>
    </para>
    </listitem>

    <listitem>
    <para><literal>M = gf_mesh('clone', mesh m2)</literal></para>

    <para>         Create a copy of a mesh.
    </para>
    </listitem>

    <listitem>
    <para><literal>M = gf_mesh('generate', mesher_object mo, scalar h[, int K = 1[, mat vertices]])</literal></para>

    <para>         Call the (very) experimental mesher of Getfem on the geometry
      represented by <literal>mo</literal>. please control the conformity of the produced mesh.
      You can add the mesher by adding a priori vertices in the array
      <literal>vertices</literal> which should be of size <literal></literal>n x m<literal></literal> where <literal></literal>n<literal></literal> n is the
      dimension of the mesh and <literal></literal>m<literal></literal> the number of points. <literal>h</literal> is
      approximate diameter of the elements. <literal>K</literal> is the degree of the
      mesh ( > 1 for curved boundaries).  The mesher try to optimize the
      quality of the elements. This operation may be time consuming.
      Note that if the mesh generation fails, because of some random
      procedure used, it will not give necessarily the same result due
      to random procedures used.
      The messages send to the console by the mesh generation can be
      desactivated using <literal>gf_util('trace level', 2)</literal>. More information
      can be obtained by <literal>gf_util('trace level', 4)</literal>.
      
    </para>
    </listitem>

    </itemizedlist>
  </refsection>

  <refsection>
    <title>See Also</title>
    <simplelist type="inline">
      <member><link linkend="getfem_types">getfem types</link></member>
    </simplelist>
  </refsection>

  <refsection>
    <title>Authors</title>
    <para>Y. Collette</para>
  </refsection>

</refentry>
