libMesh
mesh_generation.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2017 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"
26 #include "libmesh/vector_value.h"
27 #ifdef LIBMESH_HAVE_TRIANGLE
28 #include "libmesh/mesh_triangle_interface.h"
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
59 
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 = libmesh_nullptr);
131 
132 #ifdef LIBMESH_HAVE_TRIANGLE
133 
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=libmesh_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
Class for receiving the callback during extrusion generation and providing user-defined subdomains ba...
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)
Meshes a spherical or mapped-spherical domain.
void build_point(UnstructuredMesh &mesh, const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 0D meshes.
ElemType
Defines an enum for geometric element types.
This is the base class from which all geometric element types are derived.
Definition: elem.h:89
MeshBase & mesh
const class libmesh_nullptr_t libmesh_nullptr
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)
A specialized build_cube() for 2D meshes.
The libMesh namespace provides an interface to certain functionality in the library.
This is the MeshBase class.
Definition: mesh_base.h:68
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=libmesh_nullptr)
Meshes a rectangular (2D) region (with or without holes) with a Delaunay triangulation.
The UnstructuredMesh class is derived from the MeshBase class.
void build_extrusion(UnstructuredMesh &mesh, const MeshBase &cross_section, const unsigned int nz, RealVectorValue extrusion_vector, QueryElemSubdomainIDBase *elem_subdomain=libmesh_nullptr)
Meshes the tensor product of a 1D and a 1D-or-2D domain.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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)
A specialized build_cube() for 1D meshes.
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)
Builds a (elements) cube.