26 #ifndef OOMPH_TRIANGLE_MESH_HEADER
27 #define OOMPH_TRIANGLE_MESH_HEADER
30 #include <oomph-lib-config.h>
39 #ifdef OOMPH_HAS_FPUCONTROLH
40 #include <fpu_control.h>
51 #include "../generic/problem.h"
52 #include "../generic/triangle_scaffold_mesh.h"
53 #include "../generic/triangle_mesh.h"
54 #include "../generic/refineable_mesh.h"
55 #include "../rigid_body/immersed_rigid_body_elements.h"
59 #ifdef OOMPH_HAS_TRIANGLE_LIB
74 struct oomph::TriangulateIO* in,
75 struct oomph::TriangulateIO*
out,
76 struct oomph::TriangulateIO* vorout);
219 std::ostringstream error_message;
221 <<
"Please use another region id different from zero.\n"
222 <<
"It is internally used as the default region number.\n";
229 std::map<unsigned, Vector<double>>::iterator it;
235 std::ostringstream error_message;
236 error_message <<
"The region id (" <<
i <<
") that you are using for"
238 <<
"your region is already in use. Use another\n"
239 <<
"region id and verify that you are not re-using\n"
240 <<
" previously defined regions ids\n"
422 template<
class ELEMENT>
429 #ifdef OOMPH_HAS_TRIANGLE_LIB
431 Triangulateio_exists =
false;
438 First_time_compute_holes_left_by_halo_elements =
true;
444 MeshChecker::assert_geometric_element<TElementGeometricBase, ELEMENT>(2);
453 const bool& allow_automatic_creation_of_vertices_on_boundaries =
true)
456 MeshChecker::assert_geometric_element<TElementGeometricBase, ELEMENT>(2);
460 allow_automatic_creation_of_vertices_on_boundaries;
465 First_time_compute_holes_left_by_halo_elements =
true;
473 bool should_use_attributes =
false;
475 #ifdef OOMPH_HAS_TRIANGLE_LIB
477 TriangleHelper::create_triangulateio_from_polyfiles(
482 should_use_attributes);
485 Triangulateio_exists =
true;
493 node_file_name, element_file_name, poly_file_name);
504 for (
unsigned b = 0;
b <
nb;
b++)
506 this->
template setup_boundary_coordinates<ELEMENT>(
b);
511 #ifdef OOMPH_HAS_TRIANGLE_LIB
523 MeshChecker::assert_geometric_element<TElementGeometricBase, ELEMENT>(2);
527 triangle_mesh_parameters
536 First_time_compute_holes_left_by_halo_elements =
true;
547 unsigned max_boundary_id = 0;
559 if (outer_boundary_pt.size() == 0)
561 std::stringstream error_message;
563 <<
"There are no outer boundaries defined.\n"
564 <<
"Verify that you have specified the outer boundaries in the\n"
565 <<
"Triangle_mesh_parameter object\n\n";
573 unsigned n_outer_boundaries = outer_boundary_pt.size();
577 Vector<TriangleMeshPolygon*> outer_boundary_polygon_pt(
581 for (
unsigned i = 0;
i < n_outer_boundaries; ++
i)
587 outer_boundary_polygon_pt[
i] =
588 closed_curve_to_polygon_helper(outer_boundary_pt[
i], max_boundary_id);
596 Vector<TriangleMeshClosedCurve*> internal_closed_curve_pt =
600 unsigned n_internal_closed_curves = internal_closed_curve_pt.size();
605 Vector<TriangleMeshPolygon*> internal_polygon_pt(
606 n_internal_closed_curves);
609 for (
unsigned i = 0;
i < n_internal_closed_curves; ++
i)
613 internal_polygon_pt[
i] = closed_curve_to_polygon_helper(
614 internal_closed_curve_pt[
i], max_boundary_id);
622 Vector<TriangleMeshOpenCurve*> internal_open_curve_pt =
626 unsigned n_internal_open_curves = internal_open_curve_pt.size();
629 Vector<TriangleMeshOpenCurve*> internal_open_curve_poly_pt(
630 n_internal_open_curves);
633 for (
unsigned i = 0;
i < n_internal_open_curves;
i++)
638 internal_open_curve_poly_pt[
i] = create_open_curve_with_polyline_helper(
639 internal_open_curve_pt[
i], max_boundary_id);
649 for (
unsigned i = 0;
i < n_outer_boundaries;
i++)
651 set_geom_objects_and_coordinate_limits_for_close_curve(
652 outer_boundary_pt[
i]);
658 for (
unsigned i = 0;
i < n_internal_closed_curves;
i++)
660 set_geom_objects_and_coordinate_limits_for_close_curve(
661 internal_closed_curve_pt[
i]);
667 for (
unsigned i = 0;
i < n_internal_open_curves;
i++)
669 set_geom_objects_and_coordinate_limits_for_open_curve(
670 internal_open_curve_pt[
i]);
679 const double element_area = triangle_mesh_parameters.
element_area();
682 Vector<Vector<double>> extra_holes_coordinates =
686 std::map<unsigned, Vector<double>> regions =
692 const bool refine_boundary =
695 const bool refine_internal_boundary =
698 if (!refine_internal_boundary && refine_boundary)
700 std::ostringstream error_stream;
702 <<
"You have specified that Triangle may refine the outer boundary, "
704 <<
"not internal boundaries. Triangle does not support this "
706 <<
"If you do not want Triangle to refine internal boundaries, it "
708 <<
"refine outer boundaries either!\n"
709 <<
"Please either disable all boundary refinement\n"
710 <<
"(call TriangleMeshParameters::disable_boundary_refinement()\n"
711 <<
"or enable internal boundary refinement (the default)\n";
713 throw OomphLibError(error_stream.str().c_str(),
718 this->generic_constructor(
719 outer_boundary_polygon_pt,
721 internal_open_curve_poly_pt,
723 extra_holes_coordinates,
729 refine_internal_boundary);
744 for (
unsigned b = 0;
b <
nb;
b++)
746 this->
template setup_boundary_coordinates<ELEMENT>(
b);
757 const double& element_area,
759 const bool& allow_automatic_creation_of_vertices_on_boundaries =
true)
762 MeshChecker::assert_geometric_element<TElementGeometricBase, ELEMENT>(2);
766 allow_automatic_creation_of_vertices_on_boundaries;
771 First_time_compute_holes_left_by_halo_elements =
true;
776 "This constructor hasn't been tested since last cleanup.\n";
784 TriangulateIO triangle_in;
787 std::stringstream input_string_stream;
791 input_string_stream <<
"-pA -a -a" << element_area <<
"q30";
794 if (!this->is_creation_of_vertices_on_boundaries_allowed())
796 input_string_stream <<
" -YY";
800 char triswitches[100];
801 sprintf(triswitches,
"%s", input_string_stream.str().c_str());
806 bool use_attributes =
false;
809 build_triangulateio(poly_file_name, triangle_in, use_attributes);
815 triangulate(triswitches, &triangle_in, &Triangulateio, 0);
817 #ifdef OOMPH_HAS_FPUCONTROLH
819 fpu_control_t cw = (_FPU_DEFAULT & ~_FPU_EXTENDED) | _FPU_DOUBLE;
824 this->
Tmp_mesh_pt =
new TriangleScaffoldMesh(Triangulateio);
834 bool clear_hole_data =
false;
835 TriangleHelper::clear_triangulateio(triangle_in, clear_hole_data);
839 for (
unsigned b = 0;
b <
nb;
b++)
841 this->
template setup_boundary_coordinates<ELEMENT>(
b);
856 #ifdef OOMPH_HAS_TRIANGLE_LIB
857 if (Triangulateio_exists)
859 TriangleHelper::clear_triangulateio(Triangulateio);
862 std::set<TriangleMeshCurveSection*>::iterator it_polyline;
867 delete (*it_polyline);
870 std::set<TriangleMeshPolygon*>::iterator it_polygon;
875 delete (*it_polygon);
878 std::set<TriangleMeshOpenCurve*>::iterator it_open_polyline;
883 delete (*it_open_polyline);
892 const bool& preserve_existing_data)
901 void compute_boundary_segments_connectivity_and_initial_zeta_values(
908 void re_assign_initial_zeta_values_for_internal_boundary(
910 Vector<std::list<FiniteElement*>>& old_segment_sorted_ele_pt,
911 std::map<FiniteElement*, bool>& old_is_inverted);
915 void re_scale_re_assigned_initial_zeta_values_for_internal_boundary(
923 void identify_boundary_segments_and_assign_initial_zeta_values(
926 const bool& is_internal_boundary,
927 std::map<FiniteElement*, FiniteElement*>& face_to_bulk_element_pt);
932 void identify_boundary_segments_and_assign_initial_zeta_values(
939 void synchronize_boundary_coordinates(
const unsigned&
b);
944 void select_boundary_face_elements(
947 bool& is_internal_boundary,
948 std::map<FiniteElement*, FiniteElement*>& face_to_bulk_element_pt);
954 return Boundary_segment_node_pt[
b];
959 Vector<Node*>& boundary_segment_node_pt(
const unsigned&
b,
962 return Boundary_segment_node_pt[
b][
s];
966 Node*& boundary_segment_node_pt(
const unsigned&
b,
970 return Boundary_segment_node_pt[
b][
s][
n];
975 #ifdef OOMPH_HAS_TRIANGLE_LIB
979 void update_triangulateio(
Vector<Vector<double>>& internal_point)
983 unsigned nhole = Triangulateio.numberofholes;
984 unsigned count_coord = 0;
985 for (
unsigned ihole = 0; ihole < nhole; ihole++)
987 Triangulateio.holelist[count_coord] += internal_point[ihole][0];
988 Triangulateio.holelist[count_coord + 1] += internal_point[ihole][1];
995 update_triangulateio();
999 void update_triangulateio()
1002 unsigned nnode = Triangulateio.numberofpoints;
1007 for (
unsigned inod = 0; inod <
nnode; inod++)
1014 Node* mesh_node_pt = this->
node_pt(inod);
1015 new_x = mesh_node_pt->x(0);
1016 new_y = mesh_node_pt->x(1);
1017 Triangulateio.pointlist[count * 2] = new_x;
1018 Triangulateio.pointlist[(count * 2) + 1] = new_y;
1022 #ifdef OOMPH_HAS_MPI
1024 void dump_distributed_info_for_restart(std::ostream& dump_file);
1026 const unsigned read_unsigned_line_helper(std::istream&
read_file)
1037 return std::atoi(input_string.c_str());
1041 void read_distributed_info_for_restart(std::istream& restart_file);
1045 virtual void reestablish_distribution_info_for_restart(
1046 OomphCommunicator* comm_pt, std::istream& restart_file)
1048 std::ostringstream error_stream;
1049 error_stream <<
"Empty default reestablish disributed info method "
1051 error_stream <<
"This should be overloaded in a specific "
1052 <<
"RefineableTriangleMesh\n";
1053 throw OomphLibError(
1060 void remesh_from_internal_triangulateio()
1066 unsigned n_node = this->
nnode();
1067 for (
unsigned n = n_node;
n > 0; --
n)
1073 unsigned n_element = this->
nelement();
1074 for (
unsigned e = n_element;
e > 0; --
e)
1093 #ifdef OOMPH_HAS_MPI
1097 this->Halo_node_pt.clear();
1098 this->Root_halo_element_pt.clear();
1100 this->Haloed_node_pt.clear();
1101 this->Root_haloed_element_pt.clear();
1103 this->External_halo_node_pt.clear();
1104 this->External_halo_element_pt.clear();
1106 this->External_haloed_node_pt.clear();
1107 this->External_haloed_element_pt.clear();
1115 this->
Tmp_mesh_pt =
new TriangleScaffoldMesh(this->Triangulateio);
1118 Triangulateio_exists =
true;
1127 #ifdef OOMPH_HAS_MPI
1134 nbound = this->initial_shared_boundary_id();
1147 for (
unsigned b = 0;
b < nbound;
b++)
1149 this->
template setup_boundary_coordinates<ELEMENT>(
b);
1164 bool triangulateio_exists()
1166 return Triangulateio_exists;
1192 const bool& use_attributes);
1194 #ifdef OOMPH_HAS_TRIANGLE_LIB
1198 void build_triangulateio(
const std::string& poly_file_name,
1199 TriangulateIO& triangulate_io,
1200 bool& use_attributes);
1205 void generic_constructor(
1209 const double& element_area,
1212 std::map<unsigned, double>& regions_areas,
1214 const bool& use_attributes,
1215 const bool& refine_boundary,
1216 const bool& refine_internal_boundary)
1219 MeshChecker::assert_geometric_element<TElementGeometricBase, ELEMENT>(2);
1222 if (element_area < 10
e-14)
1224 std::ostringstream warning_message;
1226 <<
"The current elements area was stated to (" << element_area
1227 <<
").\nThe current precision to generate the input to triangle "
1228 <<
"is fixed to 14 digits\n\n";
1257 TriangulateIO triangulate_io;
1260 TriangleHelper::initialise_triangulateio(triangulate_io);
1264 UnstructuredTwoDMeshGeometryBase::build_triangulateio(
1266 internal_polygon_pt,
1268 extra_holes_coordinates,
1269 regions_coordinates,
1274 TriangleHelper::initialise_triangulateio(Triangulateio);
1277 Triangulateio_exists =
true;
1280 std::stringstream input_string_stream;
1281 input_string_stream.precision(14);
1282 input_string_stream.setf(std::ios_base::fixed, std::ios_base::floatfield);
1288 input_string_stream <<
"-pA -a -a" << element_area <<
" -q30"
1294 input_string_stream <<
" -YY";
1298 if (refine_boundary ==
false)
1300 input_string_stream <<
"-Y";
1302 if (refine_internal_boundary ==
false)
1304 input_string_stream <<
"Y";
1309 char triswitches[100];
1310 sprintf(triswitches,
"%s", input_string_stream.str().c_str());
1313 triangulate(triswitches, &triangulate_io, &Triangulateio, 0);
1315 #ifdef OOMPH_HAS_FPUCONTROLH
1317 fpu_control_t cw = (_FPU_DEFAULT & ~_FPU_EXTENDED) | _FPU_DOUBLE;
1322 this->
Tmp_mesh_pt =
new TriangleScaffoldMesh(Triangulateio);
1325 if (!regions_coordinates.empty())
1344 bool clear_hole_data =
false;
1345 TriangleHelper::clear_triangulateio(triangulate_io, clear_hole_data);
1349 bool Triangulateio_exists;
1360 #ifdef OOMPH_HAS_MPI
1364 const unsigned initial_shared_boundary_id()
1366 return Initial_shared_boundary_id;
1370 const unsigned final_shared_boundary_id()
1372 return Final_shared_boundary_id;
1378 void shared_boundaries_in_this_processor(
1379 Vector<unsigned>& shared_boundaries_in_this_processor)
1383 std::set<unsigned> shared_boundaries_in_this_processor_set;
1391 for (
unsigned iproc = 0; iproc < n_proc; iproc++)
1394 if (iproc != my_rank)
1398 const unsigned nshared_boundaries_with_iproc =
1399 this->nshared_boundaries(my_rank, iproc);
1403 if (nshared_boundaries_with_iproc > 0)
1406 Vector<unsigned> bound_ids_shared_with_iproc;
1407 bound_ids_shared_with_iproc =
1408 this->shared_boundaries_ids(my_rank, iproc);
1411 for (
unsigned bs = 0; bs < nshared_boundaries_with_iproc; bs++)
1413 const unsigned bnd_id = bound_ids_shared_with_iproc[bs];
1417 std::set<unsigned>::iterator it =
1418 shared_boundaries_in_this_processor_set.find(bnd_id);
1419 if (it != shared_boundaries_in_this_processor_set.end())
1421 std::stringstream
error;
1422 error <<
"The current shared boundary (" << bnd_id <<
") was\n"
1423 <<
"already added by other pair of processors\n."
1424 <<
"This means that there are repeated shared boundaries "
1426 throw OomphLibError(
error.str(),
1430 shared_boundaries_in_this_processor_set.insert(bnd_id);
1432 shared_boundaries_in_this_processor.push_back(bnd_id);
1443 const unsigned nshared_boundaries(
const unsigned&
p,
1444 const unsigned&
q)
const
1446 return Shared_boundaries_ids[
p][
q].size();
1449 Vector<Vector<Vector<unsigned>>> shared_boundaries_ids()
const
1451 return Shared_boundaries_ids;
1454 Vector<Vector<Vector<unsigned>>>& shared_boundaries_ids()
1456 return Shared_boundaries_ids;
1459 Vector<Vector<unsigned>> shared_boundaries_ids(
const unsigned&
p)
const
1461 return Shared_boundaries_ids[
p];
1464 Vector<Vector<unsigned>>& shared_boundaries_ids(
const unsigned&
p)
1466 return Shared_boundaries_ids[
p];
1469 Vector<unsigned> shared_boundaries_ids(
const unsigned&
p,
1470 const unsigned&
q)
const
1472 return Shared_boundaries_ids[
p][
q];
1475 Vector<unsigned>& shared_boundaries_ids(
const unsigned&
p,
1478 return Shared_boundaries_ids[
p][
q];
1481 const unsigned shared_boundaries_ids(
const unsigned&
p,
1483 const unsigned&
i)
const
1485 return Shared_boundaries_ids[
p][
q][
i];
1488 const unsigned nshared_boundary_curves(
const unsigned&
p)
const
1490 return Shared_boundary_polyline_pt[
p].size();
1493 const unsigned nshared_boundary_polyline(
const unsigned&
p,
1494 const unsigned&
c)
const
1496 return Shared_boundary_polyline_pt[
p][
c].size();
1499 Vector<TriangleMeshPolyLine*>& shared_boundary_polyline_pt(
1500 const unsigned&
p,
const unsigned&
c)
1502 return Shared_boundary_polyline_pt[
p][
c];
1505 TriangleMeshPolyLine* shared_boundary_polyline_pt(
const unsigned&
p,
1507 const unsigned&
i)
const
1509 return Shared_boundary_polyline_pt[
p][
c][
i];
1512 const unsigned nshared_boundaries()
const
1514 return Shared_boundary_element_pt.size();
1517 const unsigned nshared_boundary_element(
const unsigned&
b)
1520 std::map<unsigned, Vector<FiniteElement*>>::iterator it =
1521 Shared_boundary_element_pt.find(
b);
1522 if (it != Shared_boundary_element_pt.end())
1524 return Shared_boundary_element_pt[
b].size();
1528 std::ostringstream error_stream;
1529 error_stream <<
"The shared boundary (" <<
b
1530 <<
") does not exist!!!\n\n";
1531 throw OomphLibError(
1536 void flush_shared_boundary_element()
1538 Shared_boundary_element_pt.clear();
1541 void flush_shared_boundary_element(
const unsigned&
b)
1544 std::map<unsigned, Vector<FiniteElement*>>::iterator it =
1545 Shared_boundary_element_pt.find(
b);
1546 if (it != Shared_boundary_element_pt.end())
1548 Shared_boundary_element_pt[
b].clear();
1552 std::ostringstream error_stream;
1553 error_stream <<
"The shared boundary (" <<
b
1554 <<
") does not exist!!!\n\n";
1555 throw OomphLibError(
1560 void add_shared_boundary_element(
const unsigned&
b, FiniteElement* ele_pt)
1562 Shared_boundary_element_pt[
b].push_back(ele_pt);
1565 FiniteElement* shared_boundary_element_pt(
const unsigned&
b,
1569 std::map<unsigned, Vector<FiniteElement*>>::iterator it =
1570 Shared_boundary_element_pt.find(
b);
1571 if (it != Shared_boundary_element_pt.end())
1573 return Shared_boundary_element_pt[
b][
e];
1577 std::ostringstream error_stream;
1578 error_stream <<
"The shared boundary (" <<
b
1579 <<
") does not exist!!!\n\n";
1580 throw OomphLibError(
1585 void flush_face_index_at_shared_boundary()
1587 Face_index_at_shared_boundary.clear();
1590 void add_face_index_at_shared_boundary(
const unsigned&
b,
const unsigned&
i)
1592 Face_index_at_shared_boundary[
b].push_back(
i);
1595 int face_index_at_shared_boundary(
const unsigned&
b,
const unsigned&
e)
1598 std::map<unsigned, Vector<int>>::iterator it =
1599 Face_index_at_shared_boundary.find(
b);
1600 if (it != Face_index_at_shared_boundary.end())
1602 return Face_index_at_shared_boundary[
b][
e];
1606 std::ostringstream error_stream;
1607 error_stream <<
"The shared boundary (" <<
b
1608 <<
") does not exist!!!\n\n";
1609 throw OomphLibError(
1614 const unsigned nshared_boundary_node(
const unsigned&
b)
1617 std::map<unsigned, Vector<Node*>>::iterator it =
1618 Shared_boundary_node_pt.find(
b);
1619 if (it != Shared_boundary_node_pt.end())
1621 return Shared_boundary_node_pt[
b].size();
1625 std::ostringstream error_stream;
1626 error_stream <<
"The shared boundary (" <<
b
1627 <<
") does not exist!!!\n\n";
1628 throw OomphLibError(
1634 void flush_shared_boundary_node()
1636 Shared_boundary_node_pt.clear();
1640 void flush_shared_boundary_node(
const unsigned&
b)
1642 Shared_boundary_node_pt[
b].clear();
1646 void add_shared_boundary_node(
const unsigned&
b, Node*
node_pt)
1649 const unsigned nbound_node = Shared_boundary_node_pt[
b].size();
1650 bool node_already_on_this_boundary =
false;
1652 for (
unsigned n = 0;
n < nbound_node;
n++)
1655 if (
node_pt == Shared_boundary_node_pt[
b][
n])
1657 node_already_on_this_boundary =
true;
1662 if (!node_already_on_this_boundary)
1664 Shared_boundary_node_pt[
b].push_back(
node_pt);
1668 Node* shared_boundary_node_pt(
const unsigned&
b,
const unsigned&
n)
1671 std::map<unsigned, Vector<Node*>>::iterator it =
1672 Shared_boundary_node_pt.find(
b);
1673 if (it != Shared_boundary_node_pt.end())
1675 return Shared_boundary_node_pt[
b][
n];
1679 std::ostringstream error_stream;
1680 error_stream <<
"The shared boundary (" <<
b
1681 <<
") does not exist!!!\n\n";
1682 throw OomphLibError(
1688 bool is_node_on_shared_boundary(
const unsigned&
b, Node*
const&
node_pt)
1691 std::map<unsigned, Vector<Node*>>::iterator it =
1692 Shared_boundary_node_pt.find(
b);
1693 if (it != Shared_boundary_node_pt.end())
1696 Vector<Node*>::iterator it_shd_nodes =
1697 std::find(Shared_boundary_node_pt[
b].begin(),
1698 Shared_boundary_node_pt[
b].
end(),
1701 if (it_shd_nodes != Shared_boundary_node_pt[
b].
end())
1712 std::ostringstream error_stream;
1713 error_stream <<
"The shared boundary (" <<
b
1714 <<
") does not exist!!!\n\n";
1715 throw OomphLibError(
1721 std::map<unsigned, Vector<unsigned>>& shared_boundary_from_processors()
1723 return Shared_boundary_from_processors;
1726 Vector<unsigned>& shared_boundary_from_processors(
const unsigned&
b)
1728 std::map<unsigned, Vector<unsigned>>::iterator it =
1729 Shared_boundary_from_processors.find(
b);
1731 if (it == Shared_boundary_from_processors.end())
1733 std::ostringstream error_message;
1735 <<
"The boundary (" <<
b
1736 <<
") seems not to be shared by any processors,\n"
1737 <<
"it is possible that the boundary was created by the user an not\n"
1738 <<
"automatically by the common interfaces between "
1739 "processors-domains\n";
1740 throw OomphLibError(error_message.str(),
1745 return (*it).second;
1750 const unsigned nshared_boundary_overlaps_internal_boundary()
1752 return Shared_boundary_overlaps_internal_boundary.size();
1756 const bool shared_boundary_overlaps_internal_boundary(
1757 const unsigned& shd_bnd_id)
1759 std::map<unsigned, unsigned>::iterator it =
1760 Shared_boundary_overlaps_internal_boundary.find(shd_bnd_id);
1761 if (it != Shared_boundary_overlaps_internal_boundary.end())
1770 const unsigned shared_boundary_overlapping_internal_boundary(
1771 const unsigned& shd_bnd_id)
1773 std::map<unsigned, unsigned>::iterator it =
1774 Shared_boundary_overlaps_internal_boundary.find(shd_bnd_id);
1776 if (it == Shared_boundary_overlaps_internal_boundary.end())
1778 std::ostringstream error_message;
1779 error_message <<
"The shared boundary (" << shd_bnd_id
1780 <<
") does not lie on an internal "
1782 <<
"Make sure to call this method just for shared "
1783 "boundaries that lie "
1784 <<
"on an internal boundary.\n\n";
1785 throw OomphLibError(error_message.str(),
1790 return (*it).second;
1795 void get_shared_boundaries_overlapping_internal_boundary(
1796 const unsigned& internal_bnd_id, Vector<unsigned>& shd_bnd_ids)
1799 shd_bnd_ids.clear();
1802 std::map<unsigned, unsigned>::iterator it =
1803 Shared_boundary_overlaps_internal_boundary.begin();
1804 for (; it != Shared_boundary_overlaps_internal_boundary.end(); it++)
1808 if ((*it).second == internal_bnd_id)
1811 shd_bnd_ids.push_back((*it).first);
1816 if (shd_bnd_ids.size() == 0)
1818 std::ostringstream error_message;
1820 <<
" The internal boundary (" << internal_bnd_id <<
") has no shared "
1821 <<
"boundaries overlapping it\n"
1822 <<
"Make sure to call this method just for internal boundaries that "
1823 <<
"are marked to as being\noverlaped by shared boundaries\n";
1824 throw OomphLibError(error_message.str(),
1833 std::map<unsigned, unsigned>& shared_boundary_overlaps_internal_boundary()
1835 return Shared_boundary_overlaps_internal_boundary;
1840 const bool boundary_was_splitted(
const unsigned&
b)
1842 std::map<unsigned, bool>::iterator it;
1843 it = Boundary_was_splitted.find(
b);
1844 if (it == Boundary_was_splitted.end())
1850 return (*it).second;
1856 const unsigned nboundary_subpolylines(
const unsigned&
b)
1858 std::map<unsigned, Vector<TriangleMeshPolyLine*>>::iterator it;
1859 it = Boundary_subpolylines.find(
b);
1861 if (it == Boundary_subpolylines.end())
1863 std::ostringstream error_message;
1865 <<
"The boundary (" <<
b
1866 <<
") was marked as been splitted but there\n"
1867 <<
"are not registered polylines to represent the boundary.\n"
1868 <<
"The new polylines were not set up when the boundary was found "
1870 <<
"be splitted or the polylines have been explicitly deleted "
1873 throw OomphLibError(error_message.str(),
1878 return (*it).second.size();
1884 Vector<TriangleMeshPolyLine*>& boundary_subpolylines(
const unsigned&
b)
1886 std::map<unsigned, Vector<TriangleMeshPolyLine*>>::iterator it;
1887 it = Boundary_subpolylines.find(
b);
1888 if (it == Boundary_subpolylines.end())
1890 std::ostringstream error_message;
1892 <<
"The boundary (" <<
b
1893 <<
") was marked as been splitted but there\n"
1894 <<
"are not registered polylines to represent the boundary.\n"
1895 <<
"The new polylines were not set up when the boundary was found "
1897 <<
"be splitted or the polylines have been explicitly deleted "
1900 throw OomphLibError(error_message.str(),
1904 return (*it).second;
1910 const bool boundary_marked_as_shared_boundary(
const unsigned&
b,
1911 const unsigned& isub)
1913 std::map<unsigned, std::vector<bool>>::iterator it;
1914 it = Boundary_marked_as_shared_boundary.find(
b);
1915 if (it == Boundary_marked_as_shared_boundary.end())
1922 return (*it).second[isub];
1926 unsigned Initial_shared_boundary_id;
1929 unsigned Final_shared_boundary_id;
1935 Vector<Vector<Vector<unsigned>>> Shared_boundaries_ids;
1940 std::map<unsigned, Vector<unsigned>> Shared_boundary_from_processors;
1945 std::map<unsigned, unsigned> Shared_boundary_overlaps_internal_boundary;
1949 Vector<Vector<Vector<TriangleMeshPolyLine*>>> Shared_boundary_polyline_pt;
1951 void flush_shared_boundary_polyline_pt()
1953 Shared_boundary_polyline_pt.clear();
1959 std::map<unsigned, Vector<FiniteElement*>> Shared_boundary_element_pt;
1963 std::map<unsigned, Vector<int>> Face_index_at_shared_boundary;
1967 std::map<unsigned, Vector<Node*>> Shared_boundary_node_pt;
1972 std::map<unsigned, bool> Boundary_was_splitted;
1977 std::map<unsigned, Vector<TriangleMeshPolyLine*>> Boundary_subpolylines;
1983 std::map<unsigned, std::vector<bool>> Boundary_marked_as_shared_boundary;
1989 void create_distributed_domain_representation(
1990 Vector<TriangleMeshPolygon*>& polygons_pt,
1991 Vector<TriangleMeshOpenCurve*>& open_curves_pt);
1995 void sort_polylines_helper(
1996 Vector<TriangleMeshPolyLine*>& unsorted_polylines_pt,
1997 Vector<Vector<TriangleMeshPolyLine*>>& sorted_polylines_pt);
2001 void create_tmp_polygons_helper(
2002 Vector<Vector<TriangleMeshPolyLine*>>& polylines_pt,
2003 Vector<TriangleMeshPolygon*>& polygons_pt);
2008 void create_tmp_open_curves_helper(
2009 Vector<Vector<TriangleMeshPolyLine*>>& sorted_open_curves_pt,
2010 Vector<TriangleMeshPolyLine*>& unsorted_shared_to_internal_poly_pt,
2011 Vector<TriangleMeshOpenCurve*>& open_curves_pt);
2015 bool First_time_compute_holes_left_by_halo_elements;
2018 Vector<Vector<double>> Original_extra_holes_coordinates;
2022 void compute_holes_left_by_halo_elements_helper(
2023 Vector<Vector<double>>& output_holes_coordinates);
2030 void update_holes_information_helper(
2031 Vector<TriangleMeshPolygon*>& polygons_pt,
2032 Vector<Vector<double>>& output_holes_coordinates);
2039 const int check_connections_of_polyline_nodes(
2040 std::set<FiniteElement*>& element_in_processor_pt,
2041 const int& root_edge_bnd_id,
2042 std::map<std::pair<Node*, Node*>,
bool>& overlapped_face,
2043 std::map<
unsigned, std::map<Node*, bool>>&
2044 node_on_bnd_not_overlapped_by_shd_bnd,
2045 std::list<Node*>& current_polyline_nodes,
2046 std::map<
unsigned, std::list<Node*>>&
2047 shared_bnd_id_to_sorted_list_node_pt,
2048 const unsigned& node_degree,
2050 const bool called_from_load_balance =
false);
2055 void create_shared_polylines_connections();
2058 void create_shared_boundaries(
2059 OomphCommunicator* comm_pt,
2060 const Vector<unsigned>& element_domain,
2061 const Vector<GeneralisedElement*>& backed_up_el_pt,
2062 const Vector<FiniteElement*>& backed_up_f_el_pt,
2063 std::map<Data*, std::set<unsigned>>& processors_associated_with_data,
2064 const bool& overrule_keep_as_halo_element_status);
2069 void get_halo_elements_on_all_procs(
2070 const unsigned& nproc,
2071 const Vector<unsigned>& element_domain,
2072 const Vector<GeneralisedElement*>& backed_up_el_pt,
2073 std::map<Data*, std::set<unsigned>>& processors_associated_with_data,
2074 const bool& overrule_keep_as_halo_element_status,
2075 std::map<GeneralisedElement*, unsigned>& element_to_global_index,
2076 Vector<
Vector<Vector<GeneralisedElement*>>>& output_halo_elements_pt);
2081 void get_element_edges_on_boundary(
2082 std::map<std::pair<Node*, Node*>,
unsigned>& element_edges_on_boundary);
2089 void create_polylines_from_halo_elements_helper(
2090 const Vector<unsigned>& element_domain,
2091 std::map<GeneralisedElement*, unsigned>& element_to_global_index,
2092 std::set<FiniteElement*>& element_in_processor_pt,
2093 Vector<
Vector<Vector<GeneralisedElement*>>>& input_halo_elements,
2094 std::map<std::pair<Node*, Node*>,
unsigned>& elements_edges_on_boundary,
2095 Vector<
Vector<Vector<TriangleMeshPolyLine*>>>& output_polylines_pt);
2099 void break_loops_on_shared_polyline_helper(
2100 const unsigned& initial_shd_bnd_id,
2101 std::list<Node*>& input_nodes,
2102 Vector<FiniteElement*>& input_boundary_element_pt,
2103 Vector<int>& input_face_index_element,
2104 const int& input_connect_to_the_left,
2105 const int& input_connect_to_the_right,
2106 Vector<std::list<Node*>>& output_sorted_nodes_pt,
2107 Vector<Vector<FiniteElement*>>& output_boundary_element_pt,
2108 Vector<Vector<int>>& output_face_index_element,
2109 Vector<int>& output_connect_to_the_left,
2110 Vector<int>& output_connect_to_the_right);
2115 void break_loops_on_shared_polyline_load_balance_helper(
2116 const unsigned& initial_shd_bnd_id,
2117 std::list<Node*>& input_nodes,
2118 Vector<FiniteElement*>& input_boundary_element_pt,
2119 Vector<FiniteElement*>& input_boundary_face_element_pt,
2120 Vector<int>& input_face_index_element,
2121 const int& input_connect_to_the_left,
2122 const int& input_connect_to_the_right,
2123 Vector<std::list<Node*>>& output_sorted_nodes_pt,
2124 Vector<Vector<FiniteElement*>>& output_boundary_element_pt,
2125 Vector<Vector<FiniteElement*>>& output_boundary_face_element_pt,
2126 Vector<Vector<int>>& output_face_index_element,
2127 Vector<int>& output_connect_to_the_left,
2128 Vector<int>& output_connect_to_the_right);
2133 void create_shared_polyline(
2134 const unsigned& my_rank,
2135 const unsigned& shd_bnd_id,
2136 const unsigned& iproc,
2137 const unsigned& jproc,
2138 std::list<Node*>& sorted_nodes,
2139 const int& root_edge_bnd_id,
2140 Vector<FiniteElement*>& bulk_bnd_ele_pt,
2141 Vector<int>& face_index_ele,
2142 Vector<Vector<TriangleMeshPolyLine*>>& unsorted_polylines_pt,
2143 const int& connect_to_the_left_flag,
2144 const int& connect_to_the_right_flag);
2149 const Vector<unsigned>& target_domain_for_local_non_halo_element)
2151 std::ostringstream error_stream;
2152 error_stream <<
"Empty default load balancing function called.\n";
2153 error_stream <<
"This should be overloaded in a specific "
2154 <<
"RefineableTriangleMesh\n";
2155 throw OomphLibError(
2162 Vector<unsigned>& ntmp_boundary_elements,
2163 Vector<Vector<unsigned>>& ntmp_boundary_elements_in_region,
2164 Vector<FiniteElement*>& deleted_elements);
2191 return x <
p.x || (
x ==
p.x &&
y <
p.y);
2201 return (
A.x -
O.x) * (
B.y -
O.y) - (
A.y -
O.y) * (
B.x -
O.x);
2209 int n =
P.size(),
k = 0;
2210 std::vector<Point>
H(2 *
n);
2213 std::sort(
P.begin(),
P.end());
2216 for (
int i = 0;
i <
n; ++
i)
2223 for (
int i =
n - 2,
t =
k + 1;
i >= 0;
i--)
2246 template<
class ELEMENT>
2255 typedef void (*MeshUpdateFctPt)(
Mesh* mesh_pt);
2263 typedef void (*InternalHolePointUpdateFctPt)(
const unsigned& ihole,
2266 #ifdef OOMPH_HAS_TRIANGLE_LIB
2273 :
TriangleMesh<ELEMENT>(triangle_mesh_parameters, time_stepper_pt)
2276 initialise_adaptation_data();
2279 initialise_boundary_refinement_data();
2290 const bool& allow_automatic_creation_of_vertices_on_boundaries =
true)
2296 allow_automatic_creation_of_vertices_on_boundaries)
2300 create_polylines_from_polyfiles(node_file_name, poly_file_name);
2303 initialise_adaptation_data();
2306 initialise_boundary_refinement_data();
2310 #ifdef OOMPH_HAS_TRIANGLE_LIB
2318 TriangulateIO& triangulate_io,
2320 const bool& use_attributes =
false,
2321 const bool& allow_automatic_creation_of_vertices_on_boundaries =
true,
2325 initialise_adaptation_data();
2328 initialise_boundary_refinement_data();
2331 this->Time_stepper_pt = time_stepper_pt;
2334 TriangulateIO triangle_refine;
2337 TriangleHelper::initialise_triangulateio(this->Triangulateio);
2340 this->Triangulateio_exists =
true;
2343 this->refine_triangulateio(triangulate_io, target_area, triangle_refine);
2346 std::stringstream input_string_stream;
2347 input_string_stream <<
"-pq30-ra";
2350 if (!allow_automatic_creation_of_vertices_on_boundaries)
2352 input_string_stream <<
" -YY";
2356 this->Allow_automatic_creation_of_vertices_on_boundaries =
2357 allow_automatic_creation_of_vertices_on_boundaries;
2360 this->Use_attributes = use_attributes;
2363 char triswitches[100];
2364 sprintf(triswitches,
"%s", input_string_stream.str().c_str());
2367 triangulate(triswitches, &triangle_refine, &this->Triangulateio, 0);
2369 #ifdef OOMPH_HAS_FPUCONTROLH
2371 fpu_control_t cw = (_FPU_DEFAULT & ~_FPU_EXTENDED) | _FPU_DOUBLE;
2376 this->Tmp_mesh_pt =
new TriangleScaffoldMesh(this->Triangulateio);
2379 this->build_from_scaffold(time_stepper_pt, use_attributes);
2382 delete this->Tmp_mesh_pt;
2383 this->Tmp_mesh_pt = 0;
2386 bool clear_hole_data =
false;
2387 TriangleHelper::clear_triangulateio(triangle_refine, clear_hole_data);
2389 #ifdef OOMPH_HAS_MPI
2395 this->set_communicator_pt(comm_pt);
2400 unsigned nb = nboundary();
2401 for (
unsigned b = 0;
b <
nb;
b++)
2403 this->
template setup_boundary_coordinates<ELEMENT>(
b);
2417 Print_timings_transfering_target_areas =
true;
2424 Print_timings_transfering_target_areas =
false;
2430 Disable_projection =
false;
2436 Disable_projection =
true;
2442 Print_timings_projection =
true;
2448 Print_timings_projection =
false;
2456 return Nbin_x_for_area_transfer;
2464 return Nbin_y_for_area_transfer;
2473 return Max_sample_points_for_limited_locate_zeta_during_target_area_transfer;
2491 return Min_permitted_angle;
2498 return Use_iterative_solver_for_projection;
2505 Use_iterative_solver_for_projection =
true;
2512 Use_iterative_solver_for_projection =
false;
2518 set_print_level_timings_adaptation(print_level);
2524 Print_timings_level_adaptation = 0;
2530 const unsigned max_print_level = 3;
2532 if (print_level > max_print_level)
2534 Print_timings_level_adaptation = max_print_level;
2538 Print_timings_level_adaptation = print_level;
2545 set_print_level_timings_load_balance(print_level);
2551 Print_timings_level_load_balance = 0;
2557 const unsigned max_print_level = 3;
2559 if (print_level > max_print_level)
2561 Print_timings_level_load_balance = max_print_level;
2565 Print_timings_level_load_balance = print_level;
2572 outfile << std::endl;
2573 outfile <<
"Targets for mesh adaptation: " << std::endl;
2574 outfile <<
"---------------------------- " << std::endl;
2577 outfile <<
"Target min angle: " << Min_permitted_angle << std::endl;
2580 outfile <<
"Don't unrefine if less than " << Max_keep_unrefined
2581 <<
" elements need unrefinement." << std::endl;
2582 outfile << std::endl;
2589 unsigned nelem = nelement();
2596 double orig_max_area, orig_min_area;
2597 this->max_and_min_element_size(orig_max_area, orig_min_area);
2614 throw OomphLibError(
"unrefine_uniformly() not implemented yet",
2630 return Mesh_update_fct_pt;
2638 return Internal_hole_point_update_fct_pt;
2642 #ifdef OOMPH_HAS_MPI
2643 unsigned nsorted_shared_boundary_node(
unsigned&
b)
2645 std::map<unsigned, Vector<Node*>>::iterator it =
2646 Sorted_shared_boundary_node_pt.find(
b);
2647 if (it == Sorted_shared_boundary_node_pt.end())
2649 std::ostringstream error_message;
2650 error_message <<
"The boundary (" <<
b <<
") is not marked as shared\n";
2655 return (*it).second.size();
2658 void flush_sorted_shared_boundary_node()
2660 Sorted_shared_boundary_node_pt.clear();
2663 Node* sorted_shared_boundary_node_pt(
unsigned&
b,
unsigned&
i)
2665 std::map<unsigned, Vector<Node*>>::iterator it =
2666 Sorted_shared_boundary_node_pt.find(
b);
2667 if (it == Sorted_shared_boundary_node_pt.end())
2669 std::ostringstream error_message;
2670 error_message <<
"The boundary (" <<
b <<
") is not marked as shared\n";
2671 throw OomphLibError(error_message.str(),
2675 return (*it).second[
i];
2679 Vector<Node*> sorted_shared_boundary_node_pt(
unsigned&
b)
2681 std::map<unsigned, Vector<Node*>>::iterator it =
2682 Sorted_shared_boundary_node_pt.find(
b);
2683 if (it == Sorted_shared_boundary_node_pt.end())
2685 std::ostringstream error_message;
2686 error_message <<
"The boundary (" <<
b <<
") is not marked as shared\n";
2687 throw OomphLibError(error_message.str(),
2691 return (*it).second;
2701 #ifdef OOMPH_HAS_MPI
2704 void fill_boundary_elements_and_nodes_for_internal_boundaries();
2710 void fill_boundary_elements_and_nodes_for_internal_boundaries(
2711 std::ofstream& outfile);
2716 std::istream& restart_file)
2719 if (this->is_mesh_distributed())
2723 this->fill_boundary_elements_and_nodes_for_internal_boundaries();
2727 this->reset_shared_boundary_elements_and_nodes(comm_pt);
2731 this->sort_nodes_on_shared_boundaries();
2734 this->reset_halo_haloed_scheme();
2737 const unsigned noriginal_boundaries =
2738 this->initial_shared_boundary_id();
2739 this->set_nboundary(noriginal_boundaries);
2743 for (
unsigned b = 0;
b < noriginal_boundaries;
b++)
2748 this->identify_boundary_segments_and_assign_initial_zeta_values(
b,
2751 if (this->boundary_geom_object_pt(
b) != 0)
2754 this->
template setup_boundary_coordinates<ELEMENT>(
b);
2759 this->snap_nodes_onto_geometric_objects();
2769 #ifdef OOMPH_HAS_MPI
2772 unsigned my_rank = 0;
2773 if (this->is_mesh_distributed())
2775 my_rank = this->communicator_pt()->my_rank();
2782 const unsigned ninternal = this->Internal_polygon_pt.size();
2783 for (
unsigned i_internal = 0; i_internal < ninternal; i_internal++)
2785 this->update_polygon_after_restart(
2786 this->Internal_polygon_pt[i_internal]);
2790 const unsigned nouter = this->Outer_boundary_pt.size();
2791 for (
unsigned i_outer = 0; i_outer < nouter; i_outer++)
2793 this->update_polygon_after_restart(this->Outer_boundary_pt[i_outer]);
2796 #ifdef OOMPH_HAS_MPI
2799 if (this->is_mesh_distributed())
2801 const unsigned ncurves = this->nshared_boundary_curves(my_rank);
2802 for (
unsigned nc = 0; nc < ncurves; nc++)
2805 this->update_shared_curve_after_restart(
2806 this->Shared_boundary_polyline_pt[my_rank][nc]
2813 const unsigned n_open_polyline = this->Internal_open_curve_pt.size();
2814 for (
unsigned i = 0;
i < n_open_polyline;
i++)
2816 this->update_open_curve_after_restart(this->Internal_open_curve_pt[
i]);
2820 #ifdef OOMPH_HAS_MPI
2830 void get_shared_boundary_elements_and_face_indexes(
2841 void create_new_shared_boundaries(
2842 std::set<FiniteElement*>& element_in_processor_pt,
2849 void compute_shared_node_degree_helper(
2851 std::map<Node*, unsigned>& global_node_degree);
2857 void create_adjacency_matrix_new_shared_edges_helper(
2865 void get_shared_boundary_segment_nodes_helper(
2881 Do_boundary_unrefinement_constrained_by_target_areas =
true;
2886 Do_boundary_unrefinement_constrained_by_target_areas =
false;
2891 Do_boundary_refinement_constrained_by_target_areas =
true;
2896 Do_boundary_refinement_constrained_by_target_areas =
false;
2903 Do_shared_boundary_unrefinement_constrained_by_target_areas =
true;
2908 Do_shared_boundary_unrefinement_constrained_by_target_areas =
false;
2913 Do_shared_boundary_refinement_constrained_by_target_areas =
true;
2918 Do_shared_boundary_refinement_constrained_by_target_areas =
false;
2937 std::map<unsigned, std::set<Vector<double>>>::iterator it =
2938 Boundary_connections_pt.find(
b);
2940 if (it != Boundary_connections_pt.end())
2943 vertices = (*it).second;
2968 const unsigned& dst_bnd_id,
2969 const unsigned& dst_bnd_chunk);
3012 const unsigned& dst_b_id,
3013 unsigned& vertex_number);
3024 double& unrefinement_tolerance,
3025 const bool& check_only =
false);
3035 double& refinement_tolerance,
3036 const bool& check_only =
false);
3045 double& max_length_constraint);
3056 double& unrefinement_tolerance,
3067 double& refinement_tolerance,
3107 Do_boundary_unrefinement_constrained_by_target_areas =
true;
3108 Do_boundary_refinement_constrained_by_target_areas =
true;
3109 Do_shared_boundary_unrefinement_constrained_by_target_areas =
true;
3110 Do_shared_boundary_refinement_constrained_by_target_areas =
true;
3113 #ifdef OOMPH_HAS_MPI
3118 std::map<unsigned, Vector<Node*>> Sorted_shared_boundary_node_pt;
3123 void sort_nodes_on_shared_boundaries();
3128 void reset_shared_boundary_elements_and_nodes(
3129 const bool flush_elements =
true,
3130 const bool update_elements =
true,
3131 const bool flush_nodes =
true,
3132 const bool update_nodes =
true);
3138 void reset_halo_haloed_scheme();
3147 void compute_global_node_names_and_shared_nodes(
3149 other_proc_shd_bnd_node_pt,
3158 void send_boundary_node_info_of_shared_nodes(
3166 void reset_halo_haloed_scheme_helper(
3168 other_proc_shd_bnd_node_pt,
3186 unsigned try_to_add_element_pt_load_balance(
3190 const unsigned nnew_elements_on_domain = new_elements_on_domain.size();
3193 bool already_on_new_domain =
false;
3194 unsigned new_domain_ele_index = 0;
3196 for (
unsigned e = 0;
e < nnew_elements_on_domain;
e++)
3198 if (ele_pt == new_elements_on_domain[
e])
3201 already_on_new_domain =
true;
3203 new_domain_ele_index =
e;
3209 if (!already_on_new_domain)
3212 new_elements_on_domain.push_back(ele_pt);
3214 return nnew_elements_on_domain;
3219 return new_domain_ele_index;
3227 void get_required_elemental_information_load_balance_helper(
3229 Vector<Vector<FiniteElement*>>& f_haloed_ele_pt,
3230 FiniteElement* ele_pt);
3234 unsigned try_to_add_node_pt_load_balance(Vector<Node*>& new_nodes_on_domain,
3238 const unsigned nnew_nodes_on_domain = new_nodes_on_domain.size();
3241 bool already_on_new_domain =
false;
3242 unsigned new_domain_node_index = 0;
3244 for (
unsigned n = 0;
n < nnew_nodes_on_domain;
n++)
3246 if (node_pt == new_nodes_on_domain[
n])
3249 already_on_new_domain =
true;
3251 new_domain_node_index =
n;
3257 if (!already_on_new_domain)
3260 new_nodes_on_domain.push_back(node_pt);
3262 return nnew_nodes_on_domain;
3267 return new_domain_node_index;
3272 void add_node_load_balance_helper(
3274 Vector<Vector<FiniteElement*>>& f_halo_ele_pt,
3275 Vector<Node*>& new_nodes_on_domain,
3286 void get_required_nodal_information_load_balance_helper(
3287 Vector<Vector<FiniteElement*>>& f_halo_ele_pt,
3294 void create_element_load_balance_helper(
3296 Vector<Vector<FiniteElement*>>& f_haloed_ele_pt,
3298 received_old_haloed_element_pt,
3299 Vector<FiniteElement*>& new_elements_on_domain,
3300 Vector<Node*>& new_nodes_on_domain,
3302 other_proc_shd_bnd_node_pt,
3304 std::map<Vector<unsigned>,
unsigned>& node_name_to_global_index,
3305 Vector<Node*>& global_shared_node_pt);
3312 void add_element_load_balance_helper(
3313 const unsigned& iproc,
3315 received_old_haloed_element_pt,
3316 FiniteElement* ele_pt);
3319 void add_received_node_load_balance_helper(
3321 Vector<Vector<FiniteElement*>>& f_haloed_ele_pt,
3323 received_old_haloed_element_pt,
3324 Vector<Node*>& new_nodes_on_domain,
3326 other_proc_shd_bnd_node_pt,
3328 unsigned& node_index,
3329 FiniteElement*
const& new_el_pt,
3331 std::map<Vector<unsigned>,
unsigned>& node_name_to_global_index,
3332 Vector<Node*>& global_shared_node_pt);
3337 void construct_new_node_load_balance_helper(
3339 Vector<Vector<FiniteElement*>>& f_haloed_ele_pt,
3341 received_old_haloed_element_pt,
3342 Vector<Node*>& new_nodes_on_domain,
3344 other_proc_shd_bnd_node_pt,
3346 unsigned& node_index,
3347 FiniteElement*
const& new_el_pt,
3349 std::map<Vector<unsigned>,
unsigned>& node_name_to_global_index,
3350 Vector<Node*>& global_shared_node_pt);
3375 #ifdef ANNOTATE_REFINEABLE_TRIANGLE_MESH_COMMUNICATION
3378 Vector<std::string> Flat_packed_unsigneds_string;
3391 unsigned try_to_add_root_haloed_element_pt(
const unsigned&
p,
3392 GeneralisedElement*& el_pt)
3395 unsigned n_haloed = this->nroot_haloed_element(
p);
3398 bool already_haloed_element =
false;
3399 unsigned haloed_el_index = 0;
3400 for (
unsigned eh = 0; eh < n_haloed; eh++)
3402 if (el_pt == this->root_haloed_element_pt(
p, eh))
3405 already_haloed_element =
true;
3407 haloed_el_index = eh;
3413 if (!already_haloed_element)
3416 this->add_root_haloed_element_pt(
p, el_pt);
3423 return haloed_el_index;
3429 unsigned try_to_add_haloed_node_pt(
const unsigned&
p, Node*& nod_pt)
3432 unsigned n_haloed_nod = this->nhaloed_node(
p);
3435 bool is_an_haloed_node =
false;
3436 unsigned haloed_node_index = 0;
3437 for (
unsigned k = 0;
k < n_haloed_nod;
k++)
3439 if (nod_pt == this->haloed_node_pt(
p,
k))
3441 is_an_haloed_node =
true;
3442 haloed_node_index =
k;
3448 if (!is_an_haloed_node)
3451 this->add_haloed_node_pt(
p, nod_pt);
3453 return n_haloed_nod;
3458 return haloed_node_index;
3465 void get_required_elemental_information_helper(
unsigned& iproc,
3466 FiniteElement* ele_pt);
3471 void get_required_nodal_information_helper(
unsigned& iproc, Node* nod_pt);
3474 void add_haloed_node_helper(
unsigned& iproc, Node* nod_pt);
3477 void send_and_receive_elements_nodes_info(
int& send_proc,
int& recv_proc);
3481 void create_halo_element(
3483 Vector<Node*>& new_nodes_on_domain,
3485 other_proc_shd_bnd_node_pt,
3487 std::map<Vector<unsigned>,
unsigned>& node_name_to_global_index,
3488 Vector<Node*>& global_shared_node_pt);
3494 void add_halo_element_helper(
unsigned& iproc, FiniteElement* ele_pt);
3497 void add_halo_node_helper(
3499 Vector<Node*>& new_nodes_on_domain,
3501 other_proc_shd_bnd_node_pt,
3503 unsigned& node_index,
3504 FiniteElement*
const& new_el_pt,
3506 std::map<Vector<unsigned>,
unsigned>& node_name_to_global_index,
3507 Vector<Node*>& global_shared_node_pt);
3511 void construct_new_halo_node_helper(
3513 Vector<Node*>& new_nodes_on_domain,
3515 other_proc_shd_bnd_node_pt,
3517 unsigned& node_index,
3518 FiniteElement*
const& new_el_pt,
3520 std::map<Vector<unsigned>,
unsigned>& node_name_to_global_index,
3521 Vector<Node*>& global_shared_node_pt);
3527 void update_other_proc_shd_bnd_node_helper(
3530 other_proc_shd_bnd_node_pt,
3531 Vector<unsigned>& other_processor_1,
3532 Vector<unsigned>& other_processor_2,
3533 Vector<unsigned>& other_shared_boundaries,
3534 Vector<unsigned>& other_indexes,
3536 std::map<Vector<unsigned>,
unsigned>& node_name_to_global_index,
3537 Vector<Node*>& global_shared_node_pt);
3553 const bool& check_only =
false);
3572 const bool& check_only =
false);
3583 Mesh* face_mesh_pt);
3590 const unsigned& boundary_id,
3592 std::map<FiniteElement*, bool>& is_inverted,
3593 bool& inverted_face_mesh);
3622 #ifdef OOMPH_HAS_MPI
3625 bool update_shared_curve_using_elements_area(
3630 void update_shared_curve_after_restart(
3641 this->Nbin_x_for_area_transfer = 100;
3646 this->Nbin_y_for_area_transfer = 100;
3650 Max_sample_points_for_limited_locate_zeta_during_target_area_transfer = 5;
3655 this->Min_permitted_angle = 15.0;
3658 this->Disable_projection =
false;
3661 this->Use_iterative_solver_for_projection =
true;
3664 this->Print_timings_level_adaptation = 0;
3667 this->Print_timings_level_load_balance = 0;
3671 this->Print_timings_transfering_target_areas =
false;
3674 this->Print_timings_projection =
false;
3680 Mesh_update_fct_pt = 0;
3684 Internal_hole_point_update_fct_pt = 0;
3687 #ifdef OOMPH_HAS_TRIANGLE_LIB
3691 void refine_triangulateio(TriangulateIO& triangulate_io,
3693 TriangulateIO& triangle_refine);
3702 double min_angle = DBL_MAX;
3703 unsigned count_unrefined = 0;
3704 unsigned count_refined = 0;
3705 this->Nrefinement_overruled = 0;
3708 std::map<FiniteElement*, double> max_area_from_region;
3709 for (std::map<unsigned, double>::iterator it =
3710 this->Regions_areas.begin();
3711 it != this->Regions_areas.end();
3714 unsigned r = (*it).first;
3715 unsigned nel = this->nregion_element(
r);
3716 for (
unsigned e = 0;
e < nel;
e++)
3718 max_area_from_region[this->region_element_pt(
r,
e)] = (*it).second;
3722 unsigned nel = this->nelement();
3723 for (
unsigned e = 0;
e < nel;
e++)
3729 double area = el_pt->
size();
3734 double ay = el_pt->
node_pt(0)->
x(1);
3736 double bx = el_pt->
node_pt(1)->
x(0);
3737 double by = el_pt->
node_pt(1)->
x(1);
3739 double cx = el_pt->
node_pt(2)->
x(0);
3740 double cy = el_pt->
node_pt(2)->
x(1);
3744 acos(((
ax - cx) * (bx - cx) + (ay - cy) * (by - cy)) /
3745 (
sqrt((
ax - cx) * (
ax - cx) + (ay - cy) * (ay - cy)) *
3746 sqrt((bx - cx) * (bx - cx) + (by - cy) * (by - cy)))) *
3748 min_angle =
std::min(min_angle, angle0);
3751 acos(((
ax - bx) * (cx - bx) + (ay - by) * (cy - by)) /
3752 (
sqrt((
ax - bx) * (
ax - bx) + (ay - by) * (ay - by)) *
3753 sqrt((cx - bx) * (cx - bx) + (cy - by) * (cy - by)))) *
3755 min_angle =
std::min(min_angle, angle1);
3757 double angle2 = 180.0 - angle0 - angle1;
3758 min_angle =
std::min(min_angle, angle2);
3763 double size_ratio = 3.0;
3764 if (elem_error[
e] > max_permitted_error())
3778 this->Nrefinement_overruled++;
3781 else if (elem_error[
e] < min_permitted_error())
3802 std::map<FiniteElement*, double>::iterator it =
3803 max_area_from_region.find(el_pt);
3804 if (it != max_area_from_region.end())
3806 target_area[
e] =
std::min(target_area[
e], (*it).second);
3812 this->Nrefined = count_refined;
3813 this->Nunrefined = count_unrefined;
3815 if (this->Nrefinement_overruled != 0)
3818 <<
"\nNOTE: Refinement of " << this->Nrefinement_overruled
3820 <<
"overruled \nbecause the target area would have "
3822 <<
".\nYou can change the minimum permitted area with the\n"
3823 <<
"function RefineableTriangleMesh::min_element_size().\n\n";
3893 template<
class ELEMENT>
3898 #ifdef OOMPH_HAS_TRIANGLE_LIB
3918 const bool& allow_automatic_creation_of_vertices_on_boundaries =
true)
3924 allow_automatic_creation_of_vertices_on_boundaries)
3939 #ifdef OOMPH_HAS_TRIANGLE_LIB
3944 template<
class ELEMENT>
3945 class RefineableSolidTriangleMesh
3946 :
public virtual RefineableTriangleMesh<ELEMENT>,
3947 public virtual SolidMesh
3952 RefineableSolidTriangleMesh(
3953 TriangleMeshParameters& triangle_mesh_parameters,
3955 : TriangleMesh<ELEMENT>(triangle_mesh_parameters, time_stepper_pt),
3956 RefineableTriangleMesh<ELEMENT>(triangle_mesh_parameters,
3960 set_lagrangian_nodal_coordinates();
3965 RefineableSolidTriangleMesh(
3966 const Vector<double>& target_area,
3967 TriangulateIO& triangulate_io,
3969 const bool& use_attributes =
false,
3970 const bool& allow_automatic_creation_of_vertices_on_boundaries =
true,
3971 OomphCommunicator* comm_pt = 0)
3972 : RefineableTriangleMesh<ELEMENT>(
3977 allow_automatic_creation_of_vertices_on_boundaries,
3981 set_lagrangian_nodal_coordinates();
3985 virtual ~RefineableSolidTriangleMesh() {}
AnnoyingScalar acos(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:138
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
Array< double, 1, 3 > e(1./3., 0.5, 2.)
MatrixXf H
Definition: HessenbergDecomposition_matrixH.cpp:4
float * p
Definition: Tutorial_Map_using.cpp:9
Scalar * b
Definition: benchVecAdd.cpp:17
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
Definition: oomph_utilities.h:499
Definition: elements.h:1313
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Definition: elements.h:2175
double size() const
Definition: elements.cc:4290
Definition: matrices.h:74
Definition: mesh_as_geometric_object.h:93
Vector< Node * > Node_pt
Vector of pointers to nodes.
Definition: mesh.h:183
static Steady< 0 > Default_TimeStepper
The Steady Timestepper.
Definition: mesh.h:75
bool is_mesh_distributed() const
Boolean to indicate if Mesh has been distributed.
Definition: mesh.h:1588
Vector< Vector< FiniteElement * > > Boundary_element_pt
Definition: mesh.h:91
void flush_element_and_node_storage()
Definition: mesh.h:407
OomphCommunicator * communicator_pt() const
Definition: mesh.h:1600
std::vector< bool > Boundary_coordinate_exists
Definition: mesh.h:190
Vector< Vector< int > > Face_index_at_boundary
Definition: mesh.h:95
unsigned nboundary() const
Return number of boundaries.
Definition: mesh.h:827
void remove_boundary_nodes()
Clear all pointers to boundary nodes.
Definition: mesh.cc:204
unsigned long nnode() const
Return number of nodes in the mesh.
Definition: mesh.h:596
Node *& node_pt(const unsigned long &n)
Return pointer to global node n.
Definition: mesh.h:436
Vector< GeneralisedElement * > Element_pt
Vector of pointers to generalised elements.
Definition: mesh.h:186
unsigned long nelement() const
Return number of elements in the mesh.
Definition: mesh.h:590
double & x(const unsigned &i)
Return the i-th nodal coordinate.
Definition: nodes.h:1060
Definition: communicator.h:54
int my_rank() const
my rank
Definition: communicator.h:176
int nproc() const
number of processors
Definition: communicator.h:157
Definition: oomph_definitions.h:222
Definition: oomph_definitions.h:267
Definition: refineable_mesh.h:48
Unstructured refineable Triangle Mesh.
Definition: triangle_mesh.template.h:2249
bool refine_boundary_constrained_by_target_area(MeshAsGeomObject *mesh_geom_obj_pt, Vector< Vector< double >> &vector_bnd_vertices, double &refinement_tolerance, Vector< double > &area_constraint)
unsigned & nbin_y_for_area_transfer()
Definition: triangle_mesh.template.h:2462
void disable_iterative_solver_for_projection()
Definition: triangle_mesh.template.h:2510
bool get_connected_vertex_number_on_dst_boundary(Vector< double > &vertex_coordinates, const unsigned &dst_b_id, unsigned &vertex_number)
std::map< unsigned, std::set< Vector< double > > > Boundary_connections_pt
Definition: triangle_mesh.template.h:2927
MeshUpdateFctPt & mesh_update_fct_pt()
Definition: triangle_mesh.template.h:2628
unsigned Print_timings_level_adaptation
The printing level for adaptation.
Definition: triangle_mesh.template.h:3867
double compute_area_target(const Vector< double > &elem_error, Vector< double > &target_area)
Definition: triangle_mesh.template.h:3699
void enable_timings_tranfering_target_areas()
Definition: triangle_mesh.template.h:2415
void get_boundary_segment_nodes_helper(const unsigned &b, Vector< Vector< Node * >> &tmp_segment_nodes)
virtual ~RefineableTriangleMesh()
Empty Destructor.
Definition: triangle_mesh.template.h:2411
void set_print_level_timings_load_balance(const unsigned &print_level)
Sets the printing level of timings for load balance.
Definition: triangle_mesh.template.h:2555
void disable_boundary_unrefinement_constrained_by_target_areas()
Definition: triangle_mesh.template.h:2884
void initialise_adaptation_data()
Helper function to initialise data associated with adaptation.
Definition: triangle_mesh.template.h:3636
void enable_print_timings_load_balance(const unsigned &print_level=1)
Enables printing of timings for load balance.
Definition: triangle_mesh.template.h:2543
void update_polyline_representation_from_restart()
Method used to update the polylines representation after restart.
Definition: triangle_mesh.template.h:2767
void initialise_boundary_refinement_data()
Set all the flags to true (the default values)
Definition: triangle_mesh.template.h:3103
void enable_boundary_unrefinement_constrained_by_target_areas()
Definition: triangle_mesh.template.h:2879
void enable_timings_projection()
Enables info. and timings for projection.
Definition: triangle_mesh.template.h:2440
bool Do_shared_boundary_unrefinement_constrained_by_target_areas
Flag that enables or disables boundary unrefinement (true by default)
Definition: triangle_mesh.template.h:3097
double Max_element_size
Max permitted element size.
Definition: triangle_mesh.template.h:3845
void set_print_level_timings_adaptation(const unsigned &print_level)
Sets the printing level of timings for adaptation.
Definition: triangle_mesh.template.h:2528
void disable_print_timings_load_balance()
Disables printing of timings for load balance.
Definition: triangle_mesh.template.h:2549
unsigned Nbin_x_for_area_transfer
Definition: triangle_mesh.template.h:3831
void enable_shared_boundary_unrefinement_constrained_by_target_areas()
Definition: triangle_mesh.template.h:2901
void snap_nodes_onto_boundary(RefineableTriangleMesh< ELEMENT > *&new_mesh_pt, const unsigned &b)
Snap the boundary nodes onto any curvilinear boundaries.
void disable_timings_projection()
Disables info. and timings for projection.
Definition: triangle_mesh.template.h:2446
virtual bool surface_remesh_for_inner_hole_boundaries(Vector< Vector< double >> &internal_point_coord, const bool &check_only=false)
void refine_uniformly(DocInfo &doc_info)
Refine mesh uniformly and doc process.
Definition: triangle_mesh.template.h:2586
MeshUpdateFctPt Mesh_update_fct_pt
Definition: triangle_mesh.template.h:3876
void get_face_mesh_representation(TriangleMeshPolygon *polygon_pt, Vector< Mesh * > &face_mesh_pt)
void enable_print_timings_adaptation(const unsigned &print_level=1)
Enables printing of timings for adaptation.
Definition: triangle_mesh.template.h:2516
void disable_boundary_refinement_constrained_by_target_areas()
Definition: triangle_mesh.template.h:2894
double & max_element_size()
Max element size allowed during adaptation.
Definition: triangle_mesh.template.h:2477
bool unrefine_shared_boundary_constrained_by_target_area(const unsigned &b, const unsigned &c, Vector< Vector< double >> &vector_bnd_vertices, Vector< double > &area_constraint)
InternalHolePointUpdateFctPt Internal_hole_point_update_fct_pt
Definition: triangle_mesh.template.h:3881
void disable_projection()
Disables the solution projection step during adaptation.
Definition: triangle_mesh.template.h:2434
void resume_boundary_connections(Vector< TriangleMeshPolyLine * > &resume_initial_connection_polyline_pt, Vector< TriangleMeshPolyLine * > &resume_final_connection_polyline_pt)
void enable_boundary_refinement_constrained_by_target_areas()
Definition: triangle_mesh.template.h:2889
bool Use_iterative_solver_for_projection
Definition: triangle_mesh.template.h:3858
unsigned max_sample_points_for_limited_locate_zeta_during_target_area_transfer()
Definition: triangle_mesh.template.h:2471
unsigned & nbin_x_for_area_transfer()
Definition: triangle_mesh.template.h:2454
void disable_shared_boundary_unrefinement_constrained_by_target_areas()
Definition: triangle_mesh.template.h:2906
const bool boundary_connections(const unsigned &b, const unsigned &c, std::set< Vector< double >> &vertices)
Definition: triangle_mesh.template.h:2932
RefineableTriangleMesh(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 &allow_automatic_creation_of_vertices_on_boundaries=true)
Build mesh, based on the polyfiles.
Definition: triangle_mesh.template.h:2285
bool update_open_curve_using_elements_area(TriangleMeshOpenCurve *&open_curve_pt, const Vector< double > &target_area)
bool Disable_projection
Enable/disable solution projection during adaptation.
Definition: triangle_mesh.template.h:3854
bool unrefine_boundary_constrained_by_target_area(const unsigned &b, const unsigned &c, Vector< Vector< double >> &vector_bnd_vertices, double &unrefinement_tolerance, Vector< double > &area_constraint)
double Min_permitted_angle
Min angle before remesh gets triggered.
Definition: triangle_mesh.template.h:3851
void disable_shared_boundary_refinement_constrained_by_target_areas()
Definition: triangle_mesh.template.h:2916
bool unrefine_boundary(const unsigned &b, const unsigned &c, Vector< Vector< double >> &vector_bnd_vertices, double &unrefinement_tolerance, const bool &check_only=false)
Helper function that performs the unrefinement process.
bool Do_boundary_unrefinement_constrained_by_target_areas
Flag that enables or disables boundary unrefinement (true by default)
Definition: triangle_mesh.template.h:3091
double & min_permitted_angle()
Min angle before remesh gets triggered.
Definition: triangle_mesh.template.h:2489
bool refine_boundary(Mesh *face_mesh_pt, Vector< Vector< double >> &vector_bnd_vertices, double &refinement_tolerance, const bool &check_only=false)
void create_sorted_face_mesh_representation(const unsigned &boundary_id, Mesh *face_mesh_pt, std::map< FiniteElement *, bool > &is_inverted, bool &inverted_face_mesh)
void doc_adaptivity_targets(std::ostream &outfile)
Doc the targets for mesh adaptation.
Definition: triangle_mesh.template.h:2570
unsigned Max_sample_points_for_limited_locate_zeta_during_target_area_transfer
Definition: triangle_mesh.template.h:3842
void update_open_curve_after_restart(TriangleMeshOpenCurve *&open_curve_pt)
Updates the open curve representation after restart.
bool refine_shared_boundary_constrained_by_target_area(Vector< Vector< double >> &vector_bnd_vertices, Vector< double > &area_constraint)
void enable_projection()
Enables the solution projection step during adaptation.
Definition: triangle_mesh.template.h:2428
void enable_iterative_solver_for_projection()
Definition: triangle_mesh.template.h:2503
void disable_print_timings_adaptation()
Disables printing of timings for adaptation.
Definition: triangle_mesh.template.h:2522
bool Do_boundary_refinement_constrained_by_target_areas
Flag that enables or disables boundary refinement (true by default)
Definition: triangle_mesh.template.h:3094
void create_unsorted_face_mesh_representation(const unsigned &boundary_id, Mesh *face_mesh_pt)
double Min_element_size
Min permitted element size.
Definition: triangle_mesh.template.h:3848
void add_non_delete_vertices_from_boundary_helper(Vector< Vector< Node * >> src_bound_segment_node_pt, Vector< Vector< Node * >> dst_bound_segment_node_pt, const unsigned &dst_bnd_id, const unsigned &dst_bnd_chunk)
bool Do_shared_boundary_refinement_constrained_by_target_areas
Flag that enables or disables boundary unrefinement (true by default)
Definition: triangle_mesh.template.h:3100
void restore_boundary_connections(Vector< TriangleMeshPolyLine * > &resume_initial_connection_polyline_pt, Vector< TriangleMeshPolyLine * > &resume_final_connection_polyline_pt)
bool update_open_curve_using_face_mesh(TriangleMeshOpenCurve *open_polyline_pt, const bool &check_only=false)
void create_temporary_boundary_connections(Vector< TriangleMeshPolygon * > &tmp_outer_polygons_pt, Vector< TriangleMeshOpenCurve * > &tmp_open_curves_pt)
bool Print_timings_projection
Enable/disable printing timings for projection.
Definition: triangle_mesh.template.h:3864
void disable_timings_tranfering_target_areas()
Definition: triangle_mesh.template.h:2422
bool Print_timings_transfering_target_areas
Enable/disable printing timings for transfering target areas.
Definition: triangle_mesh.template.h:3861
double & min_element_size()
Min element size allowed during adaptation.
Definition: triangle_mesh.template.h:2483
unsigned Print_timings_level_load_balance
The printing level for load balance.
Definition: triangle_mesh.template.h:3870
void get_face_mesh_representation(TriangleMeshOpenCurve *open_polyline_pt, Vector< Mesh * > &face_mesh_pt)
const void synchronize_shared_boundary_connections()
Synchronise the vertices that are marked for non deletion.
void enable_shared_boundary_refinement_constrained_by_target_areas()
Definition: triangle_mesh.template.h:2911
bool update_polygon_using_face_mesh(TriangleMeshPolygon *polygon_pt, const bool &check_only=false)
void update_polygon_after_restart(TriangleMeshPolygon *&polygon_pt)
Updates the polylines representation after restart.
bool use_iterative_solver_for_projection()
Definition: triangle_mesh.template.h:2496
unsigned unrefine_uniformly()
Definition: triangle_mesh.template.h:2612
void add_vertices_for_non_deletion()
void create_polylines_from_polyfiles(const std::string &node_file_name, const std::string &poly_file_name)
Helper function to create polylines and fill associate data.
bool update_polygon_using_elements_area(TriangleMeshPolygon *&polygon_pt, const Vector< double > &target_area)
bool apply_max_length_constraint(Mesh *face_mesh_pt, Vector< Vector< double >> &vector_bnd_vertices, double &max_length_constraint)
unsigned Nbin_y_for_area_transfer
Definition: triangle_mesh.template.h:3836
InternalHolePointUpdateFctPt & internal_hole_point_update_fct_pt()
Definition: triangle_mesh.template.h:2636
void restore_polyline_connections_helper(TriangleMeshPolyLine *polyline_pt, Vector< TriangleMeshPolyLine * > &resume_initial_connection_polyline_pt, Vector< TriangleMeshPolyLine * > &resume_final_connection_polyline_pt)
void adapt(const Vector< double > &elem_error)
Adapt mesh, based on elemental error provided.
void set_lagrangian_nodal_coordinates()
Definition: mesh.cc:9564
Unstructured Triangle Mesh upgraded to solid mesh.
Definition: triangle_mesh.template.h:3896
SolidTriangleMesh(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 &allow_automatic_creation_of_vertices_on_boundaries=true)
Definition: triangle_mesh.template.h:3913
virtual ~SolidTriangleMesh()
Empty Destructor.
Definition: triangle_mesh.template.h:3931
Definition: timesteppers.h:231
Definition: generic/triangle_mesh.h:52
virtual void reset_boundary_element_info(Vector< unsigned > &ntmp_boundary_elements, Vector< Vector< unsigned >> &ntmp_boundary_elements_in_region, Vector< FiniteElement * > &deleted_elements)
Virtual function to perform the reset boundary elements info rutines.
Definition: generic/triangle_mesh.h:242
virtual void load_balance(const Vector< unsigned > &target_domain_for_local_non_halo_element)
Virtual function to perform the load balance rutines.
Definition: generic/triangle_mesh.h:230
Base class defining a closed curve for the Triangle mesh generation.
Definition: unstructured_two_d_mesh_geometry_base.h:1339
Definition: unstructured_two_d_mesh_geometry_base.h:1642
Definition: triangle_mesh.template.h:94
Vector< TriangleMeshClosedCurve * > internal_closed_curve_pt() const
Helper function for getting the internal closed boundaries.
Definition: triangle_mesh.template.h:163
bool Boundary_refinement
Do not allow refinement of nodes on the boundary.
Definition: triangle_mesh.template.h:394
TriangleMeshClosedCurve * outer_boundary_pt(const unsigned &i) const
Helper function for getting the i-th outer boundary.
Definition: triangle_mesh.template.h:151
bool is_automatic_creation_of_vertices_on_boundaries_allowed()
Definition: triangle_mesh.template.h:361
TriangleMeshParameters(Vector< TriangleMeshClosedCurve * > &outer_boundary_pt)
Definition: triangle_mesh.template.h:98
Vector< Vector< double > > extra_holes_coordinates() const
Helper function for getting the extra holes.
Definition: triangle_mesh.template.h:201
virtual ~TriangleMeshParameters()
Empty destructor.
Definition: triangle_mesh.template.h:136
std::map< unsigned, double > & target_area_for_region()
Helper function for getting access to the region's target areas.
Definition: triangle_mesh.template.h:267
void set_target_area_for_region(const unsigned &i, const double &area)
Helper function to specify target area for region.
Definition: triangle_mesh.template.h:261
bool is_mesh_distributed() const
Boolean to indicate if Mesh has been distributed.
Definition: triangle_mesh.template.h:298
bool is_use_attributes() const
Definition: triangle_mesh.template.h:286
double & element_area()
Helper function for getting access to the element area.
Definition: triangle_mesh.template.h:195
Vector< TriangleMeshClosedCurve * > outer_boundary_pt() const
Helper function for getting the outer boundary.
Definition: triangle_mesh.template.h:139
void enable_use_attributes()
Helper function for enabling the use of attributes.
Definition: triangle_mesh.template.h:273
void disable_use_attributes()
Helper function for disabling the use of attributes.
Definition: triangle_mesh.template.h:279
OomphCommunicator * communicator_pt() const
Read-only access fct to communicator (Null if mesh is not distributed)
Definition: triangle_mesh.template.h:310
double element_area() const
Helper function for getting the element area.
Definition: triangle_mesh.template.h:189
void disable_automatic_creation_of_vertices_on_boundaries()
Definition: triangle_mesh.template.h:354
bool Internal_boundary_refinement
Do not allow refinement of nodes on the internal boundary.
Definition: triangle_mesh.template.h:397
void enable_automatic_creation_of_vertices_on_boundaries()
Definition: triangle_mesh.template.h:347
void disable_internal_boundary_refinement()
Helper function for disabling the use of boundary refinement.
Definition: triangle_mesh.template.h:334
TriangleMeshParameters(TriangleMeshClosedCurve *outer_boundary_pt)
Definition: triangle_mesh.template.h:111
std::map< unsigned, Vector< double > > Regions_coordinates
Definition: triangle_mesh.template.h:384
Vector< Vector< double > > & extra_holes_coordinates()
Helper function for getting access to the extra holes.
Definition: triangle_mesh.template.h:207
Vector< TriangleMeshClosedCurve * > & internal_closed_curve_pt()
Definition: triangle_mesh.template.h:170
void add_region_coordinates(const unsigned &i, Vector< double > ®ion_coordinates)
Helper function for getting the extra regions.
Definition: triangle_mesh.template.h:213
TriangleMeshClosedCurve *& outer_boundary_pt(const unsigned &i)
Helper function for getting access to the i-th outer boundary.
Definition: triangle_mesh.template.h:157
TriangleMeshParameters()
Definition: triangle_mesh.template.h:125
Vector< TriangleMeshClosedCurve * > Internal_closed_curve_pt
Internal closed boundaries.
Definition: triangle_mesh.template.h:371
void set_communicator_pt(OomphCommunicator *comm_pt)
Function to set communicator (mesh is then assumed to be distributed)
Definition: triangle_mesh.template.h:304
Vector< TriangleMeshClosedCurve * > & outer_boundary_pt()
Helper function for getting access to the outer boundary.
Definition: triangle_mesh.template.h:145
Vector< TriangleMeshOpenCurve * > & internal_open_curves_pt()
Definition: triangle_mesh.template.h:183
Vector< Vector< double > > Extra_holes_coordinates
Store the coordinates for defining extra holes.
Definition: triangle_mesh.template.h:380
Vector< TriangleMeshClosedCurve * > Outer_boundary_pt
The outer boundary.
Definition: triangle_mesh.template.h:368
bool Allow_automatic_creation_of_vertices_on_boundaries
Definition: triangle_mesh.template.h:401
Vector< TriangleMeshOpenCurve * > internal_open_curves_pt() const
Helper function for getting the internal open boundaries.
Definition: triangle_mesh.template.h:176
std::map< unsigned, double > Regions_areas
Definition: triangle_mesh.template.h:388
bool Use_attributes
Define the use of attributes (regions)
Definition: triangle_mesh.template.h:391
OomphCommunicator * Comm_pt
Definition: triangle_mesh.template.h:406
void enable_internal_boundary_refinement()
Helper function for enabling the use of boundary refinement.
Definition: triangle_mesh.template.h:328
std::map< unsigned, Vector< double > > & regions_coordinates()
Helper function for getting access to the regions coordinates.
Definition: triangle_mesh.template.h:255
void disable_boundary_refinement()
Helper function for disabling the use of boundary refinement.
Definition: triangle_mesh.template.h:316
bool is_boundary_refinement_allowed() const
Helper function for getting the status of boundary refinement.
Definition: triangle_mesh.template.h:322
void enable_boundary_refinement()
Helper function for enabling the use of boundary refinement.
Definition: triangle_mesh.template.h:292
bool is_internal_boundary_refinement_allowed() const
Helper function for getting the status of boundary refinement.
Definition: triangle_mesh.template.h:340
Vector< TriangleMeshOpenCurve * > Internal_open_curves_pt
Internal boundaries.
Definition: triangle_mesh.template.h:374
double Element_area
The element are when calling triangulate external routine.
Definition: triangle_mesh.template.h:377
Class defining a polyline for use in Triangle Mesh generation.
Definition: unstructured_two_d_mesh_geometry_base.h:868
Class defining a closed polygon for the Triangle mesh generation.
Definition: unstructured_two_d_mesh_geometry_base.h:1451
Definition: triangle_mesh.template.h:424
TimeStepper * Time_stepper_pt
Timestepper used to build elements.
Definition: triangle_mesh.template.h:1179
TriangleScaffoldMesh * Tmp_mesh_pt
Temporary scaffold mesh.
Definition: triangle_mesh.template.h:1354
bool Use_attributes
Definition: triangle_mesh.template.h:1183
void build_from_scaffold(TimeStepper *time_stepper_pt, const bool &use_attributes)
Build mesh from scaffold.
Definition: triangle_mesh.template.cc:44
virtual ~TriangleMesh()
Destructor.
Definition: triangle_mesh.template.h:854
std::map< unsigned, double > Regions_areas
Definition: triangle_mesh.template.h:1188
coord2_t cross(const Point &O, const Point &A, const Point &B)
Definition: triangle_mesh.template.h:2199
void operator=(const TriangleMesh &)=delete
Broken assignment operator.
std::vector< Point > convex_hull(std::vector< Point > P)
Definition: triangle_mesh.template.h:2207
Vector< unsigned > oomph_vertex_nodes_id()
Definition: triangle_mesh.template.h:1173
Vector< unsigned > Oomph_vertex_nodes_id
Definition: triangle_mesh.template.h:1358
TriangleMesh(const TriangleMesh &dummy)=delete
Broken copy constructor.
void set_mesh_level_time_stepper(TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
Definition: triangle_mesh.template.h:891
TriangleMesh(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 &allow_automatic_creation_of_vertices_on_boundaries=true)
Constructor with the input files.
Definition: triangle_mesh.template.h:448
void output_boundary_coordinates(const unsigned &b, std::ostream &outfile)
Definition: triangle_mesh.template.cc:8014
double coord_t
Definition: triangle_mesh.template.h:2182
TriangleMesh()
Empty constructor.
Definition: triangle_mesh.template.h:427
double coord2_t
Definition: triangle_mesh.template.h:2183
Definition: triangle_scaffold_mesh.h:51
Vector< TriangleMeshOpenCurve * > Internal_open_curve_pt
Vector of open polylines that define internal curves.
Definition: unstructured_two_d_mesh_geometry_base.h:2602
bool is_automatic_creation_of_vertices_on_boundaries_allowed()
Definition: unstructured_two_d_mesh_geometry_base.h:2000
Vector< TriangleMeshPolygon * > Outer_boundary_pt
Polygon that defines outer boundaries.
Definition: unstructured_two_d_mesh_geometry_base.h:2596
Vector< TriangleMeshPolygon * > Internal_polygon_pt
Vector of polygons that define internal polygons.
Definition: unstructured_two_d_mesh_geometry_base.h:2599
void snap_nodes_onto_geometric_objects()
Definition: unstructured_two_d_mesh_geometry_base.cc:4020
std::map< unsigned, Vector< double > > Regions_coordinates
Definition: unstructured_two_d_mesh_geometry_base.h:2609
Vector< Vector< double > > Extra_holes_coordinates
Storage for extra coordinates for holes.
Definition: unstructured_two_d_mesh_geometry_base.h:2605
bool Allow_automatic_creation_of_vertices_on_boundaries
Definition: unstructured_two_d_mesh_geometry_base.h:2575
Vector< std::map< unsigned, Vector< FiniteElement * > > > Boundary_region_element_pt
Storage for elements adjacent to a boundary in a particular region.
Definition: unstructured_two_d_mesh_geometry_base.h:2617
Vector< double > Region_attribute
Vector of attributes associated with the elements in each region.
Definition: unstructured_two_d_mesh_geometry_base.h:2586
Vector< std::map< unsigned, Vector< int > > > Face_index_region_at_boundary
Storage for the face index adjacent to a boundary in a particular region.
Definition: unstructured_two_d_mesh_geometry_base.h:2620
std::set< TriangleMeshOpenCurve * > Free_open_curve_pt
Definition: unstructured_two_d_mesh_geometry_base.h:2646
std::set< TriangleMeshCurveSection * > Free_curve_section_pt
Definition: unstructured_two_d_mesh_geometry_base.h:2638
std::map< unsigned, Vector< std::pair< double, double > > > Polygonal_vertex_arclength_info
Definition: unstructured_two_d_mesh_geometry_base.h:2630
std::set< TriangleMeshPolygon * > Free_polygon_pt
Definition: unstructured_two_d_mesh_geometry_base.h:2642
std::map< unsigned, Vector< FiniteElement * > > Region_element_pt
Definition: unstructured_two_d_mesh_geometry_base.h:2583
std::map< unsigned, TriangleMeshCurveSection * > Boundary_curve_section_pt
Definition: unstructured_two_d_mesh_geometry_base.h:2613
Definition: oomph-lib/src/generic/Vector.h:58
#define min(a, b)
Definition: datatypes.h:22
#define max(a, b)
Definition: datatypes.h:23
#define _FPU_SETCW(cw)
Definition: dummy_fpu_control.h:13
static constexpr lastp1_t end
Definition: IndexedViewHelper.h:79
Matrix< Type, Size, 1 > Vector
\cpp11 SizeĆ1 vector of type Type.
Definition: Eigen/Eigen/src/Core/Matrix.h:515
Scalar * y
Definition: level1_cplx_impl.h:128
RealScalar s
Definition: level1_cplx_impl.h:130
int nb
Definition: level2_impl.h:286
char char char int int * k
Definition: level2_impl.h:374
EIGEN_DEVICE_FUNC const Scalar & q
Definition: SpecialFunctionsImpl.h:2019
double P
Uniform pressure.
Definition: TwenteMeshGluing.cpp:77
double Min_permitted_error
Definition: two_d_parallel_unstructured_adaptive_poisson.cc:95
double Min_element_size
Definition: two_d_parallel_unstructured_adaptive_poisson.cc:97
double Max_element_size
Definition: two_d_parallel_unstructured_adaptive_poisson.cc:96
double Max_permitted_error
Definition: two_d_parallel_unstructured_adaptive_poisson.cc:94
int c
Definition: calibrate.py:100
int error
Definition: calibrate.py:297
def read_file(filename)
Definition: Configuration/fpdiff.py:36
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
const double Pi
50 digits from maple
Definition: oomph_utilities.h:157
unsigned Counter_for_flat_packed_unsigneds
Definition: multi_domain.cc:134
Vector< double > Flat_packed_doubles
Definition: multi_domain.cc:106
Vector< unsigned > Flat_packed_unsigneds
Definition: multi_domain.cc:118
unsigned Counter_for_flat_packed_doubles
Definition: multi_domain.cc:112
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
OomphInfo oomph_info
Definition: oomph_definitions.cc:319
ax
Definition: plotDoE.py:39
list x
Definition: plotDoE.py:28
t
Definition: plotPSD.py:36
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86
void set(Container &c, Position position, const Value &value)
Definition: stdlist_overload.cpp:36
Definition: triangle_mesh.template.h:2186
coord_t x
Definition: triangle_mesh.template.h:2187
bool operator<(const Point &p) const
Definition: triangle_mesh.template.h:2189
std::ofstream out("Result.txt")
void triangulate(char *, struct triangulateio *, struct triangulateio *, struct triangulateio *)