libMesh
mesh_triangle_wrapper.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_WRAPPER_H
20 #define LIBMESH_MESH_TRIANGLE_WRAPPER_H
21 
22 #include "libmesh/libmesh_config.h"
23 
24 #ifdef LIBMESH_HAVE_TRIANGLE
25 
26 // Local Includes
27 #include "libmesh/libmesh_common.h" // Real
28 
29 #ifdef LIBMESH_FORWARD_DECLARE_ENUMS
30 namespace libMesh
31 {
32 enum ElemType : int;
33 }
34 #else
35 #include "libmesh/enum_elem_type.h"
36 #endif
37 
38 // C++ includes
39 #include <cstddef>
40 
41 namespace libMesh
42 {
43 // Forward declarations
45 
46 // Make sure Triangle uses our "Real" as its "REAL"
47 typedef Real REAL;
48 
58 namespace TriangleWrapper
59 {
60 extern "C"
61 {
62 #include "triangle.h"
63 }
64 
65 enum IO_Type {
66  INPUT = 0,
67  OUTPUT = 1,
68  BOTH = 2};
69 
76 void init(triangulateio & t);
77 
88 void destroy(triangulateio & t, IO_Type);
89 
96 void copy_tri_to_mesh(const triangulateio & triangle_data_input,
97  UnstructuredMesh & mesh_output,
98  const ElemType type,
99  const triangulateio * voronoi = nullptr);
100 } // namespace TriangleWrapper
101 } // namespace libMesh
102 
103 
104 #endif // LIBMESH_HAVE_TRIANGLE
105 
106 #endif // LIBMESH_MESH_TRIANGLE_WRAPPER_H
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::TriangleWrapper::init
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
libMesh::TriangleWrapper::copy_tri_to_mesh
void copy_tri_to_mesh(const triangulateio &triangle_data_input, UnstructuredMesh &mesh_output, const ElemType type, const triangulateio *voronoi=nullptr)
Copies triangulation data computed by triangle from a triangulateio object to a LibMesh mesh.
Definition: mesh_triangle_wrapper.C:103
libMesh::TriangleWrapper::destroy
void destroy(triangulateio &t, IO_Type)
Frees any memory which has been dynamically allocated by Triangle.
libMesh::TriangleWrapper::BOTH
Definition: mesh_triangle_wrapper.h:68
libMesh::REAL
Real REAL
Definition: mesh_triangle_wrapper.h:44
libMesh::UnstructuredMesh
The UnstructuredMesh class is derived from the MeshBase class.
Definition: unstructured_mesh.h:48
libMesh::TriangleWrapper::INPUT
Definition: mesh_triangle_wrapper.h:66
libMesh::TriangleWrapper::IO_Type
IO_Type
Definition: mesh_triangle_wrapper.h:65
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::TriangleWrapper::OUTPUT
Definition: mesh_triangle_wrapper.h:67
int
void ErrorVector unsigned int
Definition: adjoints_ex3.C:360
libMesh::ElemType
ElemType
Defines an enum for geometric element types.
Definition: enum_elem_type.h:33