30#include "triangle_mesh.h"
34#ifdef OOMPH_HAS_TRIANGLE_LIB
54 for (
unsigned b = 0; b <
nb; b++)
58 dump_file <<
"1 # Boundary coordinate for boundary " << b
62 for (
unsigned j = 0;
j <
nnod;
j++)
68 dump_file <<
"-999 # Done boundary coords for boundary " << b <<
"\n";
72 dump_file <<
"0 # Boundary coordinate for boundary " << b
73 <<
" does not exist\n";
116 <<
"Number of boundaries before remesh from triangulateio, "
117 <<
nbound_new <<
",\ndoesn't match number boundaries afterwards, "
119 <<
". Have you messed \naround with boundary nodes in the "
120 <<
"derived mesh constructor (or after calling \nit)? If so,"
121 <<
" the dump/restart won't work as written at the moment.";
133 for (
unsigned b = 0; b <
nb; b++)
163 <<
" doesn't match number of nodes on boundary " << b
164 <<
": " <<
nnod << std::endl;
171 for (
unsigned j = 0;
j <
nnod;
j++)
195 error_stream <<
"Haven't read all nodes on boundary " << b
204 oomph_info <<
"Restart: Boundary coordinate for boundary " << b
205 <<
" does not exist.\n";
230 outfile <<
"# Triangulateio object values:\n\n" << std::endl;
235 outfile <<
"# Triangulateio number of points is:"
236 <<
triangle.numberofpoints << std::endl;
240 outfile <<
"# Vertex coordinates are:" << std::endl;
241 for (
int k = 0;
k <
triangle.numberofpoints * 2;
k += 2)
244 <<
triangle.pointlist[
k + 1] << std::endl;
249 if (
triangle.numberofpointattributes != 0)
251 outfile <<
"# Triangulateio number of points attributelist is:"
252 <<
triangle.numberofpointattributes << std::endl;
256 outfile <<
"# Vertex attribute are:" << std::endl;
257 for (
int k = 0;
k <
triangle.numberofpointattributes;
k++)
266 outfile <<
"# Vertex Markers are:" << std::endl;
280 <<
triangle.numberofpointattributes <<
" 0" << std::endl;
281 for (
int j = 0;
j <
triangle.numberofpoints * 2;
j += 2)
284 <<
triangle.pointlist[
j + 1] << std::endl;
297 outfile <<
"# Segments are:" << std::endl;
298 for (
int k = 0;
k <
triangle.numberofsegments * 2;
k += 2)
301 <<
triangle.segmentlist[
k + 1] << std::endl;
308 outfile <<
"# Segments Markers are:" << std::endl;
309 for (
int k = 0;
k <
triangle.numberofsegments;
k++)
330 outfile <<
"# Holes are:" << std::endl;
331 for (
int k = 0;
k <
triangle.numberofholes * 2;
k += 2)
339 if (
triangle.numberoftriangles != 0)
341 outfile <<
"# Triangulateio number of triangles:"
342 <<
triangle.numberoftriangles << std::endl;
346 outfile <<
"# Triangulateio number of corners:"
347 <<
triangle.numberofcorners << std::endl;
349 if (
triangle.numberoftriangleattributes != 0)
351 outfile <<
"# Triangulateio number of triangles attributes:"
352 <<
triangle.numberoftriangleattributes << std::endl;
356 outfile <<
"# Traingles are:" << std::endl;
357 for (
int k = 0;
k <
triangle.numberoftriangles * 3;
k += 3)
361 <<
triangle.trianglelist[
k + 2] << std::endl;
367 outfile <<
"# Triangle's areas are:" << std::endl;
368 for (
int k = 0;
k <
triangle.numberoftriangles;
k++)
383 for (
int j = 0;
j <
triangle.numberoftriangles * 3;
j += 3)
387 <<
triangle.trianglelist[
j + 2] << std::endl;
436 std::map<Edge, TriangleBoundaryHelper::BCInfo>
edge_bcinfo;
437 std::map<Edge, TriangleBoundaryHelper::BCInfo>
face_info;
445 for (
unsigned e = 0;
e <
nel;
e++)
463 for (
unsigned i = 0;
i < 3;
i++)
488 std::insert_iterator<std::set<unsigned>>(
489 edge_boundary[0], edge_boundary[0].
begin()));
490 std::set<unsigned>::iterator
it0 = edge_boundary[0].begin();
493 if (edge_boundary[0].size() > 0)
517 std::insert_iterator<std::set<unsigned>>(
518 edge_boundary[1], edge_boundary[1].
begin()));
527 std::set<unsigned>::iterator
it1 = edge_boundary[1].begin();
530 if (edge_boundary[1].size() > 0)
554 std::insert_iterator<std::set<unsigned>>(
555 edge_boundary[2], edge_boundary[2].
begin()));
564 std::set<unsigned>::iterator
it2 = edge_boundary[2].begin();
567 if (edge_boundary[2].size() > 0)
588 for (
unsigned i = 0;
i < 3;
i++)
595 for (std::set<unsigned>::iterator
it = edge_boundary[
i].
begin();
596 it != edge_boundary[
i].end();
608 error_stream <<
"This is rather strange, so I'm going to die\n";
618 for (
unsigned i = 0;
i < 3;
i++)
626 typedef std::map<Edge, TriangleBoundaryHelper::BCInfo>::iterator
ITE;
630 unsigned bound =
it->second.Boundary;
644 info.Face_id =
it->second.Face_id;
645 info.FE_pt =
it->second.FE_pt;
646 info.Boundary =
it->second.Boundary;
717 if (
itt->second.Boundary ==
i)
738 outfile <<
"Boundary: " <<
i <<
" is adjacent to " <<
nel <<
" elements"
742 for (
unsigned e = 0;
e <
nel;
e++)
746 <<
" Face index of boundary is "
A general Finite Element class.
double size() const
Calculate the size of the element (length, area, volume,...) in Eulerian computational coordinates....
unsigned dim() const
Return the spatial dimension of the element, i.e. the number of local coordinates required to paramet...
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
unsigned long nboundary_node(const unsigned &ibound) const
Return number of nodes on a particular boundary.
bool is_mesh_distributed() const
Boolean to indicate if Mesh has been distributed.
Vector< Vector< FiniteElement * > > Boundary_element_pt
Vector of Vector of pointers to elements on the boundaries: Boundary_element_pt(b,...
bool Lookup_for_elements_next_boundary_is_setup
Flag to indicate that the lookup schemes for elements that are adjacent to the boundaries has been se...
FiniteElement * finite_element_pt(const unsigned &e) const
Upcast (downcast?) to FiniteElement (needed to access FiniteElement member functions).
Vector< Vector< int > > Face_index_at_boundary
For the e-th finite element on boundary b, this is the index of the face that lies along that boundar...
unsigned nboundary() const
Return number of boundaries.
void set_boundary_coordinate_exists(const unsigned &i)
Set boundary coordinate on the i-th boundary to be existing.
bool boundary_coordinate_exists(const unsigned &i) const
Indicate whether the i-th boundary has an intrinsic coordinate.
unsigned long nelement() const
Return number of elements in the mesh.
Node *& boundary_node_pt(const unsigned &b, const unsigned &n)
Return pointer to node n on boundary b.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
virtual void get_boundaries_pt(std::set< unsigned > *&boundaries_pt)
Return a pointer to set of mesh boundaries that this node occupies; this will be overloaded by Bounda...
An OomphLibError object which should be thrown when an run-time error is encountered....
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
virtual void remesh_from_internal_triangulateio()
Virtual function that is used for specific remeshing from the triangulateio.
void dump_triangulateio(std::ostream &dump_file)
Dump the triangulateio structure to a dump file and record boundary coordinates of boundary nodes.
TriangulateIO Triangulateio
TriangulateIO representation of the mesh.
void remesh_from_triangulateio(std::istream &restart_file)
Regenerate the mesh from a dumped triangulateio file and dumped boundary coordinates of boundary node...
void setup_boundary_element_info()
Setup lookup schemes which establish whic elements are located next to mesh's boundaries (wrapper to ...
void write_triangulateio(TriangulateIO &triangulate_io, std::string &s)
Helper function. Write a TriangulateIO object file with all the triangulateio fields....
A slight extension to the standard template vector class so that we can include "graceful" array rang...
void dump_triangulateio(TriangulateIO &triangle_io, std::ostream &dump_file)
Write all the triangulateio data to disk in a dump file that can then be used to restart simulations.
void read_triangulateio(std::istream &restart_file, TriangulateIO &triangle_io)
Read the triangulateio data from a dump file on disk, which can then be used to restart simulations.
void clear_triangulateio(TriangulateIO &triangulate_io, const bool &clear_hole_data)
Clear TriangulateIO structure.
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
OomphInfo oomph_info
Single (global) instantiation of the OomphInfo object – this is used throughout the library as a "rep...
Structure for Boundary Informations.
The Triangle data structure, modified from the triangle.h header supplied with triangle 1....