libMesh
mesh_triangle_interface.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2019 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 #ifndef LIBMESH_MESH_TRIANGLE_INTERFACE_H
20 #define LIBMESH_MESH_TRIANGLE_INTERFACE_H
21 
22 
23 #include "libmesh/libmesh_config.h"
24 
25 #ifdef LIBMESH_HAVE_TRIANGLE
26 
27 // Local Includes
28 #include "libmesh/libmesh.h"
29 #include "libmesh/mesh_serializer.h"
30 
31 #ifdef LIBMESH_FORWARD_DECLARE_ENUMS
32 namespace libMesh
33 {
34 enum ElemType : int;
35 }
36 #else
37 #include "libmesh/enum_elem_type.h"
38 #endif
39 
40 // C++ includes
41 #include <cstddef>
42 #include <vector>
43 
44 namespace libMesh
45 {
46 
47 // Forward Declarations
48 class UnstructuredMesh;
49 
58 {
59 public:
66  explicit
68 
73 
79  {
86 
97  PSLG = 1,
98 
103  };
104 
110  class Hole;
111  class PolygonHole;
112  class ArbitraryHole;
113 
119  class Region;
120 
125  void triangulate();
126 
131 
137 
143 
147  std::string & extra_flags() {return _extra_flags;}
148 
153 
158 
164 
168  bool & quiet() {return _quiet;}
169 
174  void attach_hole_list(const std::vector<Hole*> * holes) {_holes = holes;}
175 
187  std::vector<std::pair<unsigned int, unsigned int>> segments;
188 
194  void attach_boundary_marker(const std::vector<int> * markers) { _markers = markers; }
195 
200  void attach_region_list(const std::vector<Region*> * regions) { _regions = regions; }
201 
202 private:
207 
212  const std::vector<Hole*> * _holes;
213 
217  const std::vector<int> * _markers;
218 
223  const std::vector<Region*> * _regions;
224 
230 
235 
240 
244  std::string _extra_flags;
245 
252 
259 
265 
269  bool _quiet;
270 
275 };
276 
277 } // namespace libMesh
278 
279 
280 
281 #endif // LIBMESH_HAVE_TRIANGLE
282 
283 #endif // ifndef LIBMESH_MESH_TRIANGLE_INTERFACE_H
libMesh::TriangleInterface::_minimum_angle
Real _minimum_angle
Minimum angle in triangles.
Definition: mesh_triangle_interface.h:239
libMesh::TriangleInterface::_holes
const std::vector< Hole * > * _holes
A pointer to a vector of Hole*s.
Definition: mesh_triangle_interface.h:212
libMesh::TriangleInterface::segments
std::vector< std::pair< unsigned int, unsigned int > > segments
When constructing a PSLG, it is often not possible to do so implicitly through the ordering of the po...
Definition: mesh_triangle_interface.h:187
libMesh::TriangleInterface::_serializer
MeshSerializer _serializer
Triangle only operates on serial meshes.
Definition: mesh_triangle_interface.h:274
libMesh::TriangleInterface::_markers
const std::vector< int > * _markers
Boundary markers.
Definition: mesh_triangle_interface.h:217
libMesh::TriangleInterface::extra_flags
std::string & extra_flags()
Sets and/or gets additional flags to be passed to triangle.
Definition: mesh_triangle_interface.h:147
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::TriangleInterface::triangulation_type
TriangulationType & triangulation_type()
Sets and/or gets the desired triangulation type.
Definition: mesh_triangle_interface.h:152
libMesh::TriangleInterface::_smooth_after_generating
bool _smooth_after_generating
Flag which tells whether we should smooth the mesh after it is generated.
Definition: mesh_triangle_interface.h:264
mesh
MeshBase & mesh
Definition: mesh_communication.C:1257
libMesh::TriangleInterface::insert_extra_points
bool & insert_extra_points()
Sets and/or gets the flag for inserting add'l points.
Definition: mesh_triangle_interface.h:157
libMesh::TriangleInterface::_elem_type
ElemType _elem_type
The type of elements to generate.
Definition: mesh_triangle_interface.h:229
libMesh::MeshSerializer
Temporarily serialize a DistributedMesh for output; a distributed mesh is allgathered by the MeshSeri...
Definition: mesh_serializer.h:42
libMesh::TriangleInterface::~TriangleInterface
~TriangleInterface()
Empty destructor.
Definition: mesh_triangle_interface.h:72
libMesh::TriangleInterface::TriangleInterface
TriangleInterface(UnstructuredMesh &mesh)
The constructor.
Definition: mesh_triangle_interface.C:44
libMesh::TriangleInterface::elem_type
ElemType & elem_type()
Sets and/or gets the desired element type.
Definition: mesh_triangle_interface.h:130
libMesh::TriangleInterface::_desired_area
Real _desired_area
The desired area for the elements in the resulting mesh.
Definition: mesh_triangle_interface.h:234
libMesh::TriangleInterface::GENERATE_CONVEX_HULL
Uses the triangle library to first generate a convex hull from the set of points passed in,...
Definition: mesh_triangle_interface.h:85
libMesh::TriangleInterface::_quiet
bool _quiet
Flag which tells if we want to suppress Triangle outputs.
Definition: mesh_triangle_interface.h:269
libMesh::TriangleInterface::smooth_after_generating
bool & smooth_after_generating()
Sets/gets flag which tells whether to do Delaunay mesh smoothing after generating the grid.
Definition: mesh_triangle_interface.h:163
libMesh::TriangleInterface::attach_hole_list
void attach_hole_list(const std::vector< Hole * > *holes)
Attaches a vector of Hole* pointers which will be meshed around.
Definition: mesh_triangle_interface.h:174
libMesh::TriangleInterface::INVALID_TRIANGULATION_TYPE
Does nothing, used as a default value.
Definition: mesh_triangle_interface.h:102
libMesh::UnstructuredMesh
The UnstructuredMesh class is derived from the MeshBase class.
Definition: unstructured_mesh.h:48
libMesh::TriangleInterface::attach_region_list
void attach_region_list(const std::vector< Region * > *regions)
Attaches regions for using attribute to set subdomain IDs and better controlling the triangle sizes w...
Definition: mesh_triangle_interface.h:200
libMesh::TriangleInterface::attach_boundary_marker
void attach_boundary_marker(const std::vector< int > *markers)
Attaches boundary markers.
Definition: mesh_triangle_interface.h:194
libMesh::TriangleInterface::desired_area
Real & desired_area()
Sets and/or gets the desired triangle area.
Definition: mesh_triangle_interface.h:136
libMesh::TriangleInterface::minimum_angle
Real & minimum_angle()
Sets and/or gets the minimum angle.
Definition: mesh_triangle_interface.h:142
libMesh::TriangleInterface::_mesh
UnstructuredMesh & _mesh
Reference to the mesh which is to be created by triangle.
Definition: mesh_triangle_interface.h:206
libMesh::TriangleInterface::_extra_flags
std::string _extra_flags
Additional flags to be passed to triangle.
Definition: mesh_triangle_interface.h:244
libMesh::TriangleInterface
A C++ interface between LibMesh and the Triangle library written by J.R.
Definition: mesh_triangle_interface.h:57
libMesh::TriangleInterface::PSLG
Use the triangle library to triangulate a Planar Straight Line Graph which is defined implicitly by t...
Definition: mesh_triangle_interface.h:97
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::TriangleInterface::quiet
bool & quiet()
Whether or not to make Triangle quiet.
Definition: mesh_triangle_interface.h:168
libMesh::TriangleInterface::_regions
const std::vector< Region * > * _regions
A pointer to a vector of Regions*s.
Definition: mesh_triangle_interface.h:223
libMesh::TriangleInterface::_insert_extra_points
bool _insert_extra_points
Flag which tells whether or not to insert additional nodes before triangulation.
Definition: mesh_triangle_interface.h:258
libMesh::TriangleInterface::_triangulation_type
TriangulationType _triangulation_type
The type of triangulation to perform: choices are: convex hull PSLG.
Definition: mesh_triangle_interface.h:251
libMesh::TriangleInterface::triangulate
void triangulate()
This is the main public interface for this function.
Definition: mesh_triangle_interface.C:63
int
void ErrorVector unsigned int
Definition: adjoints_ex3.C:360
libMesh::TriangleInterface::TriangulationType
TriangulationType
The TriangulationType is used with the general triangulate function defined below.
Definition: mesh_triangle_interface.h:78
libMesh::ElemType
ElemType
Defines an enum for geometric element types.
Definition: enum_elem_type.h:33