26#ifndef OOMPH_TRIANGLE_MESH_HEADER
27#define OOMPH_TRIANGLE_MESH_HEADER
30#include <oomph-lib-config.h>
50#include "../rigid_body/immersed_rigid_body_elements.h"
54#ifdef OOMPH_HAS_TRIANGLE_LIB
204 std::ostringstream error_message;
206 <<
"Please use another region id different from zero.\n"
207 <<
"It is internally used as the default region number.\n";
214 std::map<unsigned, Vector<double>>::iterator
it;
220 std::ostringstream error_message;
221 error_message <<
"The region id (" <<
i <<
") that you are using for"
223 <<
"your region is already in use. Use another\n"
224 <<
"region id and verify that you are not re-using\n"
225 <<
" previously defined regions ids\n"
406 template<
class ELEMENT>
413#ifdef OOMPH_HAS_TRIANGLE_LIB
428 MeshChecker::assert_geometric_element<TElementGeometricBase, ELEMENT>(2);
440 MeshChecker::assert_geometric_element<TElementGeometricBase, ELEMENT>(2);
459#ifdef OOMPH_HAS_TRIANGLE_LIB
488 for (
unsigned b = 0; b <
nb; b++)
495#ifdef OOMPH_HAS_TRIANGLE_LIB
507 MeshChecker::assert_geometric_element<TElementGeometricBase, ELEMENT>(2);
511 triangle_mesh_parameters
531 unsigned max_boundary_id = 0;
543 if (outer_boundary_pt.
size() == 0)
545 std::stringstream error_message;
547 <<
"There are no outer boundaries defined.\n"
548 <<
"Verify that you have specified the outer boundaries in the\n"
549 <<
"Triangle_mesh_parameter object\n\n";
598 internal_closed_curve_pt[
i], max_boundary_id);
636 outer_boundary_pt[
i]);
645 internal_closed_curve_pt[
i]);
670 std::map<unsigned, Vector<double>>
regions =
676 const bool refine_boundary =
686 <<
"You have specified that Triangle may refine the outer boundary, "
688 <<
"not internal boundaries. Triangle does not support this "
690 <<
"If you do not want Triangle to refine internal boundaries, it "
692 <<
"refine outer boundaries either!\n"
693 <<
"Please either disable all boundary refinement\n"
694 <<
"(call TriangleMeshParameters::disable_boundary_refinement()\n"
695 <<
"or enable internal boundary refinement (the default)\n";
703 outer_boundary_polygon_pt,
707 extra_holes_coordinates,
728 for (
unsigned b = 0; b <
nb; b++)
741 const double& element_area,
746 MeshChecker::assert_geometric_element<TElementGeometricBase, ELEMENT>(2);
760 "This constructor hasn't been tested since last cleanup.\n";
780 input_string_stream <<
" -YY";
820 for (
unsigned b = 0; b <
nb; b++)
837#ifdef OOMPH_HAS_TRIANGLE_LIB
843 std::set<TriangleMeshCurveSection*>::iterator
it_polyline;
848 delete (*it_polyline);
851 std::set<TriangleMeshPolygon*>::iterator
it_polygon;
856 delete (*it_polygon);
864 delete (*it_open_polyline);
956#ifdef OOMPH_HAS_TRIANGLE_LIB
1030 error_stream <<
"Empty default reestablish disributed info method "
1032 error_stream <<
"This should be overloaded in a specific "
1033 <<
"RefineableTriangleMesh\n";
1055 for (
unsigned e = n_element;
e > 0; --
e)
1130 for (
unsigned b = 0; b <
nbound; b++)
1177#ifdef OOMPH_HAS_TRIANGLE_LIB
1192 const double& element_area,
1198 const bool& refine_boundary,
1202 MeshChecker::assert_geometric_element<TElementGeometricBase, ELEMENT>(2);
1205 if (element_area < 10
e-14)
1209 <<
"The current elements area was stated to (" << element_area
1210 <<
").\nThe current precision to generate the input to triangle "
1211 <<
"is fixed to 14 digits\n\n";
1251 extra_holes_coordinates,
1252 regions_coordinates,
1277 input_string_stream <<
" -YY";
1281 if (refine_boundary ==
false)
1305 if (!regions_coordinates.empty())
1396 std::set<unsigned>::iterator
it =
1400 std::stringstream
error;
1401 error <<
"The current shared boundary (" <<
bnd_id <<
") was\n"
1402 <<
"already added by other pair of processors\n."
1403 <<
"This means that there are repeated shared boundaries "
1423 const unsigned& q)
const
1449 const unsigned& q)
const
1462 const unsigned&
i)
const
1473 const unsigned& c)
const
1479 const unsigned&
p,
const unsigned& c)
1486 const unsigned&
i)
const
1499 std::map<unsigned, Vector<FiniteElement*>>::iterator
it =
1509 <<
") does not exist!!!\n\n";
1523 std::map<unsigned, Vector<FiniteElement*>>::iterator
it =
1533 <<
") does not exist!!!\n\n";
1548 std::map<unsigned, Vector<FiniteElement*>>::iterator
it =
1558 <<
") does not exist!!!\n\n";
1577 std::map<unsigned, Vector<int>>::iterator
it =
1587 <<
") does not exist!!!\n\n";
1596 std::map<unsigned, Vector<Node*>>::iterator
it =
1606 <<
") does not exist!!!\n\n";
1650 std::map<unsigned, Vector<Node*>>::iterator
it =
1660 <<
") does not exist!!!\n\n";
1670 std::map<unsigned, Vector<Node*>>::iterator
it =
1693 <<
") does not exist!!!\n\n";
1707 std::map<unsigned, Vector<unsigned>>::iterator
it =
1712 std::ostringstream error_message;
1714 <<
"The boundary (" << b
1715 <<
") seems not to be shared by any processors,\n"
1716 <<
"it is possible that the boundary was created by the user an not\n"
1717 <<
"automatically by the common interfaces between "
1718 "processors-domains\n";
1724 return (*it).second;
1738 std::map<unsigned, unsigned>::iterator
it =
1752 std::map<unsigned, unsigned>::iterator
it =
1757 std::ostringstream error_message;
1758 error_message <<
"The shared boundary (" <<
shd_bnd_id
1759 <<
") does not lie on an internal "
1761 <<
"Make sure to call this method just for shared "
1762 "boundaries that lie "
1763 <<
"on an internal boundary.\n\n";
1769 return (*it).second;
1781 std::map<unsigned, unsigned>::iterator
it =
1797 std::ostringstream error_message;
1799 <<
" The internal boundary (" <<
internal_bnd_id <<
") has no shared "
1800 <<
"boundaries overlapping it\n"
1801 <<
"Make sure to call this method just for internal boundaries that "
1802 <<
"are marked to as being\noverlaped by shared boundaries\n";
1821 std::map<unsigned, bool>::iterator
it;
1829 return (*it).second;
1837 std::map<unsigned, Vector<TriangleMeshPolyLine*>>::iterator
it;
1842 std::ostringstream error_message;
1844 <<
"The boundary (" << b
1845 <<
") was marked as been splitted but there\n"
1846 <<
"are not registered polylines to represent the boundary.\n"
1847 <<
"The new polylines were not set up when the boundary was found "
1849 <<
"be splitted or the polylines have been explicitly deleted "
1857 return (*it).second.size();
1865 std::map<unsigned, Vector<TriangleMeshPolyLine*>>::iterator
it;
1869 std::ostringstream error_message;
1871 <<
"The boundary (" << b
1872 <<
") was marked as been splitted but there\n"
1873 <<
"are not registered polylines to represent the boundary.\n"
1874 <<
"The new polylines were not set up when the boundary was found "
1876 <<
"be splitted or the polylines have been explicitly deleted "
1883 return (*it).second;
1890 const unsigned&
isub)
1892 std::map<unsigned, std::vector<bool>>::iterator
it;
1901 return (*it).second[
isub];
2022 std::map<
unsigned, std::map<Node*, bool>>&
2025 std::map<
unsigned, std::list<Node*>>&
2049 const unsigned&
nproc,
2115 const unsigned&
iproc,
2116 const unsigned&
jproc,
2131 error_stream <<
"Empty default load balancing function called.\n";
2132 error_stream <<
"This should be overloaded in a specific "
2133 <<
"RefineableTriangleMesh\n";
2168 return x <
p.x || (x ==
p.x && y <
p.y);
2178 return (A.
x -
O.x) * (B.y -
O.y) - (A.
y -
O.y) * (B.x -
O.x);
2187 std::vector<Point> H(2 *
n);
2190 std::sort(P.begin(), P.end());
2193 for (
int i = 0;
i <
n; ++
i)
2195 while (
k >= 2 &&
cross(H[
k - 2], H[
k - 1], P[
i]) <= 0)
k--;
2200 for (
int i =
n - 2,
t =
k + 1;
i >= 0;
i--)
2202 while (
k >=
t &&
cross(H[
k - 2], H[
k - 1], P[
i]) <= 0)
k--;
2222 template<
class ELEMENT>
2239 typedef void (*InternalHolePointUpdateFctPt)(
const unsigned&
ihole,
2242#ifdef OOMPH_HAS_TRIANGLE_LIB
2252 initialise_adaptation_data();
2255 initialise_boundary_refinement_data();
2279 initialise_adaptation_data();
2282 initialise_boundary_refinement_data();
2286#ifdef OOMPH_HAS_TRIANGLE_LIB
2301 initialise_adaptation_data();
2304 initialise_boundary_refinement_data();
2307 this->Time_stepper_pt = time_stepper_pt;
2316 this->Triangulateio_exists =
true;
2332 this->Allow_automatic_creation_of_vertices_on_boundaries =
2355 delete this->Tmp_mesh_pt;
2356 this->Tmp_mesh_pt = 0;
2368 this->set_communicator_pt(comm_pt);
2373 unsigned nb = nboundary();
2374 for (
unsigned b = 0; b <
nb; b++)
2390 Print_timings_transfering_target_areas =
true;
2397 Print_timings_transfering_target_areas =
false;
2403 Disable_projection =
false;
2409 Disable_projection =
true;
2415 Print_timings_projection =
true;
2421 Print_timings_projection =
false;
2429 return Nbin_x_for_area_transfer;
2437 return Nbin_y_for_area_transfer;
2446 return Max_sample_points_for_limited_locate_zeta_during_target_area_transfer;
2452 return Max_element_size;
2458 return Min_element_size;
2464 return Min_permitted_angle;
2471 return Use_iterative_solver_for_projection;
2478 Use_iterative_solver_for_projection =
true;
2485 Use_iterative_solver_for_projection =
false;
2497 Print_timings_level_adaptation = 0;
2518 set_print_level_timings_load_balance(
print_level);
2524 Print_timings_level_load_balance = 0;
2546 outfile <<
"Targets for mesh adaptation: " << std::endl;
2547 outfile <<
"---------------------------- " << std::endl;
2548 outfile <<
"Target for max. error: " << Max_permitted_error << std::endl;
2549 outfile <<
"Target for min. error: " << Min_permitted_error << std::endl;
2550 outfile <<
"Target min angle: " << Min_permitted_angle << std::endl;
2551 outfile <<
"Min. allowed element size: " << Min_element_size << std::endl;
2552 outfile <<
"Max. allowed element size: " << Max_element_size << std::endl;
2553 outfile <<
"Don't unrefine if less than " << Max_keep_unrefined
2554 <<
" elements need unrefinement." << std::endl;
2562 unsigned nelem = nelement();
2566 double backup = Min_element_size;
2579 Min_element_size = backup;
2587 throw OomphLibError(
"unrefine_uniformly() not implemented yet",
2603 return Mesh_update_fct_pt;
2611 return Internal_hole_point_update_fct_pt;
2617 std::map<unsigned, Vector<Node*>>::iterator
it =
2618 Sorted_shared_boundary_node_pt.find(b);
2619 if (
it == Sorted_shared_boundary_node_pt.end())
2621 std::ostringstream error_message;
2622 error_message <<
"The boundary (" << b <<
") is not marked as shared\n";
2627 return (*it).second.size();
2632 Sorted_shared_boundary_node_pt.clear();
2637 std::map<unsigned, Vector<Node*>>::iterator
it =
2638 Sorted_shared_boundary_node_pt.find(b);
2639 if (
it == Sorted_shared_boundary_node_pt.end())
2641 std::ostringstream error_message;
2642 error_message <<
"The boundary (" << b <<
") is not marked as shared\n";
2647 return (*it).second[
i];
2652 std::map<unsigned, Vector<Node*>>::iterator
it =
2653 Sorted_shared_boundary_node_pt.find(b);
2654 if (
it == Sorted_shared_boundary_node_pt.end())
2656 std::ostringstream error_message;
2657 error_message <<
"The boundary (" << b <<
") is not marked as shared\n";
2662 return (*it).second;
2669 void create_polylines_from_polyfiles(
const std::string&
node_file_name,
2675 void fill_boundary_elements_and_nodes_for_internal_boundaries();
2681 void fill_boundary_elements_and_nodes_for_internal_boundaries(
2690 if (this->is_mesh_distributed())
2694 this->fill_boundary_elements_and_nodes_for_internal_boundaries();
2698 this->reset_shared_boundary_elements_and_nodes(comm_pt);
2702 this->sort_nodes_on_shared_boundaries();
2705 this->reset_halo_haloed_scheme();
2709 this->initial_shared_boundary_id();
2719 this->identify_boundary_segments_and_assign_initial_zeta_values(b,
2722 if (this->boundary_geom_object_pt(b) != 0)
2730 this->snap_nodes_onto_geometric_objects();
2744 if (this->is_mesh_distributed())
2746 my_rank = this->communicator_pt()->my_rank();
2753 const unsigned ninternal = this->Internal_polygon_pt.
size();
2756 this->update_polygon_after_restart(
2761 const unsigned nouter = this->Outer_boundary_pt.
size();
2764 this->update_polygon_after_restart(this->Outer_boundary_pt[
i_outer]);
2770 if (this->is_mesh_distributed())
2776 this->update_shared_curve_after_restart(
2777 this->Shared_boundary_polyline_pt[
my_rank][
nc]
2787 this->update_open_curve_after_restart(this->Internal_open_curve_pt[
i]);
2801 void get_shared_boundary_elements_and_face_indexes(
2812 void create_new_shared_boundaries(
2820 void compute_shared_node_degree_helper(
2828 void create_adjacency_matrix_new_shared_edges_helper(
2836 void get_shared_boundary_segment_nodes_helper(
2845 void get_boundary_segment_nodes_helper(
2852 Do_boundary_unrefinement_constrained_by_target_areas =
true;
2857 Do_boundary_unrefinement_constrained_by_target_areas =
false;
2862 Do_boundary_refinement_constrained_by_target_areas =
true;
2867 Do_boundary_refinement_constrained_by_target_areas =
false;
2874 Do_shared_boundary_unrefinement_constrained_by_target_areas =
true;
2879 Do_shared_boundary_unrefinement_constrained_by_target_areas =
false;
2884 Do_shared_boundary_refinement_constrained_by_target_areas =
true;
2889 Do_shared_boundary_refinement_constrained_by_target_areas =
false;
2907 std::map<unsigned, std::set<Vector<double>>>::iterator
it =
2908 Boundary_connections_pt.find(b);
2910 if (
it != Boundary_connections_pt.end())
2925 const void synchronize_shared_boundary_connections();
2930 void add_vertices_for_non_deletion();
2935 void add_non_delete_vertices_from_boundary_helper(
2944 void create_temporary_boundary_connections(
2953 void restore_boundary_connections(
2963 void restore_polyline_connections_helper(
2974 void resume_boundary_connections(
2980 bool get_connected_vertex_number_on_dst_boundary(
2983 unsigned& vertex_number);
2991 bool unrefine_boundary(
const unsigned& b,
2994 double& unrefinement_tolerance,
3005 double& refinement_tolerance,
3012 bool apply_max_length_constraint(
3022 bool unrefine_boundary_constrained_by_target_area(
3026 double& unrefinement_tolerance,
3034 bool refine_boundary_constrained_by_target_area(
3037 double& refinement_tolerance,
3045 bool unrefine_shared_boundary_constrained_by_target_area(
3056 bool refine_shared_boundary_constrained_by_target_area(
3077 Do_boundary_unrefinement_constrained_by_target_areas =
true;
3078 Do_boundary_refinement_constrained_by_target_areas =
true;
3079 Do_shared_boundary_unrefinement_constrained_by_target_areas =
true;
3080 Do_shared_boundary_refinement_constrained_by_target_areas =
true;
3093 void sort_nodes_on_shared_boundaries();
3098 void reset_shared_boundary_elements_and_nodes(
3108 void reset_halo_haloed_scheme();
3117 void compute_global_node_names_and_shared_nodes(
3128 void send_boundary_node_info_of_shared_nodes(
3136 void reset_halo_haloed_scheme_helper(
3197 void get_required_elemental_information_load_balance_helper(
3242 void add_node_load_balance_helper(
3256 void get_required_nodal_information_load_balance_helper(
3264 void create_element_load_balance_helper(
3282 void add_element_load_balance_helper(
3283 const unsigned&
iproc,
3289 void add_received_node_load_balance_helper(
3307 void construct_new_node_load_balance_helper(
3345#ifdef ANNOTATE_REFINEABLE_TRIANGLE_MESH_COMMUNICATION
3365 unsigned n_haloed = this->nroot_haloed_element(
p);
3372 if (
el_pt == this->root_haloed_element_pt(
p,
eh))
3386 this->add_root_haloed_element_pt(
p,
el_pt);
3409 if (
nod_pt == this->haloed_node_pt(
p,
k))
3421 this->add_haloed_node_pt(
p,
nod_pt);
3435 void get_required_elemental_information_helper(
unsigned&
iproc,
3441 void get_required_nodal_information_helper(
unsigned&
iproc,
Node*
nod_pt);
3451 void create_halo_element(
3467 void add_halo_node_helper(
3481 void construct_new_halo_node_helper(
3497 void update_other_proc_shd_bnd_node_helper(
3532 bool update_open_curve_using_face_mesh(
3540 virtual bool surface_remesh_for_inner_hole_boundaries(
3552 void create_unsorted_face_mesh_representation(
const unsigned& boundary_id,
3559 void create_sorted_face_mesh_representation(
3560 const unsigned& boundary_id,
3589 bool update_open_curve_using_elements_area(
3595 bool update_shared_curve_using_elements_area(
3600 void update_shared_curve_after_restart(
3611 this->Nbin_x_for_area_transfer = 100;
3616 this->Nbin_y_for_area_transfer = 100;
3620 Max_sample_points_for_limited_locate_zeta_during_target_area_transfer = 5;
3623 this->Max_element_size = 1.0;
3624 this->Min_element_size = 0.001;
3625 this->Min_permitted_angle = 15.0;
3628 this->Disable_projection =
false;
3631 this->Use_iterative_solver_for_projection =
true;
3634 this->Print_timings_level_adaptation = 0;
3637 this->Print_timings_level_load_balance = 0;
3641 this->Print_timings_transfering_target_areas =
false;
3644 this->Print_timings_projection =
false;
3650 Mesh_update_fct_pt = 0;
3654 Internal_hole_point_update_fct_pt = 0;
3657#ifdef OOMPH_HAS_TRIANGLE_LIB
3675 this->Nrefinement_overruled = 0;
3679 for (std::map<unsigned, double>::iterator
it =
3680 this->Regions_areas.begin();
3681 it != this->Regions_areas.end();
3684 unsigned r = (*it).first;
3685 unsigned nel = this->nregion_element(
r);
3686 for (
unsigned e = 0;
e <
nel;
e++)
3692 unsigned nel = this->nelement();
3693 for (
unsigned e = 0;
e <
nel;
e++)
3748 this->Nrefinement_overruled++;
3772 std::map<FiniteElement*, double>::iterator
it =
3784 if (this->Nrefinement_overruled != 0)
3787 <<
"\nNOTE: Refinement of " << this->Nrefinement_overruled
3789 <<
"overruled \nbecause the target area would have "
3790 <<
"been below \nthe minimum permitted area of " << Min_element_size
3791 <<
".\nYou can change the minimum permitted area with the\n"
3792 <<
"function RefineableTriangleMesh::min_element_size().\n\n";
3861 template<
class ELEMENT>
3866#ifdef OOMPH_HAS_TRIANGLE_LIB
3907#ifdef OOMPH_HAS_TRIANGLE_LIB
3912 template<
class ELEMENT>
A class that represents a collection of data; each Data object may contain many different individual ...
Information for documentation of results: Directory and file number to enable output in the form RESL...
A general Finite Element class.
double size() const
Calculate the size of the element (length, area, volume,...) in Eulerian computational coordinates....
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
A Generalised Element class.
This class provides a GeomObject representation of a given finite element mesh. The Lagrangian coordi...
Vector< Node * > Node_pt
Vector of pointers to nodes.
static Steady< 0 > Default_TimeStepper
Default Steady Timestepper, to be used in default arguments to Mesh constructors.
bool is_mesh_distributed() const
Boolean to indicate if Mesh has been distributed.
std::map< unsigned, Vector< GeneralisedElement * > > Root_haloed_element_pt
Map of vectors holding the pointers to the root haloed elements.
Vector< Vector< FiniteElement * > > Boundary_element_pt
Vector of Vector of pointers to elements on the boundaries: Boundary_element_pt(b,...
void flush_element_and_node_storage()
Flush storage for elements and nodes by emptying the vectors that store the pointers to them....
std::map< unsigned, Vector< GeneralisedElement * > > External_haloed_element_pt
Map of vectors holding the pointers to the external haloed elements.
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...
void set_nboundary(const unsigned &nbound)
Set the number of boundaries in the mesh.
Node *& node_pt(const unsigned long &n)
Return pointer to global node n.
std::map< unsigned, Vector< Node * > > External_haloed_node_pt
Map of vectors holding the pointers to the external haloed nodes.
std::map< unsigned, Vector< GeneralisedElement * > > Root_halo_element_pt
Map of vectors holding the pointers to the root halo elements.
unsigned nboundary() const
Return number of boundaries.
void remove_boundary_nodes()
Clear all pointers to boundary nodes.
unsigned long nnode() const
Return number of nodes in the mesh.
std::map< unsigned, Vector< Node * > > Halo_node_pt
Map of vectors holding the pointers to the halo nodes.
void set_communicator_pt(OomphCommunicator *comm_pt)
Function to set communicator (mesh is assumed to be distributed if the communicator pointer is non-nu...
std::map< unsigned, Vector< Node * > > Haloed_node_pt
Map of vectors holding the pointers to the haloed nodes.
Vector< GeneralisedElement * > Element_pt
Vector of pointers to generalised elements.
OomphCommunicator * communicator_pt() const
Read-only access fct to communicator (Null if mesh is not distributed, i.e. if we don't have mpi).
std::map< unsigned, Vector< Node * > > External_halo_node_pt
Map of vectors holding the pointers to the external halo nodes.
unsigned long nelement() const
Return number of elements in the mesh.
std::map< unsigned, Vector< GeneralisedElement * > > External_halo_element_pt
External halo(ed) elements are created as and when they are needed to act as source elements for the ...
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
double & x(const unsigned &i)
Return the i-th nodal coordinate.
An oomph-lib wrapper to the MPI_Comm communicator object. Just contains an MPI_Comm object (which is ...
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....
Base class for refineable meshes. Provides standardised interfaces for the following standard mesh ad...
Unstructured refineable Triangle Mesh upgraded to solid mesh.
RefineableSolidTriangleMesh(TriangleMeshParameters &triangle_mesh_parameters, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Build mesh, based on the specifications on TriangleMeshParameter.
virtual ~RefineableSolidTriangleMesh()
Empty Destructor.
RefineableSolidTriangleMesh(const Vector< double > &target_area, TriangulateIO &triangulate_io, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper, const bool &use_attributes=false, const bool &allow_automatic_creation_of_vertices_on_boundaries=true, OomphCommunicator *comm_pt=0)
Build mesh from specified triangulation and associated target areas for elements in it.
Unstructured refineable Triangle Mesh.
void disable_iterative_solver_for_projection()
Enables the use of an iterative solver for the projection problem.
std::map< unsigned, std::set< Vector< double > > > Boundary_connections_pt
A map that stores the vertices that receive connections, they are identified by the boundary number t...
unsigned Print_timings_level_adaptation
The printing level for adaptation.
unsigned try_to_add_haloed_node_pt(const unsigned &p, Node *&nod_pt)
Check if necessary to add the node as haloed or if it has been previously added to the haloed scheme.
double compute_area_target(const Vector< double > &elem_error, Vector< double > &target_area)
Compute target area based on the element's error and the error target; return minimum angle (in degre...
void enable_timings_tranfering_target_areas()
Enables info. and timings for tranferring of target areas.
Vector< unsigned > Flat_packed_unsigneds
Vector of flat-packed unsigneds to be communicated with other processors.
virtual ~RefineableTriangleMesh()
Empty Destructor.
void set_print_level_timings_load_balance(const unsigned &print_level)
Sets the printing level of timings for load balance.
void disable_boundary_unrefinement_constrained_by_target_areas()
void initialise_adaptation_data()
Helper function to initialise data associated with adaptation.
void enable_print_timings_load_balance(const unsigned &print_level=1)
Enables printing of timings for load balance.
void update_polyline_representation_from_restart()
Method used to update the polylines representation after restart.
void initialise_boundary_refinement_data()
Set all the flags to true (the default values)
void enable_boundary_unrefinement_constrained_by_target_areas()
Enable/disable unrefinement/refinement methods for original boundaries.
void enable_timings_projection()
Enables info. and timings for projection.
bool Do_shared_boundary_unrefinement_constrained_by_target_areas
Flag that enables or disables boundary unrefinement (true by default)
double Max_element_size
Max permitted element size.
double & max_element_size()
Max element size allowed during adaptation.
void set_print_level_timings_adaptation(const unsigned &print_level)
Sets the printing level of timings for adaptation.
void disable_print_timings_load_balance()
Disables printing of timings for load balance.
unsigned try_to_add_node_pt_load_balance(Vector< Node * > &new_nodes_on_domain, Node *&node_pt)
Check if necessary to add the node to the new domain or if it has been already added.
unsigned Nbin_x_for_area_transfer
Number of bins in the x-direction when transferring target areas by bin method. Only used if we don't...
void enable_shared_boundary_unrefinement_constrained_by_target_areas()
Enable/disable unrefinement/refinement methods for shared boundaries.
void reestablish_distribution_info_for_restart(OomphCommunicator *comm_pt, std::istream &restart_file)
Used to re-establish any additional info. related with the distribution after a re-starting for trian...
unsigned try_to_add_root_haloed_element_pt(const unsigned &p, GeneralisedElement *&el_pt)
Check if necessary to add the element as haloed or if it has been previously added to the haloed sche...
unsigned & nbin_y_for_area_transfer()
Read/write access to number of bins in the y-direction when transferring target areas by bin method....
void disable_timings_projection()
Disables info. and timings for projection.
const bool boundary_connections(const unsigned &b, const unsigned &c, std::set< Vector< double > > &vertices)
Verifies if the given boundary receives a connection, and if that is the case then returns the list o...
void refine_uniformly(DocInfo &doc_info)
Refine mesh uniformly and doc process.
RefineableTriangleMesh(const Vector< double > &target_area, TriangulateIO &triangulate_io, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper, const bool &use_attributes=false, const bool &allow_automatic_creation_of_vertices_on_boundaries=true, OomphCommunicator *comm_pt=0)
Build mesh from specified triangulation and associated target areas for elements in it NOTE: This is ...
MeshUpdateFctPt Mesh_update_fct_pt
Function pointer to function that updates the mesh following the snapping of boundary nodes to the bo...
void enable_print_timings_adaptation(const unsigned &print_level=1)
Enables printing of timings for adaptation.
void disable_boundary_refinement_constrained_by_target_areas()
unsigned Counter_for_flat_packed_unsigneds
Counter used when processing vector of flat-packed unsigneds.
unsigned Counter_for_flat_packed_doubles
Counter used when processing vector of flat-packed doubles.
InternalHolePointUpdateFctPt Internal_hole_point_update_fct_pt
Function pointer to function that can be set to update the position of the central point in internal ...
void disable_projection()
Disables the solution projection step during adaptation.
unsigned try_to_add_element_pt_load_balance(Vector< FiniteElement * > &new_elements_on_domain, FiniteElement *&ele_pt)
Check if necessary to add the element to the new domain or if it has been previously added.
void enable_boundary_refinement_constrained_by_target_areas()
bool Use_iterative_solver_for_projection
Flag to indicate whether to use or not an iterative solver (CG with diagonal preconditioned) for the ...
unsigned max_sample_points_for_limited_locate_zeta_during_target_area_transfer()
Read/write access to number of sample points from which we try to locate zeta by Newton method when t...
void disable_shared_boundary_unrefinement_constrained_by_target_areas()
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.
double & min_element_size()
Min element size allowed during adaptation.
bool Disable_projection
Enable/disable solution projection during adaptation.
double Min_permitted_angle
Min angle before remesh gets triggered.
void disable_shared_boundary_refinement_constrained_by_target_areas()
RefineableTriangleMesh(TriangleMeshParameters &triangle_mesh_parameters, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Build mesh, based on the specifications on TriangleMeshParameters.
bool Do_boundary_unrefinement_constrained_by_target_areas
Flag that enables or disables boundary unrefinement (true by default)
InternalHolePointUpdateFctPt & internal_hole_point_update_fct_pt()
Access to function pointer to can be used to generate the internal point for the ihole-th hole.
void doc_adaptivity_targets(std::ostream &outfile)
Doc the targets for mesh adaptation.
unsigned Max_sample_points_for_limited_locate_zeta_during_target_area_transfer
Default value for max. number of sample points used for locate_zeta when transferring target areas us...
Node * sorted_shared_boundary_node_pt(unsigned &b, unsigned &i)
void enable_projection()
Enables the solution projection step during adaptation.
void enable_iterative_solver_for_projection()
Enables the use of an iterative solver for the projection problem.
void disable_print_timings_adaptation()
Disables printing of timings for adaptation.
bool Do_boundary_refinement_constrained_by_target_areas
Flag that enables or disables boundary refinement (true by default)
std::map< unsigned, Vector< Node * > > Sorted_shared_boundary_node_pt
Stores the nodes in the boundaries in the same order in all the processors Sorted_shared_boundary_nod...
double Min_element_size
Min permitted element size.
bool Do_shared_boundary_refinement_constrained_by_target_areas
Flag that enables or disables boundary unrefinement (true by default)
MeshUpdateFctPt & mesh_update_fct_pt()
Access to function pointer to function that updates the mesh following the snapping of boundary nodes...
bool Print_timings_projection
Enable/disable printing timings for projection.
void disable_timings_tranfering_target_areas()
Disables info. and timings for tranferring of target areas.
double & min_permitted_angle()
Min angle before remesh gets triggered.
Vector< Node * > sorted_shared_boundary_node_pt(unsigned &b)
bool Print_timings_transfering_target_areas
Enable/disable printing timings for transfering target areas.
void flush_sorted_shared_boundary_node()
unsigned Print_timings_level_load_balance
The printing level for load balance.
unsigned nsorted_shared_boundary_node(unsigned &b)
unsigned & nbin_x_for_area_transfer()
Read/write access to number of bins in the x-direction when transferring target areas by bin method....
void enable_shared_boundary_refinement_constrained_by_target_areas()
bool use_iterative_solver_for_projection()
unsigned unrefine_uniformly()
Unrefine mesh uniformly: Return 0 for success, 1 for failure (if unrefinement has reached the coarses...
unsigned Nbin_y_for_area_transfer
Number of bins in the y-direction when transferring target areas by bin method. Only used if we don't...
Vector< double > Flat_packed_doubles
Vector of flat-packed doubles to be communicated with other processors.
Vector< std::string > Flat_packed_unsigneds_string
Temporary vector of strings to enable full annotation of RefineableTriangleMesh comms.
void set_lagrangian_nodal_coordinates()
Make the current configuration the undeformed one by setting the nodal Lagrangian coordinates to thei...
Unstructured Triangle Mesh upgraded to solid mesh.
SolidTriangleMesh(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...
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)
virtual ~SolidTriangleMesh()
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...
Base class for triangle meshes (meshes made of 2D triangle elements). Note: we choose to template Tri...
TriangulateIO Triangulateio
TriangulateIO representation of the mesh.
Base class defining a closed curve for the Triangle mesh generation.
Base class defining an open curve for the Triangle mesh generation Basically used to define internal ...
Helper object for dealing with the parameters used for the TriangleMesh objects.
TriangleMeshClosedCurve * outer_boundary_pt(const unsigned &i) const
Helper function for getting the i-th outer boundary.
bool Boundary_refinement
Do not allow refinement of nodes on the boundary.
bool is_automatic_creation_of_vertices_on_boundaries_allowed()
Returns the status of the variable Allow_automatic_creation_of_vertices_on_boundaries.
Vector< TriangleMeshClosedCurve * > outer_boundary_pt() const
Helper function for getting the outer boundary.
TriangleMeshParameters(Vector< TriangleMeshClosedCurve * > &outer_boundary_pt)
Constructor: Only takes the outer boundary, all the other parameters are stated with the specific par...
Vector< Vector< double > > & extra_holes_coordinates()
Helper function for getting access to the extra holes.
Vector< TriangleMeshClosedCurve * > & internal_closed_curve_pt()
Helper function for getting access to the internal closed boundaries.
virtual ~TriangleMeshParameters()
Empty destructor.
void set_target_area_for_region(const unsigned &i, const double &area)
Helper function to specify target area for region.
bool is_mesh_distributed() const
Boolean to indicate if Mesh has been distributed.
bool is_use_attributes() const
Helper function for getting the status of use_attributes variable.
void enable_use_attributes()
Helper function for enabling the use of attributes.
void disable_use_attributes()
Helper function for disabling the use of attributes.
double element_area() const
Helper function for getting the element area.
void disable_automatic_creation_of_vertices_on_boundaries()
Disables the creation of points (by Triangle) on the outer and internal boundaries.
bool Internal_boundary_refinement
Do not allow refinement of nodes on the internal boundary.
void enable_automatic_creation_of_vertices_on_boundaries()
Enables the creation of points (by Triangle) on the outer and internal boundaries.
void disable_internal_boundary_refinement()
Helper function for disabling the use of boundary refinement.
TriangleMeshParameters(TriangleMeshClosedCurve *outer_boundary_pt)
Constructor: Only takes the outer boundary, all the other parameters are stated with the specific par...
std::map< unsigned, double > & target_area_for_region()
Helper function for getting access to the region's target areas.
std::map< unsigned, Vector< double > > Regions_coordinates
Store the coordinates for defining extra regions The key on the map is the region id.
OomphCommunicator * communicator_pt() const
Read-only access fct to communicator (Null if mesh is not distributed)
void add_region_coordinates(const unsigned &i, Vector< double > ®ion_coordinates)
Helper function for getting the extra regions.
std::map< unsigned, Vector< double > > & regions_coordinates()
Helper function for getting access to the regions coordinates.
Vector< TriangleMeshClosedCurve * > internal_closed_curve_pt() const
Helper function for getting the internal closed boundaries.
TriangleMeshParameters()
Constructor: Takes nothing and initializes the other parameters to the default ones.
Vector< TriangleMeshOpenCurve * > & internal_open_curves_pt()
Helper function for getting access to the internal open boundaries.
Vector< Vector< double > > extra_holes_coordinates() const
Helper function for getting the extra holes.
Vector< TriangleMeshClosedCurve * > Internal_closed_curve_pt
Internal closed boundaries.
void set_communicator_pt(OomphCommunicator *comm_pt)
Function to set communicator (mesh is then assumed to be distributed)
Vector< Vector< double > > Extra_holes_coordinates
Store the coordinates for defining extra holes.
Vector< TriangleMeshClosedCurve * > & outer_boundary_pt()
Helper function for getting access to the outer boundary.
double & element_area()
Helper function for getting access to the element area.
Vector< TriangleMeshClosedCurve * > Outer_boundary_pt
The outer boundary.
bool Allow_automatic_creation_of_vertices_on_boundaries
Allows automatic creation of vertices along boundaries by Triangle.
TriangleMeshClosedCurve *& outer_boundary_pt(const unsigned &i)
Helper function for getting access to the i-th outer boundary.
std::map< unsigned, double > Regions_areas
Target areas for regions; defaults to 0.0 which (luckily) implies "no specific target area" for trian...
bool Use_attributes
Define the use of attributes (regions)
OomphCommunicator * Comm_pt
Pointer to communicator – set to NULL if mesh is not distributed Required to pass it to new distribut...
void enable_internal_boundary_refinement()
Helper function for enabling the use of boundary refinement.
void disable_boundary_refinement()
Helper function for disabling the use of boundary refinement.
bool is_boundary_refinement_allowed() const
Helper function for getting the status of boundary refinement.
void enable_boundary_refinement()
Helper function for enabling the use of boundary refinement.
bool is_internal_boundary_refinement_allowed() const
Helper function for getting the status of boundary refinement.
Vector< TriangleMeshOpenCurve * > internal_open_curves_pt() const
Helper function for getting the internal open boundaries.
Vector< TriangleMeshOpenCurve * > Internal_open_curves_pt
Internal boundaries.
double Element_area
The element are when calling triangulate external routine.
Class defining a polyline for use in Triangle Mesh generation.
Class defining a closed polygon for the Triangle mesh generation.
Triangle mesh build with the help of the scaffold mesh coming from the triangle mesh generator Triang...
void flush_shared_boundary_element()
TimeStepper * Time_stepper_pt
Timestepper used to build elements.
const unsigned nshared_boundary_element(const unsigned &b)
const int check_connections_of_polyline_nodes(std::set< FiniteElement * > &element_in_processor_pt, const int &root_edge_bnd_id, std::map< std::pair< Node *, Node * >, bool > &overlapped_face, std::map< unsigned, std::map< Node *, bool > > &node_on_bnd_not_overlapped_by_shd_bnd, std::list< Node * > ¤t_polyline_nodes, std::map< unsigned, std::list< Node * > > &shared_bnd_id_to_sorted_list_node_pt, const unsigned &node_degree, Node *&new_node_pt, const bool called_from_load_balance=false)
Check for any possible connections that the array of sorted nodes have with any previous boundaries o...
std::map< unsigned, Vector< unsigned > > & shared_boundary_from_processors()
Return the association of the shared boundaries with the processors.
Vector< Vector< Vector< unsigned > > > Shared_boundaries_ids
Stores the boundaries ids created by the interaction of two processors Shared_boundaries_ids[iproc][j...
TriangleScaffoldMesh * Tmp_mesh_pt
Temporary scaffold mesh.
Vector< Vector< Vector< unsigned > > > & shared_boundaries_ids()
bool is_node_on_shared_boundary(const unsigned &b, Node *const &node_pt)
Is the node on the shared boundary.
bool Use_attributes
Boolean flag to indicate whether to use attributes or not (required for multidomain meshes)
void compute_boundary_segments_connectivity_and_initial_zeta_values(const unsigned &b)
Compute the boundary segments connectivity for those boundaries that were splited during the distribu...
std::map< unsigned, unsigned > Shared_boundary_overlaps_internal_boundary
Stores information about those shared boundaries that lie over or over a segment of an internal bound...
void break_loops_on_shared_polyline_helper(const unsigned &initial_shd_bnd_id, std::list< Node * > &input_nodes, Vector< FiniteElement * > &input_boundary_element_pt, Vector< int > &input_face_index_element, const int &input_connect_to_the_left, const int &input_connect_to_the_right, Vector< std::list< Node * > > &output_sorted_nodes_pt, Vector< Vector< FiniteElement * > > &output_boundary_element_pt, Vector< Vector< int > > &output_face_index_element, Vector< int > &output_connect_to_the_left, Vector< int > &output_connect_to_the_right)
Break any possible loop created by the sorted list of nodes that is used to create a new shared polyl...
void build_triangulateio(const std::string &poly_file_name, TriangulateIO &triangulate_io, bool &use_attributes)
Helper function to create TriangulateIO object (return in triangulate_io) from the ....
virtual ~TriangleMesh()
Destructor.
void create_shared_boundaries(OomphCommunicator *comm_pt, const Vector< unsigned > &element_domain, const Vector< GeneralisedElement * > &backed_up_el_pt, const Vector< FiniteElement * > &backed_up_f_el_pt, std::map< Data *, std::set< unsigned > > &processors_associated_with_data, const bool &overrule_keep_as_halo_element_status)
Creates the shared boundaries.
const bool boundary_was_splitted(const unsigned &b)
Helper function to verify if a given boundary was splitted in the distribution process.
Vector< unsigned > oomph_vertex_nodes_id()
Return the vector that contains the oomph-lib node number for all vertex nodes in the TriangulateIO r...
void flush_shared_boundary_node(const unsigned &b)
Flush the boundary nodes associated to the shared boundary b.
void create_shared_polylines_connections()
Establish the connections of the polylines previously marked as having connections....
std::map< unsigned, double > Regions_areas
Target areas for regions; defaults to 0.0 which (luckily) implies "no specific target area" for trian...
void update_triangulateio()
Update the triangulateio object to the current nodal positions.
const unsigned initial_shared_boundary_id()
The initial boundary id for shared boundaries.
Vector< Vector< unsigned > > & shared_boundaries_ids(const unsigned &p)
unsigned Initial_shared_boundary_id
The initial boundary id for shared boundaries.
FiniteElement * shared_boundary_element_pt(const unsigned &b, const unsigned &e)
const unsigned shared_boundaries_ids(const unsigned &p, const unsigned &q, const unsigned &i) const
void break_loops_on_shared_polyline_load_balance_helper(const unsigned &initial_shd_bnd_id, std::list< Node * > &input_nodes, Vector< FiniteElement * > &input_boundary_element_pt, Vector< FiniteElement * > &input_boundary_face_element_pt, Vector< int > &input_face_index_element, const int &input_connect_to_the_left, const int &input_connect_to_the_right, Vector< std::list< Node * > > &output_sorted_nodes_pt, Vector< Vector< FiniteElement * > > &output_boundary_element_pt, Vector< Vector< FiniteElement * > > &output_boundary_face_element_pt, Vector< Vector< int > > &output_face_index_element, Vector< int > &output_connect_to_the_left, Vector< int > &output_connect_to_the_right)
Break any possible loop created by the sorted list of nodes that is used to create a new shared polyl...
void shared_boundaries_in_this_processor(Vector< unsigned > &shared_boundaries_in_this_processor)
Get the shared boundaries ids living in the current processor.
void synchronize_boundary_coordinates(const unsigned &b)
In charge of sinchronize the boundary coordinates for internal boundaries that were split as part of ...
void compute_holes_left_by_halo_elements_helper(Vector< Vector< double > > &output_holes_coordinates)
Compute the holes left by the halo elements, those adjacent to the shared boundaries.
void identify_boundary_segments_and_assign_initial_zeta_values(const unsigned &b, Vector< FiniteElement * > &input_face_ele_pt, const bool &is_internal_boundary, std::map< FiniteElement *, FiniteElement * > &face_to_bulk_element_pt)
Identify the segments from the old mesh (original mesh) in the new mesh (this) and assign initial and...
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 routines. Generally used after load bala...
std::map< unsigned, Vector< int > > Face_index_at_shared_boundary
For the e-th finite element on shared boundary b, this is the index of the face that lies along that ...
std::map< unsigned, Vector< unsigned > > Shared_boundary_from_processors
Stores the processors involved in the generation of a shared boundary, in 2D two processors give rise...
const bool shared_boundary_overlaps_internal_boundary(const unsigned &shd_bnd_id)
Checks if the shared boundary overlaps an internal boundary.
const unsigned nshared_boundary_node(const unsigned &b)
std::map< unsigned, Vector< TriangleMeshPolyLine * > > Boundary_subpolylines
The polylines that will temporary represent the boundary that was splitted in the distribution proces...
const unsigned nshared_boundary_overlaps_internal_boundary()
Get the number of shared boundaries overlaping internal boundaries.
Vector< Vector< Node * > > & boundary_segment_node_pt(const unsigned &b)
Return direct access to nodes associated with a boundary but sorted in segments.
void flush_shared_boundary_element(const unsigned &b)
const unsigned nshared_boundary_polyline(const unsigned &p, const unsigned &c) const
void add_shared_boundary_node(const unsigned &b, Node *node_pt)
Add the node the shared boundary.
const unsigned nshared_boundary_curves(const unsigned &p) const
Vector< unsigned > & shared_boundary_from_processors(const unsigned &b)
std::map< unsigned, bool > Boundary_was_splitted
Flag to indicate if a polyline has been splitted during the distribution process, the boundary id of ...
const unsigned read_unsigned_line_helper(std::istream &read_file)
bool Triangulateio_exists
Boolean defining if Triangulateio object has been built or not.
Vector< Vector< Vector< unsigned > > > shared_boundaries_ids() const
std::map< unsigned, unsigned > & shared_boundary_overlaps_internal_boundary()
Gets the storage that indicates if a shared boundary is part of an internal boundary.
void re_scale_re_assigned_initial_zeta_values_for_internal_boundary(const unsigned &b)
Re-scale the re-assigned zeta values for the boundary nodes, apply only for internal boundaries.
void create_shared_polyline(const unsigned &my_rank, const unsigned &shd_bnd_id, const unsigned &iproc, const unsigned &jproc, std::list< Node * > &sorted_nodes, const int &root_edge_bnd_id, Vector< FiniteElement * > &bulk_bnd_ele_pt, Vector< int > &face_index_ele, Vector< Vector< TriangleMeshPolyLine * > > &unsorted_polylines_pt, const int &connect_to_the_left_flag, const int &connect_to_the_right_flag)
Create the shared polyline and fill the data structured that keep all the information associated with...
const unsigned nshared_boundaries(const unsigned &p, const unsigned &q) const
Access functions to boundaries shared with processors.
Vector< Vector< double > > Original_extra_holes_coordinates
Backup the original extra holes coordinates.
virtual void load_balance(const Vector< unsigned > &target_domain_for_local_non_halo_element)
Virtual function to perform the load balance routines.
void update_holes_information_helper(Vector< TriangleMeshPolygon * > &polygons_pt, Vector< Vector< double > > &output_holes_coordinates)
Keeps those vertices that define a hole, those that are inside closed internal boundaries in the new ...
std::map< unsigned, Vector< Node * > > Shared_boundary_node_pt
Stores the boundary nodes adjacent to the shared boundaries, these nodes are a subset of the halo and...
void create_distributed_domain_representation(Vector< TriangleMeshPolygon * > &polygons_pt, Vector< TriangleMeshOpenCurve * > &open_curves_pt)
Creates the distributed domain representation. Joins the original boundaires, shared boundaries and c...
Node * shared_boundary_node_pt(const unsigned &b, const unsigned &n)
void add_shared_boundary_element(const unsigned &b, FiniteElement *ele_pt)
void build_from_scaffold(TimeStepper *time_stepper_pt, const bool &use_attributes)
Build mesh from scaffold.
coord2_t cross(const Point &O, const Point &A, const Point &B)
2D cross product of OA and OB vectors, i.e. z-component of their 3D cross product....
void operator=(const TriangleMesh &)=delete
Broken assignment operator.
void sort_polylines_helper(Vector< TriangleMeshPolyLine * > &unsorted_polylines_pt, Vector< Vector< TriangleMeshPolyLine * > > &sorted_polylines_pt)
Sorts the polylines so they be continuous and then we can create a closed or open curve from them.
Vector< Vector< Vector< TriangleMeshPolyLine * > > > Shared_boundary_polyline_pt
Stores the polyline representation of the shared boundaries Shared_boundary_polyline_pt[iproc][ncurve...
Vector< Vector< unsigned > > shared_boundaries_ids(const unsigned &p) const
TriangleMesh(TriangleMeshParameters &triangle_mesh_parameters, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Build mesh, based on the specifications on TriangleMeshParameters.
void create_tmp_open_curves_helper(Vector< Vector< TriangleMeshPolyLine * > > &sorted_open_curves_pt, Vector< TriangleMeshPolyLine * > &unsorted_shared_to_internal_poly_pt, Vector< TriangleMeshOpenCurve * > &open_curves_pt)
Take the polylines from the original open curves and created new temporaly representations of open cu...
const unsigned nshared_boundaries() const
void remesh_from_internal_triangulateio()
Completely regenerate the mesh from the trianglateio structure.
Node *& boundary_segment_node_pt(const unsigned &b, const unsigned &s, const unsigned &n)
Return pointer to node n on boundary b.
std::vector< Point > convex_hull(std::vector< Point > P)
Returns a list of points on the convex hull in counter-clockwise order. Note: the last point in the r...
Vector< unsigned > Oomph_vertex_nodes_id
Vector storing oomph-lib node number for all vertex nodes in the TriangulateIO representation of the ...
TriangleMesh(const std::string &poly_file_name, const double &element_area, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper, const bool &allow_automatic_creation_of_vertices_on_boundaries=true)
Build mesh from poly file, with specified target area for all elements.
const unsigned final_shared_boundary_id()
The final boundary id for shared boundaries.
Vector< TriangleMeshPolyLine * > & shared_boundary_polyline_pt(const unsigned &p, const unsigned &c)
virtual void reestablish_distribution_info_for_restart(OomphCommunicator *comm_pt, std::istream &restart_file)
Virtual function used to re-establish any additional info. related with the distribution after a re-s...
void get_halo_elements_on_all_procs(const unsigned &nproc, const Vector< unsigned > &element_domain, const Vector< GeneralisedElement * > &backed_up_el_pt, std::map< Data *, std::set< unsigned > > &processors_associated_with_data, const bool &overrule_keep_as_halo_element_status, std::map< GeneralisedElement *, unsigned > &element_to_global_index, Vector< Vector< Vector< GeneralisedElement * > > > &output_halo_elements_pt)
Creates the halo elements on all processors Gets the halo elements on all processors,...
const unsigned nboundary_subpolylines(const unsigned &b)
Gets the number of subpolylines that create the boundarya (useful only when the boundary is marked as...
const unsigned shared_boundary_overlapping_internal_boundary(const unsigned &shd_bnd_id)
Gets the boundary id of the internal boundary that the shared boundary lies on.
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...
TriangleMesh(const TriangleMesh &dummy)=delete
Broken copy constructor.
bool First_time_compute_holes_left_by_halo_elements
Flag to know if it is the first time we are going to compute the holes left by the halo elements.
void dump_distributed_info_for_restart(std::ostream &dump_file)
Used to dump info. related with distributed triangle meshes.
void re_assign_initial_zeta_values_for_internal_boundary(const unsigned &b, Vector< std::list< FiniteElement * > > &old_segment_sorted_ele_pt, std::map< FiniteElement *, bool > &old_is_inverted)
Re-assign the boundary segments initial zeta (arclength) value for those internal boundaries that wer...
const bool boundary_marked_as_shared_boundary(const unsigned &b, const unsigned &isub)
Returns the value that indicates if a subpolyline of a given boundary continues been used as internal...
Vector< unsigned > shared_boundaries_ids(const unsigned &p, const unsigned &q) const
void set_mesh_level_time_stepper(TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
Overload set_mesh_level_time_stepper so that the stored time stepper now corresponds to the new times...
unsigned Final_shared_boundary_id
The final boundary id for shared boundaries.
void read_distributed_info_for_restart(std::istream &restart_file)
Used to read info. related with distributed triangle meshes.
void select_boundary_face_elements(Vector< FiniteElement * > &face_el_pt, const unsigned &b, bool &is_internal_boundary, std::map< FiniteElement *, FiniteElement * > &face_to_bulk_element_pt)
Select face element from boundary using the criteria to decide which of the two face elements should ...
void create_polylines_from_halo_elements_helper(const Vector< unsigned > &element_domain, std::map< GeneralisedElement *, unsigned > &element_to_global_index, std::set< FiniteElement * > &element_in_processor_pt, Vector< Vector< Vector< GeneralisedElement * > > > &input_halo_elements, std::map< std::pair< Node *, Node * >, unsigned > &elements_edges_on_boundary, Vector< Vector< Vector< TriangleMeshPolyLine * > > > &output_polylines_pt)
Creates polylines from the intersection of halo elements on all processors. The new polylines define ...
void output_boundary_coordinates(const unsigned &b, std::ostream &outfile)
Output the nodes on the boundary and their respective boundary coordinates(into separate tecplot zone...
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.
std::map< unsigned, std::vector< bool > > Boundary_marked_as_shared_boundary
Flag to indicate if an internal boundary will be used as shared boundary because there is overlapping...
void create_tmp_polygons_helper(Vector< Vector< TriangleMeshPolyLine * > > &polylines_pt, Vector< TriangleMeshPolygon * > &polygons_pt)
Take the polylines from the shared boundaries and create temporary polygon representations of the dom...
void flush_face_index_at_shared_boundary()
void add_face_index_at_shared_boundary(const unsigned &b, const unsigned &i)
void flush_shared_boundary_polyline_pt()
int face_index_at_shared_boundary(const unsigned &b, const unsigned &e)
void flush_shared_boundary_node()
Flush ALL the shared boundary nodes.
void get_shared_boundaries_overlapping_internal_boundary(const unsigned &internal_bnd_id, Vector< unsigned > &shd_bnd_ids)
Gets the shared boundaries ids that overlap the given internal boundary.
bool triangulateio_exists()
Boolean defining if Triangulateio object has been built or not.
void update_triangulateio(Vector< Vector< double > > &internal_point)
Update the TriangulateIO object to the current nodal position and the centre hole coordinates.
Vector< TriangleMeshPolyLine * > & boundary_subpolylines(const unsigned &b)
Gets the vector of auxiliar polylines that will represent the given boundary (useful only when the bo...
void get_element_edges_on_boundary(std::map< std::pair< Node *, Node * >, unsigned > &element_edges_on_boundary)
Get the element edges (pair of nodes, edges) that lie on a boundary (used to mark shared boundaries t...
TriangleMesh()
Empty constructor.
Vector< Node * > & boundary_segment_node_pt(const unsigned &b, const unsigned &s)
Return direct access to nodes associated with a segment of a given boundary.
Vector< unsigned > & shared_boundaries_ids(const unsigned &p, const unsigned &q)
std::map< unsigned, Vector< FiniteElement * > > Shared_boundary_element_pt
Stores the boundary elements adjacent to the shared boundaries, these elements are a subset of the ha...
TriangleMeshPolyLine * shared_boundary_polyline_pt(const unsigned &p, const unsigned &c, const unsigned &i) const
Triangle Mesh that is based on input files generated by the triangle mesh generator Triangle.
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< Vector< Node * > > > Boundary_segment_node_pt
Used to store the nodes associated to a boundary and to an specific segment (this only applies in dis...
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...
Vector< std::map< unsigned, Vector< FiniteElement * > > > Boundary_region_element_pt
Storage for elements adjacent to a boundary in a particular region.
Vector< double > Region_attribute
Vector of attributes associated with the elements in each region.
Vector< std::map< unsigned, Vector< int > > > Face_index_region_at_boundary
Storage for the face index adjacent to a boundary in a particular region.
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::map< unsigned, Vector< std::pair< double, double > > > Polygonal_vertex_arclength_info
Storage for pairs of doubles representing: .first: the arclength along the polygonal representation o...
std::set< TriangleMeshPolygon * > Free_polygon_pt
A set that contains the polygons created by this object therefore it is necessary to free their assoc...
std::map< unsigned, Vector< FiniteElement * > > Region_element_pt
Vector of elements in each region differentiated by attribute (the key of the map is the attribute)
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....
std::map< unsigned, TriangleMeshCurveSection * > Boundary_curve_section_pt
A map that stores the associated curve section of the specified boundary id.
A slight extension to the standard template vector class so that we can include "graceful" array rang...
const double Pi
50 digits from maple
void create_triangulateio_from_polyfiles(const std::string &node_file_name, const std::string &element_file_name, const std::string &poly_file_name, TriangulateIO &triangle_io, bool &use_attributes)
Create a triangulateio data file from ele node and poly files. This is used if the mesh is generated ...
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)
OomphInfo oomph_info
Single (global) instantiation of the OomphInfo object – this is used throughout the library as a "rep...
bool operator<(const Point &p) const
The Triangle data structure, modified from the triangle.h header supplied with triangle 1....
double * pointlist
Pointer to list of points x coordinate followed by y coordinate.