1%%%%%%%%%%%%%%%%%%%
2% XLiFE++ is an extended library of finite elements written in C++
3%     Copyright (C) 2014  Lunéville, Eric; Kielbasiewicz, Nicolas; Lafranche, Yvon; Nguyen, Manh-Ha; Chambeyron, Colin
4%
5%     This program is free software: you can redistribute it and/or modify
6%     it under the terms of the GNU General Public License as published by
7%     the Free Software Foundation, either version 3 of the License, or
8%     (at your option) any later version.
9%     This program is distributed in the hope that it will be useful,
10%     but WITHOUT ANY WARRANTY; without even the implied warranty of
11%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12%     GNU General Public License for more details.
13%     You should have received a copy of the GNU General Public License
14%     along with this program.  If not, see <http://www.gnu.org/licenses/>.
15%%%%%%%%%%%%%%%%%%%
16
17\xlifepp owns some constructors that allow to create meshes based on simple geometries in one, two or three dimensions. The constructors to use are defined as follows:
18\vspace{.2cm}
19\begin{lstlisting}[deletekeywords={[3]order,name}]
20//! constructor from 1D geometries
21Mesh (const Geometry& g, Number order = 1, MeshGenerator mg = _defaultGenerator, const String& name = "");
22//! constructor from 2D or 3D geometries
23Mesh (const Geometry& g, ShapeType sh, Number order = 1, MeshGenerator mg = _defaultGenerator, const String& name = "");
24\end{lstlisting}
25
26The arguments are:
27\begin{description}
28\item[\var g] is the geometrical object to be meshed (such as {\class Segment}, {\class Quadrangle}, {\class Hexahedron}, \dots, all of them being declared in the file {\tt geometries.hpp}),
29\item[\var sh] is the shape of the mesh elements (\_segment, \_triangle, \_quadrangle, \_tetrahedron, \_hexahedron),
30\item[\var order] is the interpolation order of the mesh elements ; it depends on the way the mesh is generated (see below),
31\item[\var mg] defines the way the object is computed:
32\begin{description}
33\item[\tt \_structured]: a structured mesh can be built for canonical geometries only ({\class Segment}, {\class Parallelogram},  {\class Rectangle}, {\class Square}, {\class Parallelepiped}, {\class Cuboid} and {\class Cube}); the order of the mesh is necessarily one,
34\item[\tt \_subdiv]: a unstructured mesh can be built using the so-called subdivision basic algorithm for the following geometries : {\class Cube}, {\class Ball}, {\class RevTrunk}, {\class RevCone}, {\class RevCylinder}, {\class Disk} and {\class SetOfElems};
35the order can be any integer $k>0$,
36\item[\tt \_gmsh]: for more complicated geometries, with a nested call of the \gmsh software; the order depends on the chosen shape (refer to \gmsh documentation).
37\end{description}
38\item[\var name] defines the mesh name.
39\end{description}
40
41Examples.
42\begin{lstlisting}
43// P1 structured mesh of segment [0,1] with 10 nodes. Domain is Omega
44Mesh m1D(Segment(_xmin=0., _xmax=1., _nnodes=10, _domain_name="Omega"), 1, _structured);
45// P1 unstructured mesh of disk of center (0,0,1) and radius 2.5 with 40 nodes. Domain is Omega and side domain is Gamma
46Mesh m2D(Disk(_center=Point(0.,0.,1.), _radius=2.5, _nnodes=40, _domain_name="Omega" _side_names="Gamma"), _triangle, 1, _subdiv);
47// Q2 unstructured mesh (using gmsh) of cube [0,2]x[0,1]x[0,4] with 20 nodes on x edges, 10 nodes on y edges and 40 nodes on z edges
48Mesh m3D(Cube(_v1=Point(0.,0.,0.), _v2=Point(2.,0.,0.), _v4=Point(0.,1.,0.), _v5=Point(0.,0.,4.), _nnodes=Numbers(20,10,40), _domain_name="Omega"), _hexahedron, 2, _gmsh);
49\end{lstlisting}
50This is described in more detail in next paragraph.
51\par\bigskip
52Moreover, it is possible to subdivide an existing mesh of order 1: a new mesh is created using the subdivision algorithm
53mentionned above. The corresponding constructor is defined as follows:
54\par\smallskip
55\begin{lstlisting}[deletekeywords={[3]order}]
56//! constructor from a mesh to be subdivided
57Mesh (const Mesh& msh, Number nbsubdiv, Number order = 1);
58\end{lstlisting}
59\par\smallskip
60The arguments are:
61\begin{description}
62\item[\var msh] is the input mesh object, i.e. the given mesh to be subdivided ; it should consist of triangles, quadrangles,
63tetrahedra or hexahedra ;
64\item[\var nbsubdiv] is the number of subdivisions to be performed ;
65\item[\var order] is the order of the final mesh ; its default value is 1.
66\end{description}
67\par\smallskip
68Example.
69\begin{lstlisting}
70Mesh m1("mesh.msh", "My Mesh", msh);
71Mesh subm1(m1,2);
72\end{lstlisting}
73This builds a mesh subm1 which is obtained by subdividing twice the mesh m1, itself read from the file ``mesh.msh".
74\par\medskip
75Once a mesh is created, it is possible to get information about what it is made of using the function printInfo,
76which displays on the terminal general information about the mesh: characteristic data, domains, etc.:
77\begin{lstlisting}
78Mesh m1("mesh.msh", "My Mesh", msh);
79m1.printInfo();
80\end{lstlisting}
81
82\begin{remark}
83If you want to mesh a 2D geometry with segment elements, only borders will be meshed. The same goes for 3D geometries mesh with triangles or quadrangles.
84\end{remark}
85