libMesh
mesh_triangle_interface.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 #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/enum_elem_type.h"
29 #include "libmesh/libmesh.h"
30 #include "libmesh/mesh_serializer.h"
31 
32 // C++ includes
33 #include <cstddef>
34 #include <vector>
35 
36 namespace libMesh
37 {
38 
39 // Forward Declarations
40 
41 class UnstructuredMesh;
42 
51 {
52 public:
59  explicit
61 
66 
72  {
79 
90  PSLG = 1,
91 
96  };
97 
103  class Hole;
104  class PolygonHole;
105  class ArbitraryHole;
106 
111  void triangulate();
112 
117 
123 
129 
133  std::string & extra_flags() {return _extra_flags;}
134 
139 
144 
150 
155  void attach_hole_list(const std::vector<Hole*> * holes) {_holes = holes;}
156 
168  std::vector<std::pair<unsigned int, unsigned int>> segments;
169 
170 private:
175 
180  const std::vector<Hole*> * _holes;
181 
187 
192 
197 
201  std::string _extra_flags;
202 
209 
216 
222 
227 };
228 
229 } // namespace libMesh
230 
231 
232 
233 #endif // LIBMESH_HAVE_TRIANGLE
234 
235 #endif // ifndef LIBMESH_MESH_TRIANGLE_INTERFACE_H
~TriangleInterface()
Empty destructor.
An abstract class for defining a 2-dimensional hole.
Real _desired_area
The desired area for the elements in the resulting mesh.
bool & smooth_after_generating()
Sets/gets flag which tells whether to do Delaunay mesh smoothing after generating the grid...
Real & minimum_angle()
Sets and/or gets the minimum angle.
Uses the triangle library to first generate a convex hull from the set of points passed in...
UnstructuredMesh & _mesh
Reference to the mesh which is to be created by triangle.
ElemType
Defines an enum for geometric element types.
void attach_hole_list(const std::vector< Hole * > *holes)
Attaches a vector of Hole* pointers which will be meshed around.
std::string _extra_flags
Additional flags to be passed to triangle.
MeshBase & mesh
The libMesh namespace provides an interface to certain functionality in the library.
TriangulationType _triangulation_type
The type of triangulation to perform: choices are: convex hull PSLG.
Use the triangle library to triangulate a Planar Straight Line Graph which is defined implicitly by t...
Real & desired_area()
Sets and/or gets the desired triangle area.
const std::vector< Hole * > * _holes
A pointer to a vector of Hole*s.
void triangulate()
This is the main public interface for this function.
The UnstructuredMesh class is derived from the MeshBase class.
bool _insert_extra_points
Flag which tells whether or not to insert additional nodes before triangulation.
Another concrete instantiation of the hole, this one should be sufficiently general for most non-poly...
TriangulationType
The TriangulationType is used with the general triangulate function defined below.
Real _minimum_angle
Minimum angle in triangles.
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...
TriangulationType & triangulation_type()
Sets and/or gets the desired triangulation type.
std::string & extra_flags()
Sets and/or gets additional flags to be passed to triangle.
MeshSerializer _serializer
Triangle only operates on serial meshes.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Temporarily serialize a DistributedMesh for output; a distributed mesh is allgathered by the MeshSeri...
bool _smooth_after_generating
Flag which tells whether we should smooth the mesh after it is generated.
A C++ interface between LibMesh and the Triangle library written by J.R.
bool & insert_extra_points()
Sets and/or gets the flag for inserting add&#39;l points.
TriangleInterface(UnstructuredMesh &mesh)
The constructor.
A concrete instantiation of the Hole class that describes polygonal (triangular, square, pentagonal, ...) holes.
ElemType & elem_type()
Sets and/or gets the desired element type.
ElemType _elem_type
The type of elements to generate.