27#ifndef OOMPH_QUAD_FROM_TRIANGLE_MESH_HEADER
28#define OOMPH_QUAD_FROM_TRIANGLE_MESH_HEADER
43#ifdef OOMPH_HAS_FPUCONTROLH
44#include <fpu_control.h>
50#include "triangle_mesh.h"
69 template<
class ELEMENT>
77#ifdef OOMPH_HAS_TRIANGLE_LIB
84 MeshChecker::assert_geometric_element<QElementGeometricBase, ELEMENT>(2);
97 MeshChecker::assert_geometric_element<QElementGeometricBase, ELEMENT>(2);
128#ifdef OOMPH_HAS_TRIANGLE_LIB
138 MeshChecker::assert_geometric_element<QElementGeometricBase, ELEMENT>(2);
142 triangle_mesh_parameters
156 unsigned max_boundary_id = 0;
169 if (outer_boundary_pt.
size() == 0)
171 std::stringstream error_message;
173 <<
"There are no outer boundaries defined.\n"
174 <<
"Verify that you have specified the outer boundaries in the\n"
175 <<
"Triangle_mesh_parameter object\n\n";
198 outer_boundary_pt[
i], max_boundary_id);
224 internal_closed_curve_pt[
i], max_boundary_id);
250 internal_open_curve_pt[
i], max_boundary_id);
263 outer_boundary_pt[
i]);
272 internal_closed_curve_pt[
i]);
281 internal_open_curve_pt[
i]);
297 std::map<unsigned, Vector<double>>
regions =
303 const bool refine_boundary =
313 <<
"You have specified that Triangle may refine the outer boundary, "
315 <<
"not internal boundaries. Triangle does not support this "
317 <<
"If you do not want Triangle to refine internal boundaries, it "
319 <<
"refine outer boundaries either!\n"
320 <<
"Please either disable all boundary refinement\n"
321 <<
"(call TriangleMeshParameters::disable_boundary_refinement()\n"
322 <<
"or enable internal boundary refinement (the default)\n";
330 outer_boundary_polygon_pt,
334 extra_holes_coordinates,
356 for (
unsigned b = 0; b <
nb; b++)
372 const double& element_area,
378 const bool& refine_boundary,
383 if (element_area < 10
e-14)
387 <<
"The current elements area was stated to (" << element_area
388 <<
").\nThe current precision to generate the input to triangle "
389 <<
"is fixed to 14 digits\n\n";
431 extra_holes_coordinates,
454 input_string_stream <<
" -YY";
458 if (refine_boundary ==
false)
479#ifdef OOMPH_HAS_FPUCONTROLH
490 if (!regions_coordinates.empty())
526#ifdef OOMPH_HAS_TRIANGLE_LIB
528 std::set<TriangleMeshCurveSection*>::iterator
it_polyline;
533 delete (*it_polyline);
536 std::set<TriangleMeshPolygon*>::iterator
it_polygon;
541 delete (*it_polygon);
549 delete (*it_open_polyline);
577 template<
class ELEMENT>
583#ifdef OOMPH_HAS_TRIANGLE_LIB
592 this->setup_quadtree_forest();
603 refine_uniformly(doc_info);
610 unsigned nelem = this->nelement();
632 this->setup_quadtree_forest();
648 template<
class ELEMENT>
667 set_lagrangian_nodal_coordinates();
670#ifdef OOMPH_HAS_TRIANGLE_LIB
681 set_lagrangian_nodal_coordinates();
699 template<
class ELEMENT>
720 set_lagrangian_nodal_coordinates();
723#ifdef OOMPH_HAS_TRIANGLE_LIB
736 set_lagrangian_nodal_coordinates();
Information for documentation of results: Directory and file number to enable output in the form RESL...
void disable_doc()
Disable documentation.
std::string directory() const
Output directory.
double size() const
Calculate the size of the element (length, area, volume,...) in Eulerian computational coordinates....
static Steady< 0 > Default_TimeStepper
Default Steady Timestepper, to be used in default arguments to Mesh constructors.
unsigned nboundary() const
Return number of boundaries.
void set_communicator_pt(OomphCommunicator *comm_pt)
Function to set communicator (mesh is assumed to be distributed if the communicator pointer is non-nu...
An OomphLibError object which should be thrown when an run-time error is encountered....
An OomphLibWarning object which should be created as a temporary object to issue a warning....
Quad mesh built on top of triangle scaffold mesh coming from the triangle mesh generator Triangle....
TimeStepper * Time_stepper_pt
Timestepper used to build elements.
QuadFromTriangleMesh(TriangleMeshParameters &triangle_mesh_parameters, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Build mesh, based on the specifications on TriangleMeshParameters. All the actual work is done in Uns...
void operator=(const QuadFromTriangleMesh &)=delete
Broken assignment operator.
~QuadFromTriangleMesh()
Empty destructor.
QuadFromTriangleMesh(const std::string &node_file_name, const std::string &element_file_name, const std::string &poly_file_name, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper, const bool &use_attributes=false, const bool &allow_automatic_creation_of_vertices_on_boundaries=true)
Constructor with the input files.
bool Use_attributes
Boolean flag to indicate whether to use attributes or not (required for multidomain meshes)
void generic_constructor(Vector< TriangleMeshPolygon * > &outer_boundary_pt, Vector< TriangleMeshPolygon * > &internal_polygon_pt, Vector< TriangleMeshOpenCurve * > &open_polylines_pt, const double &element_area, Vector< Vector< double > > &extra_holes_coordinates, std::map< unsigned, Vector< double > > ®ions_coordinates, std::map< unsigned, double > ®ions_areas, TimeStepper *time_stepper_pt, const bool &use_attributes, const bool &refine_boundary, const bool &refine_internal_boundary)
A general-purpose construction function that builds the mesh once the different specific constructors...
void build_from_scaffold(TriangleScaffoldMesh *tmp_mesh_pt, TimeStepper *time_stepper_pt, const bool &use_attributes)
Build the quad mesh from the given scaffold mesh.
QuadFromTriangleMesh(const QuadFromTriangleMesh &dummy)=delete
Broken copy constructor.
QuadFromTriangleMesh()
Empty constructor.
Base class for quad meshes (meshes made of 2D quad elements).
Unstructured refineable QuadFromTriangleMesh.
virtual void refine_uniformly()
Refine mesh uniformly.
RefineableQuadFromTriangleMesh(TriangleMeshParameters &triangle_mesh_parameters, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Build mesh, based on the specifications on TriangleMeshParameters.
RefineableQuadFromTriangleMesh(const std::string &node_file_name, const std::string &element_file_name, const std::string &poly_file_name, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Build mesh, based on the polyfiles.
virtual ~RefineableQuadFromTriangleMesh()
Empty Destructor.
void refine_uniformly(DocInfo &doc_info)
Refine mesh uniformly and doc process.
Unstructured refineable QuadFromTriangleMesh upgraded to solid mesh.
virtual ~RefineableSolidQuadFromTriangleMesh()
Empty Destructor.
RefineableSolidQuadFromTriangleMesh(TriangleMeshParameters &triangle_mesh_parameters, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Build mesh, based on the specifications on TriangleMeshParameter.
RefineableSolidQuadFromTriangleMesh(const std::string &node_file_name, const std::string &element_file_name, const std::string &poly_file_name, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper, const bool &use_attributes=false)
Build mesh from specified triangulation and associated target areas for elements in it.
Unstructured QuadFromTriangleMesh upgraded to solid mesh.
SolidQuadFromTriangleMesh(TriangleMeshParameters &triangle_mesh_parameters, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Build mesh, based on closed curve that specifies the outer boundary of the domain and any number of i...
SolidQuadFromTriangleMesh(const std::string &node_file_name, const std::string &element_file_name, const std::string &poly_file_name, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper, const bool &use_attributes=false)
virtual ~SolidQuadFromTriangleMesh()
Empty Destructor.
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
Helper object for dealing with the parameters used for the TriangleMesh objects.
bool is_automatic_creation_of_vertices_on_boundaries_allowed()
Returns the status of the variable Allow_automatic_creation_of_vertices_on_boundaries.
OomphCommunicator * communicator_pt() const
Read-only access fct to communicator (Null if mesh is not distributed)
Triangle Mesh that is based on input files generated by the triangle mesh generator Triangle.
Contains functions which define the geometry of the mesh, i.e. regions, boundaries,...
Vector< TriangleMeshOpenCurve * > Internal_open_curve_pt
Vector of open polylines that define internal curves.
bool is_automatic_creation_of_vertices_on_boundaries_allowed()
Returns the status of the variable Allow_automatic_creation_of_vertices_on_boundaries.
Vector< TriangleMeshPolygon * > Outer_boundary_pt
Polygon that defines outer boundaries.
Vector< TriangleMeshPolygon * > Internal_polygon_pt
Vector of polygons that define internal polygons.
void snap_nodes_onto_geometric_objects()
Snap the boundary nodes onto any curvilinear boundaries defined by geometric objects.
TriangleMeshOpenCurve * create_open_curve_with_polyline_helper(TriangleMeshOpenCurve *open_curve_pt, unsigned &max_bnd_id_local)
Helper function that creates and returns an open curve with the polyline representation of its consti...
std::map< unsigned, Vector< double > > Regions_coordinates
Storage for extra coordinates for regions. The key on the map is the region id.
Vector< Vector< double > > Extra_holes_coordinates
Storage for extra coordinates for holes.
bool Allow_automatic_creation_of_vertices_on_boundaries
Flag to indicate whether the automatic creation of vertices along the boundaries by Triangle is allow...
TriangleMeshPolygon * closed_curve_to_polygon_helper(TriangleMeshClosedCurve *closed_curve_pt, unsigned &max_bnd_id_local)
Helper function that returns a polygon representation for the given closed curve, it also computes th...
std::set< TriangleMeshOpenCurve * > Free_open_curve_pt
A set that contains the open curves created by this object therefore it is necessary to free their as...
std::set< TriangleMeshCurveSection * > Free_curve_section_pt
A set that contains the curve sections created by this object therefore it is necessary to free their...
std::set< TriangleMeshPolygon * > Free_polygon_pt
A set that contains the polygons created by this object therefore it is necessary to free their assoc...
void build_triangulateio(Vector< TriangleMeshPolygon * > &outer_polygons_pt, Vector< TriangleMeshPolygon * > &internal_polygons_pt, Vector< TriangleMeshOpenCurve * > &open_curves_pt, Vector< Vector< double > > &extra_holes_coordinates, std::map< unsigned, Vector< double > > ®ions_coordinates, std::map< unsigned, double > ®ions_areas, TriangulateIO &triangulate_io)
Create TriangulateIO object from outer boundaries, internal boundaries, and open curves....
void set_geom_objects_and_coordinate_limits_for_open_curve(TriangleMeshOpenCurve *input_open_curve_pt)
Stores the geometric objects associated to the curve sections that compound the open curve....
void set_geom_objects_and_coordinate_limits_for_close_curve(TriangleMeshClosedCurve *input_closed_curve_pt)
Stores the geometric objects associated to the curve sections that compound the closed curve....
A slight extension to the standard template vector class so that we can include "graceful" array rang...
void initialise_triangulateio(TriangulateIO &triangle_io)
Initialise TriangulateIO structure.
void clear_triangulateio(TriangulateIO &triangulate_io, const bool &clear_hole_data)
Clear TriangulateIO structure.
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
void triangulate(char *triswitches, struct oomph::TriangulateIO *in, struct oomph::TriangulateIO *out, struct oomph::TriangulateIO *vorout)
The Triangle data structure, modified from the triangle.h header supplied with triangle 1....