mesh_generation.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2018 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library 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 GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_MESH_GENERATION_H
21 #define LIBMESH_MESH_GENERATION_H
22 
23 // Local Includes
24 #include "libmesh/libmesh.h"
25 #include "libmesh/enum_elem_type.h" // INVALID_ELEM
26 #include "libmesh/vector_value.h"
27 #ifdef LIBMESH_HAVE_TRIANGLE
29 #endif
30 
31 // C++ Includes
32 #include <cstddef>
33 #include <vector>
34 
35 namespace libMesh
36 {
37 
38 // forward declarations
39 class MeshBase;
40 class UnstructuredMesh;
41 class Elem;
42 
43 
44 // ------------------------------------------------------------
45 // MeshTools::Generation namespace
46 namespace MeshTools
47 {
54 namespace Generation
55 {
56 
57 // forward declaration
58 class QueryElemSubdomainIDBase;
59 
69 void build_cube (UnstructuredMesh & mesh,
70  const unsigned int nx=0,
71  const unsigned int ny=0,
72  const unsigned int nz=0,
73  const Real xmin=0., const Real xmax=1.,
74  const Real ymin=0., const Real ymax=1.,
75  const Real zmin=0., const Real zmax=1.,
76  const ElemType type=INVALID_ELEM,
77  const bool gauss_lobatto_grid=false);
78 
83 void build_point (UnstructuredMesh & mesh,
84  const ElemType type=INVALID_ELEM,
85  const bool gauss_lobatto_grid=false);
86 
93 void build_line (UnstructuredMesh & mesh,
94  const unsigned int nx,
95  const Real xmin=0., const Real xmax=1.,
96  const ElemType type=INVALID_ELEM,
97  const bool gauss_lobatto_grid=false);
98 
105 void build_square (UnstructuredMesh & mesh,
106  const unsigned int nx,
107  const unsigned int ny,
108  const Real xmin=0., const Real xmax=1.,
109  const Real ymin=0., const Real ymax=1.,
110  const ElemType type=INVALID_ELEM,
111  const bool gauss_lobatto_grid=false);
112 
116 void build_sphere (UnstructuredMesh & mesh,
117  const Real rad=1,
118  const unsigned int nr=2,
119  const ElemType type=INVALID_ELEM,
120  const unsigned int n_smooth=2,
121  const bool flat=true);
122 
126 void build_extrusion (UnstructuredMesh & mesh,
127  const MeshBase & cross_section,
128  const unsigned int nz,
129  RealVectorValue extrusion_vector,
130  QueryElemSubdomainIDBase * elem_subdomain = nullptr);
131 
132 #ifdef LIBMESH_HAVE_TRIANGLE
133 
138 void build_delaunay_square(UnstructuredMesh & mesh,
139  const unsigned int nx, // num. of elements in x-dir
140  const unsigned int ny, // num. of elements in y-dir
141  const Real xmin, const Real xmax,
142  const Real ymin, const Real ymax,
143  const ElemType type,
144  const std::vector<TriangleInterface::Hole*> * holes=nullptr);
145 #endif // #define LIBMESH_HAVE_TRIANGLE
146 
152 {
153 public:
155 
156  virtual subdomain_id_type get_subdomain_for_layer(const Elem * old_elem, unsigned int layer) = 0;
157 };
158 
159 } // end namespace Meshtools::Generation
160 } // end namespace MeshTools
161 
162 
163 } // namespace libMesh
164 
165 #endif // LIBMESH_MESH_GENERATION_H
void build_extrusion(UnstructuredMesh &mesh, const MeshBase &cross_section, const unsigned int nz, RealVectorValue extrusion_vector, QueryElemSubdomainIDBase *elem_subdomain=nullptr)
void build_sphere(UnstructuredMesh &mesh, const Real rad=1, const unsigned int nr=2, const ElemType type=INVALID_ELEM, const unsigned int n_smooth=2, const bool flat=true)
void build_point(UnstructuredMesh &mesh, const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
VectorValue< Real > RealVectorValue
The base class for all geometric element types.
Definition: elem.h:100
MeshBase & mesh
void build_square(UnstructuredMesh &mesh, const unsigned int nx, const unsigned int ny, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void build_delaunay_square(UnstructuredMesh &mesh, const unsigned int nx, const unsigned int ny, const Real xmin, const Real xmax, const Real ymin, const Real ymax, const ElemType type, const std::vector< TriangleInterface::Hole *> *holes=nullptr)
void build_line(UnstructuredMesh &mesh, const unsigned int nx, const Real xmin=0., const Real xmax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
virtual subdomain_id_type get_subdomain_for_layer(const Elem *old_elem, unsigned int layer)=0
void build_cube(UnstructuredMesh &mesh, const unsigned int nx=0, const unsigned int ny=0, const unsigned int nz=0, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const Real zmin=0., const Real zmax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)