Line data Source code
1 : // The libMesh Finite Element Library. 2 : // Copyright (C) 2002-2025 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/mesh_serializer.h" 29 : #include "libmesh/triangulator_interface.h" 30 : 31 : namespace libMesh 32 : { 33 : 34 : /** 35 : * A C++ interface between LibMesh and the Triangle library written by 36 : * J.R. Shewchuk. 37 : * 38 : * \author John W. Peterson 39 : * \date 2011 40 : */ 41 : class TriangleInterface : public TriangulatorInterface 42 : { 43 : public: 44 : /** 45 : * The constructor. A reference to the mesh containing the points 46 : * which are to be triangulated must be provided. Unless otherwise 47 : * specified, a convex hull will be computed for the set of input points 48 : * and the convex hull will be meshed. 49 : */ 50 : explicit 51 : TriangleInterface(UnstructuredMesh & mesh); 52 : 53 : /** 54 : * Empty destructor. 55 : */ 56 40 : virtual ~TriangleInterface() = default; 57 : 58 : /** 59 : * Internally, this calls Triangle's triangulate routine. 60 : */ 61 : virtual void triangulate() override; 62 : 63 : /** 64 : * Sets and/or gets additional flags to be passed to triangle 65 : */ 66 : std::string & extra_flags() {return _extra_flags;} 67 : 68 : private: 69 : /** 70 : * Additional flags to be passed to triangle 71 : */ 72 : std::string _extra_flags; 73 : 74 : /** 75 : * Triangle only operates on serial meshes. 76 : */ 77 : MeshSerializer _serializer; 78 : }; 79 : 80 : } // namespace libMesh 81 : 82 : #endif // LIBMESH_HAVE_TRIANGLE 83 : 84 : #endif // ifndef LIBMESH_MESH_TRIANGLE_INTERFACE_H