8 #ifndef COMMON_INTERSECTIONS_PARALLEL_PATCH_CONSTRUCTION_H_
9 #define COMMON_INTERSECTIONS_PARALLEL_PATCH_CONSTRUCTION_H_
47 const libMesh::Parallel::Communicator&
m_comm;
142 Patch_construction(libMesh::Mesh & mesh,
const libMesh::Parallel::Communicator& local_comm,
bool debugOutput =
false) :
143 m_comm { mesh.comm() },
144 m_nodes { m_comm.size() },
145 m_rank { m_comm.rank() },
146 m_local_comm { local_comm },
147 m_Mesh_parent { mesh },
148 m_Mesh_patch { libMesh::ReplicatedMesh(m_local_comm) },
150 m_bPrintDebug { debugOutput }
152 m_Parent_Point_Locator = m_Mesh_parent.sub_point_locator();
155 m_Parent_Point_Locator->enable_out_of_mesh_mode();
157 m_working_element_id = 0;
158 m_bTestNeighsForNewPairs =
true;
160 m_Patch_Elem_indexes.reserve(m_Mesh_parent.n_elem());
161 m_Patch_Node_indexes.reserve(m_Mesh_parent.n_nodes());
170 const libMesh::Elem *
elem(
unsigned int idx);
182 void BuildPatch(
const libMesh::Elem * Query_elem);
libMesh::ReplicatedMesh m_Mesh_patch
Patch mesh.
std::unordered_map< unsigned int, int > m_node_map_Patch_to_Parent
Mapping between the patch and parent mesh nodes, using the former as keys.
std::unordered_set< unsigned int > & node_indexes()
Returns the set of nodes inside the patch.
std::unordered_set< unsigned int > m_Patch_Elem_indexes
Set of elements inside the patch.
std::unordered_map< unsigned int, int > m_element_already_treated
[ADV. FRONT] Marks if an element was already treated or not
void set_elem_as_inside_queue(unsigned int elem_id)
[ADV. FRONT] Mark element as already inside the deque of elements to be treated.
std::unordered_map< unsigned int, int > m_node_map_Parent_to_Patch
Mapping between the parent and patch mesh nodes, using the former as keys.
Class used to build a mesh patch from a parent mesh and an coupling mesh element. ...
void export_patch_mesh(std::string &filename_base)
Export the patch mesh to a file.
void insert_patch_element(const libMesh::Elem *Patch_elem)
Insert an parent mesh element inside the patch, updating the data structures.
const libMesh::Elem * current_elem_pointer()
unsigned int intersection_queue_extract_front_elem()
[ADV. FRONT] Pop and returns the first element to be treated.
libMesh::ReplicatedMesh & parent_mesh()
Returns the parent mesh.
unsigned int FrontSearch_prepare_for_probed_test()
[ADV. FRONT] Reset the advancing front search data structures, with the exception of list of elements...
std::unordered_map< unsigned int, std::unordered_set< unsigned int > > & patch_elem_neighbours()
Returns the patch mesh element neighbour table.
bool intersection_queue_empty()
[ADV. FRONT] Check if deque of elements to be treated is empty.
Intersection_Tools m_Intersection_Test
Intersection search and construction tools.
const unsigned int m_nodes
Parent mesh number of processors.
const libMesh::Parallel::Communicator & m_local_comm
Patch mesh communicator.
bool test_queue_empty()
[ADV. FRONT] Check if deque of elements to be tested is empty.
std::unordered_set< unsigned int > & elem_indexes()
Returns the set of elements inside the patch.
libMesh::ReplicatedMesh & patch_mesh()
Returns the patch mesh.
libMesh::ReplicatedMesh & m_Mesh_parent
Parent mesh.
const libMesh::Elem * elem(unsigned int idx)
std::unordered_map< unsigned int, std::unordered_set< unsigned int > > m_Patch_Elem_Neighbours
Element neighbour table for the patch.
Patch_construction(libMesh::Mesh &mesh, const libMesh::Parallel::Communicator &local_comm, bool debugOutput=false)
Constructor with a pre-defined parent mesh and a local communicator.
std::unordered_map< unsigned int, int > m_element_inside_intersection_queue
[ADV. FRONT] Marks if an element is already inside "m_element_intersection_queue" ...
const libMesh::Parallel::Communicator & m_comm
Parent mesh communicator.
unsigned int convert_patch_to_parent_elem_id(unsigned int input)
Convert an element index from the patch mesh to the parent mesh.
std::unordered_set< unsigned int > m_Patch_Node_indexes
Set of nodes inside the patch.
void BuildPatch(const libMesh::Elem *Query_elem)
Build the patch mesh covering a given "Query_elem".
bool set_neighbors_to_search_next_pairs()
[ADV. FRONT] Set the list of neighbors of the current element that must be tested yet...
void set_elem_as_treated(unsigned int elem_id)
[ADV. FRONT] Mark element as already treated.
bool m_bTestNeighsForNewPairs
!!!
void add_neighbors_to_test_list()
[ADV. FRONT] Adds element to test list.
std::unique_ptr< libMesh::PointLocatorBase > m_Parent_Point_Locator
Parent mesh point locator.
unsigned int test_queue_extract_front_elem()
[ADV. FRONT] Pop and returns the first element to be tested.
std::deque< int > m_element_intersection_queue
[ADV. FRONT] Deque containing the elements to be treated.
void FrontSearch_reset()
[ADV. FRONT] Reset the advancing front search data structures, with the exception of list of elements...
unsigned int size()
Returns the number of elements inside the patch.
unsigned int m_working_element_id
[ADV. FRONT] Index of the patch element currently being tested
std::deque< int > m_element_test_queue
[ADV. FRONT] Deque containing the elements to be tested
bool m_bPrintDebug
Print debug information? Default: false.
void intersection_queue_push_back(unsigned int elem_id)
[ADV. FRONT] Push back element to the deque containing the elements to be treated.
std::unordered_set< unsigned int > m_element_neighbours_to_search
[ADV. FRONT] Set containing the current element's neighbors that must be tested yet.
unsigned int current_elem_id()
void build_patch_mesh()
Build a patch mesh from the patch data structures.
std::unordered_map< unsigned int, int > m_elem_map_Patch_to_Parent
Mapping between the patch and parent mesh elements, using the former as keys.
unsigned int convert_parent_to_patch_elem_id(unsigned int input)
Convert an element index from the parent mesh to the patch mesh.
const unsigned int m_rank
Parent mesh processor rank.
std::unordered_map< unsigned int, int > m_elem_map_Parent_to_Patch
Mapping between the parent and patch mesh elements, using the former as keys.
void FrontSearch_initialize()
[ADV. FRONT] Initialize the advancing front search data structures.
std::unordered_set< unsigned int > & neighbors_to_search_next_pair()
[ADV. FRONT] Returns the current element's neighbors that must be tested yet.