libMesh
Loading...
Searching...
No Matches
poly2tri_triangulator.h
Go to the documentation of this file.
1// The libMesh Finite Element Library.
2// Copyright (C) 2002-2026 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_POLY2TRI_TRIANGULATOR_H
20#define LIBMESH_POLY2TRI_TRIANGULATOR_H
21
22#include <memory>
23
24#include "libmesh/libmesh_config.h"
25
26#ifdef LIBMESH_HAVE_POLY2TRI
27
28// Local Includes
29#include "libmesh/dof_object.h"
30#include "libmesh/triangulator_interface.h"
31
32namespace libMesh
33{
34
35// Forward Declarations
36class BoundaryInfo;
37class Elem;
38
47{
48public:
60 explicit
62 dof_id_type n_boundary_nodes =
64
70
76 virtual void triangulate() override;
77
83 virtual void set_desired_area_function (FunctionBase<Real> * desired) override;
84
90
97 virtual void set_refine_boundary_allowed (bool refine_bdy_allowed) override
98 { _refine_bdy_allowed = refine_bdy_allowed; }
99
104 virtual bool refine_boundary_allowed () const override
105 { return _refine_bdy_allowed; }
106
107
108protected:
112 bool is_refine_boundary_allowed(const BoundaryInfo & boundary_info,
113 const Elem & elem,
114 unsigned int side);
115
120
126
131 bool should_refine_elem(Elem & elem);
132
133private:
134
139 std::map<const Hole *, std::unique_ptr<ArbitraryHole>> replaced_holes;
140
145
149 std::unique_ptr<FunctionBase<Real>> _desired_area_func;
150
155};
156
157} // namespace libMesh
158
159#endif // LIBMESH_HAVE_TRIANGLE
160
161#endif // ifndef LIBMESH_POLY2TRI_TRIANGULATOR_H
The BoundaryInfo class contains information relevant to boundary conditions including storing faces,...
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition dof_object.h:473
This is the base class from which all geometric element types are derived.
Definition elem.h:96
Base class for functors that can be evaluated at a point and (optionally) time.
A C++ interface between LibMesh and the poly2tri library, with custom code for Steiner point insertio...
bool _refine_bdy_allowed
Whether to allow boundary refinement.
virtual FunctionBase< Real > * get_desired_area_function() override
Get the function giving desired triangle area as a function of position, or nullptr if no such functi...
virtual void set_refine_boundary_allowed(bool refine_bdy_allowed) override
Set whether or not the triangulation is allowed to refine the mesh boundary when refining the interio...
virtual void set_desired_area_function(FunctionBase< Real > *desired) override
Set a function giving desired triangle area as a function of position.
bool is_refine_boundary_allowed(const BoundaryInfo &boundary_info, const Elem &elem, unsigned int side)
Is refining this element's boundary side allowed?
std::map< const Hole *, std::unique_ptr< ArbitraryHole > > replaced_holes
We might have to replace the user-provided holes with refined versions.
std::unique_ptr< FunctionBase< Real > > _desired_area_func
Location-dependent area requirements.
virtual void triangulate() override
Internally, this calls the poly2tri triangulation code in a loop, inserting our owner Steiner points ...
virtual ~Poly2TriTriangulator()
Empty destructor.
bool should_refine_elem(Elem &elem)
Returns true if the given element ought to be refined according to current criteria.
virtual bool refine_boundary_allowed() const override
Get whether or not the triangulation is allowed to refine the mesh boundary when refining the interio...
bool insert_refinement_points()
Add Steiner points as new mesh nodes, as necessary to refine an existing trangulation.
void triangulate_current_points()
Triangulate the current mesh and hole points.
dof_id_type _n_boundary_nodes
Keep track of how many mesh nodes are boundary nodes.
The UnstructuredMesh class is derived from the MeshBase class.
MeshBase & mesh
The libMesh namespace provides an interface to certain functionality in the library.
uint8_t dof_id_type
Definition id_types.h:67