18#include "libmesh/mesh_triangle_holes.h"
19#include "libmesh/parsed_function.h"
20#include "libmesh/point_locator_base.h"
56 std::unique_ptr<MeshBase>
generate()
override;
82 std::unique_ptr<MeshBase>
84 const std::vector<std::unique_ptr<MeshBase>> & holes,
105 void appendLoop(
const std::vector<Point> & loop,
107 unsigned int extra_nodes,
108 boundary_id_type bcid,
109 std::vector<Point> & points,
110 std::vector<XYIncrementalDelaunay::Segment> & segments);
130 std::pair<Point, Point>
localFrame(
const Point & point)
const;
134 const Point & second,
135 const std::pair<Point, Point> & frame)
const;
141 std::pair<long, long>
gridKey(
const Point & point, Real cell)
const;
148 void addToGrid(std::size_t vertex,
const Point & point);
160 const std::pair<Point, Point> & frame)
const;
179 std::vector<FrontEdge>
181 const std::vector<XYIncrementalDelaunay::Triangle> & triangles,
182 const std::vector<bool> & inside)
const;
235 std::vector<std::unique_ptr<libMesh::TriangulatorInterface::MeshedHole>>
_hole_outlines;
265 std::map<std::pair<long, long>, std::vector<std::size_t>>
_vertex_grid;
const InputParameters & parameters() const
Get the parameters of the object.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Base class for Delaunay mesh generators applied to a surface.
Generates a triangulation in the XY plane by advancing a front, based on an input mesh defining the o...
static constexpr Real _size_tolerance
How far the circumradius of a triangle may exceed the target before the advance refines it.
const std::vector< bool > _refine_holes
Whether to allow automatically refining each hole boundary.
std::map< XYIncrementalDelaunay::Segment, boundary_id_type > _segment_boundary_ids
Boundary id of each seed segment, keyed on its two vertices with the smaller id first.
const std::string _desired_area_func
Desired triangle area as a (fparser-compatible) function of x,y.
std::unique_ptr< MeshBase > buildTriangleMesh(const XYIncrementalDelaunay &delaunay)
static constexpr Real _rejection_factor
How close to an existing vertex, as a fraction of the target size, a new point may not come.
Real _boundary_cell
Side of the buckets the boundary segments are sorted into so that the frame search stays local.
std::pair< Point, Point > localFrame(const Point &point) const
void recordSplitBoundaryIds(const XYIncrementalDelaunay &delaunay, std::size_t vertex)
Moves the boundary id recorded for the constrained segment an insertion split onto the two halves tha...
const std::vector< std::unique_ptr< MeshBase > * > _hole_ptrs
Holds pointers to the pointers to input meshes defining holes.
Real _grid_cell
Side of the buckets the vertices are sorted into so that the rejection rule stays local.
Real targetSize(Real area) const
void appendLoop(const std::vector< Point > &loop, bool refine, unsigned int extra_nodes, boundary_id_type bcid, std::vector< Point > &points, std::vector< XYIncrementalDelaunay::Segment > &segments)
Adds one closed loop of the input boundary to the points the triangulation is seeded with and to the ...
static std::map< dof_id_type, Real > boundaryTangentAngles(const MeshBase &mesh)
void advanceFront(XYIncrementalDelaunay &delaunay)
Advances the front over the whole domain, inserting points into the triangulation.
std::vector< FrontEdge > collectFront(const XYIncrementalDelaunay &delaunay, const std::vector< XYIncrementalDelaunay::Triangle > &triangles, const std::vector< bool > &inside) const
bool hasVertexWithin(const XYIncrementalDelaunay &delaunay, const Point &point, Real distance, const std::pair< Point, Point > &frame) const
std::unique_ptr< MeshBase > buildBackgroundMesh(const MeshBase &boundary_mesh, const std::vector< std::unique_ptr< MeshBase > > &holes, const MeshTriangulationUtils::XYDelaunayOptions &opts)
Triangulates the domain with the existing Delaunay triangulator at _background_area_factor times the ...
Real metricDistance(const Point &first, const Point &second, const std::pair< Point, Point > &frame) const
std::map< std::pair< long, long >, std::vector< std::size_t > > _vertex_grid
Vertex ids of the triangulation, bucketed by position.
static InputParameters validParams()
const MooseEnum _metric
Norm the target size is measured in when a point is placed ahead of the front.
const Real _desired_area
Desired (maximum) triangle area.
std::map< std::pair< long, long >, std::vector< std::size_t > > _boundary_segment_grid
Indices into _boundary_segments, bucketed by the cells each of those segments passes through.
Real targetCircumradius(Real size) const
std::vector< std::unique_ptr< libMesh::TriangulatorInterface::MeshedHole > > _hole_outlines
Outlines of the holes, which the advance stays outside.
Real targetArea(const Point &point) const
std::unique_ptr< MeshBase > _background_mesh
Coarse triangulation of the domain the cross field is solved on.
std::unique_ptr< libMesh::ParsedFunction< Real > > _area_function
Desired area as a function of position, built only when 'desired_area_func' is set.
std::unique_ptr< MeshBase > & _bdy_ptr
Input mesh defining the boundary to triangulate within.
std::unique_ptr< libMesh::TriangulatorInterface::MeshedHole > _outer_outline
Outline of the outer boundary, which the advance stays inside.
std::pair< long, long > gridKey(const Point &point, Real cell) const
void addToGrid(std::size_t vertex, const Point &point)
Records a vertex in the grid the rejection rule searches.
static constexpr Real _background_area_factor
How much coarser in area the background triangulation is than the mesh being generated.
void buildBoundarySegmentGrid()
Sorts the boundary segments into the buckets the BOUNDARY frame searches, so that a search only has t...
Real _background_mean_area
Mean area of the background elements, the target where the background locator finds nothing.
const std::vector< Point > _interior_points
Desired interior node locations.
bool placePoint(const XYIncrementalDelaunay &delaunay, const FrontEdge &edge, Point &point) const
Computes where the advance would place a point ahead of a front edge and applies the rejection rule t...
std::vector< std::pair< Point, Point > > _boundary_segments
Segments of the outer boundary and of the holes, whose tangents give the BOUNDARY frame.
const std::vector< bool > _stitch_holes
Whether to stitch to the mesh defining each hole.
std::unique_ptr< XYCrossFieldSolver > _cross_field
Cross field over the domain, built only when the LINF metric asks for the CROSS_FIELD frame.
std::unique_ptr< libMesh::PointLocatorBase > _background_locator
Locates the background element whose area is the target where no area limit was given.
const MooseEnum _orientation
Where the local frame the LINF metric measures in comes from.
bool insideDomain(const Point &point) const
const unsigned int _add_nodes_per_boundary_segment
How many more nodes to add in each outer boundary segment.
const bool _refine_bdy
Whether to allow automatically refining the outer boundary.
std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
Constrained Delaunay triangulation of a set of points in the plane, built one point at a time.
Bundle of inputs for triangulateWithDelaunay.
An edge of the front, which separates the triangles that meet the target size from the triangles that...
std::size_t start
Vertex at the start of the edge, which has the triangle that misses the target on its left.
std::size_t end
Vertex at the end of the edge.
Real excess
Circumradius of that triangle over the target circumradius, larger being further off.