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 } // namespace TriangleWrapper
100 } // namespace libMesh
101 
102 
103 #endif // LIBMESH_HAVE_TRIANGLE
104 
105 #endif // LIBMESH_MESH_TRIANGLE_WRAPPER_H
ElemType
Defines an enum for geometric element types.
The libMesh namespace provides an interface to certain functionality in the library.
The UnstructuredMesh class is derived from the MeshBase class.
void copy_tri_to_mesh(const triangulateio &triangle_data_input, UnstructuredMesh &mesh_output, const ElemType type)
Copies triangulation data computed by triangle from a triangulateio object to a LibMesh mesh...
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void destroy(triangulateio &t, IO_Type)
Frees any memory which has been dynamically allocated by Triangle.