LCOV - code coverage report
Current view: top level - include/mesh - mesh_tetgen_interface.h (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4229 (6a9aeb) with base 727f46 Lines: 1 1 100.0 %
Date: 2025-08-19 19:27:09 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          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_TETGEN_INTERFACE_H
      20             : #define LIBMESH_MESH_TETGEN_INTERFACE_H
      21             : 
      22             : #include "libmesh/libmesh_config.h"
      23             : #ifdef LIBMESH_HAVE_TETGEN
      24             : 
      25             : 
      26             : // Local includes
      27             : #include "libmesh/mesh_serializer.h"
      28             : #include "libmesh/mesh_tet_interface.h"
      29             : #include "libmesh/point.h" // used for specifying holes
      30             : 
      31             : // C++ includes
      32             : #include <cstddef>
      33             : #include <map>
      34             : #include <string>
      35             : #include <vector>
      36             : 
      37             : namespace libMesh
      38             : {
      39             : // Forward Declarations
      40             : class UnstructuredMesh;
      41             : class TetGenWrapper;
      42             : class Elem;
      43             : 
      44             : /**
      45             :  * Class \p TetGenMeshInterface provides an interface for
      46             :  * tetrahedralization of meshes using the TetGen library.  For
      47             :  * information about TetGen cf.
      48             :  * <a href="http://tetgen.org/">TetGen home page</a>.
      49             :  *
      50             :  * \author Steffen Petersen
      51             :  * \date 2004
      52             :  * \author John W. Peterson
      53             :  * \date 2011
      54             :  */
      55             : class TetGenMeshInterface : public MeshTetInterface
      56             : {
      57             : public:
      58             : 
      59             :   /**
      60             :    * Constructor. Takes a reference to the mesh.
      61             :    */
      62             :   explicit
      63             :   TetGenMeshInterface (UnstructuredMesh & mesh);
      64             : 
      65             :   /**
      66             :    * Empty destructor.
      67             :    */
      68          40 :   virtual ~TetGenMeshInterface() override = default;
      69             : 
      70             :   /**
      71             :    * Method to set switches to tetgen, allowing for different behaviours
      72             :    */
      73             :   void set_switches(std::string new_switches);
      74             : 
      75             :   /**
      76             :    * Method invokes TetGen library to compute a Delaunay tetrahedralization
      77             :    */
      78             :   virtual void triangulate () override;
      79             : 
      80             :   /**
      81             :    * Method invokes TetGen library to compute a Delaunay tetrahedralization
      82             :    * from the nodes point set.
      83             :    */
      84             :   void triangulate_pointset ();
      85             : 
      86             :   /**
      87             :    * Method invokes TetGen library to compute a Delaunay tetrahedralization
      88             :    * from the nodes point set. Stores only 2D hull surface elements.
      89             :    */
      90             :   void pointset_convexhull ();
      91             : 
      92             :   /**
      93             :    * Method invokes TetGen library to compute a Delaunay tetrahedralization
      94             :    * from the nodes point set. Boundary constraints are taken from
      95             :    * elements array.
      96             :    */
      97             :   void triangulate_conformingDelaunayMesh (double quality_constraint=0.,
      98             :                                            double volume_constraint=0.);
      99             : 
     100             :   /**
     101             :    * Method invokes TetGen library to compute a Delaunay tetrahedralization
     102             :    * from the nodes point set. Boundary constraints are taken from
     103             :    * elements array. Include carve-out functionality.
     104             :    */
     105             :   void triangulate_conformingDelaunayMesh_carvehole (const std::vector<Point> & holes,
     106             :                                                      double quality_constraint=0.,
     107             :                                                      double volume_constraint=0.);
     108             : 
     109             : 
     110             : 
     111             : protected:
     112             :   /**
     113             :    * This function copies nodes from the _mesh into TetGen's
     114             :    * pointlist.  Takes some pains to ensure that non-sequential
     115             :    * node numberings (which can happen with e.g. DistributedMesh)
     116             :    * are handled.
     117             :    */
     118             :   void fill_pointlist(TetGenWrapper & wrapper);
     119             : 
     120             :   /**
     121             :    * Assigns the node IDs contained in the 'node_labels'
     122             :    * array to 'elem'.
     123             :    */
     124             :   void assign_nodes_to_elem(unsigned * node_labels, Elem * elem);
     125             : 
     126             :   /**
     127             :    * We should not assume libmesh nodes are numbered sequentially...
     128             :    * This is not the default behavior of DistributedMesh, for example,
     129             :    * unless you specify node IDs explicitly.  So this array allows us
     130             :    * to keep a mapping between the sequential numbering in
     131             :    * tetgen_data.pointlist.
     132             :    */
     133             :   std::vector<unsigned> _sequential_to_libmesh_node_map;
     134             : 
     135             :   /**
     136             :    * Tetgen only operates on serial meshes.
     137             :    */
     138             :   MeshSerializer _serializer;
     139             : 
     140             :   /**
     141             :    * Parameter controlling the behaviour of tetgen.
     142             :    * By default quiet.
     143             :    */
     144             :   std::string _switches;
     145             : };
     146             : 
     147             : } // namespace libMesh
     148             : 
     149             : #endif // LIBMESH_HAVE_TETGEN
     150             : 
     151             : #endif // LIBMESH_MESH_TETGEN_INTERFACE_H

Generated by: LCOV version 1.14