libMesh
Loading...
Searching...
No Matches
mesh_generation.h
Go to the documentation of this file.
1// The libMesh Finite Element Library.
2// Copyright (C) 2002-2026 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
28#include "libmesh/mesh_triangle_interface.h"
29#endif
30
31// C++ Includes
32#include <cstddef>
33#include <vector>
34
35namespace libMesh
36{
37
38// forward declarations
39class MeshBase;
40class UnstructuredMesh;
41class Elem;
42
43
44// ------------------------------------------------------------
45// MeshTools::Generation namespace
46namespace MeshTools
47{
54namespace 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
84 const ElemType type=INVALID_ELEM,
85 const bool gauss_lobatto_grid=false);
86
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
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
132 const Real radius=1,
133 const unsigned int n_refinements=2,
134 const ElemType type=INVALID_ELEM,
135 const unsigned int n_smooth=2,
136 const bool flat=true);
137
142 const MeshBase & cross_section,
143 const unsigned int nz,
144 RealVectorValue extrusion_vector,
145 QueryElemSubdomainIDBase * elem_subdomain = nullptr);
146
147#if defined(LIBMESH_HAVE_TRIANGLE) && LIBMESH_DIM > 1
154 const unsigned int nx, // num. of elements in x-dir
155 const unsigned int ny, // num. of elements in y-dir
156 const Real xmin, const Real xmax,
157 const Real ymin, const Real ymax,
158 const ElemType type,
159 const std::vector<TriangleInterface::Hole*> * holes=nullptr);
160#endif // LIBMESH_HAVE_TRIANGLE && LIBMESH_DIM > 1
161
169 Real xmin, Real xmax,
170 Real ymin, Real ymax,
171 Real zmin, Real zmax,
172 bool flip_tris = false);
173
179{
180public:
181 virtual ~QueryElemSubdomainIDBase() = default;
182
183 virtual subdomain_id_type get_subdomain_for_layer(const Elem * old_elem, unsigned int layer) = 0;
184};
185
186} // end namespace Meshtools::Generation
187} // end namespace MeshTools
188
189
190} // namespace libMesh
191
192#endif // LIBMESH_MESH_GENERATION_H
This is the base class from which all geometric element types are derived.
Definition elem.h:96
This is the MeshBase class.
Definition mesh_base.h:81
Class for receiving the callback during extrusion generation and providing user-defined subdomains ba...
virtual subdomain_id_type get_subdomain_for_layer(const Elem *old_elem, unsigned int layer)=0
The UnstructuredMesh class is derived from the MeshBase class.
MeshBase & mesh
void build_point(UnstructuredMesh &mesh, const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 0D meshes.
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.
void build_extrusion(UnstructuredMesh &mesh, const MeshBase &cross_section, const unsigned int nz, RealVectorValue extrusion_vector, QueryElemSubdomainIDBase *elem_subdomain=nullptr)
Meshes the tensor product of a 1D and a 1D-or-2D domain.
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)
Meshes a rectangular (2D) region (with or without holes) with a Delaunay triangulation.
void build_sphere(UnstructuredMesh &mesh, const Real radius=1, const unsigned int n_refinements=2, const ElemType type=INVALID_ELEM, const unsigned int n_smooth=2, const bool flat=true)
Fills mesh with a mesh discretizing a ball (||x||<= radius) or sphere (||x|| = radius) domain.
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.
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.
void surface_octahedron(UnstructuredMesh &mesh, Real xmin, Real xmax, Real ymin, Real ymax, Real zmin, Real zmax, bool flip_tris=false)
Meshes the surface of an octahedron with 8 Tri3 elements, with counter-clockwise (libMesh default) no...
The libMesh namespace provides an interface to certain functionality in the library.
ElemType
Defines an enum for geometric element types.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Real radius