CArl
Code Arlequin / C++ implementation
|
Class used to build a mesh patch from a parent mesh and an coupling mesh element. More...
#include <patch_construction.h>
Public Member Functions | |
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. More... | |
libMesh::ReplicatedMesh & | parent_mesh () |
Returns the parent mesh. More... | |
libMesh::ReplicatedMesh & | patch_mesh () |
Returns the patch mesh. More... | |
std::unordered_set< unsigned int > & | elem_indexes () |
Returns the set of elements inside the patch. More... | |
std::unordered_set< unsigned int > & | node_indexes () |
Returns the set of nodes inside the patch. More... | |
unsigned int | size () |
Returns the number of elements inside the patch. More... | |
const libMesh::Elem * | elem (unsigned int idx) |
std::unordered_map< unsigned int, std::unordered_set< unsigned int > > & | patch_elem_neighbours () |
Returns the patch mesh element neighbour table. More... | |
void | BuildPatch (const libMesh::Elem *Query_elem) |
Build the patch mesh covering a given "Query_elem". More... | |
unsigned int | convert_parent_to_patch_elem_id (unsigned int input) |
Convert an element index from the parent mesh to the patch mesh. More... | |
unsigned int | convert_patch_to_parent_elem_id (unsigned int input) |
Convert an element index from the patch mesh to the parent mesh. More... | |
void | export_patch_mesh (std::string &filename_base) |
Export the patch mesh to a file. More... | |
unsigned int | current_elem_id () |
const libMesh::Elem * | current_elem_pointer () |
void | intersection_queue_push_back (unsigned int elem_id) |
[ADV. FRONT] Push back element to the deque containing the elements to be treated. More... | |
void | set_elem_as_treated (unsigned int elem_id) |
[ADV. FRONT] Mark element as already treated. More... | |
void | set_elem_as_inside_queue (unsigned int elem_id) |
[ADV. FRONT] Mark element as already inside the deque of elements to be treated. More... | |
bool | intersection_queue_empty () |
[ADV. FRONT] Check if deque of elements to be treated is empty. More... | |
bool | test_queue_empty () |
[ADV. FRONT] Check if deque of elements to be tested is empty. More... | |
unsigned int | intersection_queue_extract_front_elem () |
[ADV. FRONT] Pop and returns the first element to be treated. More... | |
unsigned int | test_queue_extract_front_elem () |
[ADV. FRONT] Pop and returns the first element to be tested. More... | |
std::unordered_set< unsigned int > & | neighbors_to_search_next_pair () |
[ADV. FRONT] Returns the current element's neighbors that must be tested yet. More... | |
bool | set_neighbors_to_search_next_pairs () |
[ADV. FRONT] Set the list of neighbors of the current element that must be tested yet. More... | |
void | add_neighbors_to_test_list () |
[ADV. FRONT] Adds element to test list. More... | |
void | FrontSearch_initialize () |
[ADV. FRONT] Initialize the advancing front search data structures. More... | |
void | FrontSearch_reset () |
[ADV. FRONT] Reset the advancing front search data structures, with the exception of list of elements to be treated (should be joined to "FrontSearch_prepare_for_probed_test") More... | |
unsigned int | FrontSearch_prepare_for_probed_test () |
[ADV. FRONT] Reset the advancing front search data structures, with the exception of list of elements to be treated. More... | |
Protected Member Functions | |
Patch_construction () | |
void | insert_patch_element (const libMesh::Elem *Patch_elem) |
Insert an parent mesh element inside the patch, updating the data structures. More... | |
void | build_patch_mesh () |
Build a patch mesh from the patch data structures. More... | |
Protected Attributes | |
const libMesh::Parallel::Communicator & | m_comm |
Parent mesh communicator. More... | |
const unsigned int | m_nodes |
Parent mesh number of processors. More... | |
const unsigned int | m_rank |
Parent mesh processor rank. More... | |
const libMesh::Parallel::Communicator & | m_local_comm |
Patch mesh communicator. More... | |
libMesh::ReplicatedMesh & | m_Mesh_parent |
Parent mesh. More... | |
libMesh::ReplicatedMesh | m_Mesh_patch |
Patch mesh. More... | |
std::unique_ptr< libMesh::PointLocatorBase > | m_Parent_Point_Locator |
Parent mesh point locator. More... | |
Intersection_Tools | m_Intersection_Test |
Intersection search and construction tools. More... | |
std::unordered_set< unsigned int > | m_Patch_Elem_indexes |
Set of elements inside the patch. More... | |
std::unordered_set< unsigned int > | m_Patch_Node_indexes |
Set of nodes inside the patch. More... | |
std::unordered_map< unsigned int, std::unordered_set< unsigned int > > | m_Patch_Elem_Neighbours |
Element neighbour table for the patch. More... | |
unsigned int | m_working_element_id |
[ADV. FRONT] Index of the patch element currently being tested More... | |
bool | m_bTestNeighsForNewPairs |
!!! More... | |
std::deque< int > | m_element_intersection_queue |
[ADV. FRONT] Deque containing the elements to be treated. More... | |
std::deque< int > | m_element_test_queue |
[ADV. FRONT] Deque containing the elements to be tested More... | |
std::unordered_map< unsigned int, int > | m_element_already_treated |
[ADV. FRONT] Marks if an element was already treated or not More... | |
std::unordered_map< unsigned int, int > | m_element_inside_intersection_queue |
[ADV. FRONT] Marks if an element is already inside "m_element_intersection_queue" More... | |
std::unordered_set< unsigned int > | m_element_neighbours_to_search |
[ADV. FRONT] Set containing the current element's neighbors that must be tested yet. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
bool | m_bPrintDebug |
Print debug information? Default: false. More... | |
Class used to build a mesh patch from a parent mesh and an coupling mesh element.
Other than saving and building the mesh patch, this class contains some access methods and data structures adapted to the advancing front intersection search method. These methods are marked with [ADV. FRONT] (Idea: transfer those to their own class ...)
References:
1. Gander, M.J., Japhet, C.: An Algorithm for Non- Matching Grid Projections with Linear Complexity. In: M. Bercovier, M.J. Gander, R. Kornhuber, O. Widlund (eds.) Domain Decomposition Methods in Science and Engineering XVIII, no. 70 in Lecture Notes in Computational Science and Engineering, pp. 185{192. Springer Berlin Heidelberg (2009). URL http://link.springer. com/chapter/10.1007/978-3-642-02677-5_19. DOI: 10.1007/978-3-642-02677-5 19
Definition at line 42 of file patch_construction.h.
|
protected |
|
inline |
Constructor with a pre-defined parent mesh and a local communicator.
Definition at line 142 of file patch_construction.h.
void carl::Patch_construction::add_neighbors_to_test_list | ( | ) |
[ADV. FRONT] Adds element to test list.
Definition at line 303 of file patch_construction.cpp.
|
protected |
Build a patch mesh from the patch data structures.
Definition at line 393 of file patch_construction.cpp.
void carl::Patch_construction::BuildPatch | ( | const libMesh::Elem * | Query_elem | ) |
Build the patch mesh covering a given "Query_elem".
The patch is constructed using a variant of Gander's advancing front algorithm [1], using the "Query_elem" as the "mesh" of the outer 'while' loop, and the parent mesh in the inner 'while' loop. First, the list of elements from the parent mesh forming the patch is filled, and then the patch mesh is constructed using "Patch_construction::build_patch_mesh()"
Definition at line 57 of file patch_construction.cpp.
unsigned int carl::Patch_construction::convert_parent_to_patch_elem_id | ( | unsigned int | input | ) |
Convert an element index from the parent mesh to the patch mesh.
Definition at line 249 of file patch_construction.cpp.
unsigned int carl::Patch_construction::convert_patch_to_parent_elem_id | ( | unsigned int | input | ) |
Convert an element index from the patch mesh to the parent mesh.
Definition at line 254 of file patch_construction.cpp.
unsigned int carl::Patch_construction::current_elem_id | ( | ) |
Definition at line 244 of file patch_construction.cpp.
const libMesh::Elem * carl::Patch_construction::current_elem_pointer | ( | ) |
Definition at line 259 of file patch_construction.cpp.
const libMesh::Elem * carl::Patch_construction::elem | ( | unsigned int | idx | ) |
Returns an element of the PARENT mesh.
Definition at line 38 of file patch_construction.cpp.
std::unordered_set< unsigned int > & carl::Patch_construction::elem_indexes | ( | ) |
Returns the set of elements inside the patch.
Definition at line 23 of file patch_construction.cpp.
void carl::Patch_construction::export_patch_mesh | ( | std::string & | filename_base | ) |
Export the patch mesh to a file.
Definition at line 465 of file patch_construction.cpp.
void carl::Patch_construction::FrontSearch_initialize | ( | ) |
[ADV. FRONT] Initialize the advancing front search data structures.
Definition at line 324 of file patch_construction.cpp.
unsigned int carl::Patch_construction::FrontSearch_prepare_for_probed_test | ( | ) |
[ADV. FRONT] Reset the advancing front search data structures, with the exception of list of elements to be treated.
This method is called before starting the inner loop of the advancing front algorithm.
Definition at line 378 of file patch_construction.cpp.
void carl::Patch_construction::FrontSearch_reset | ( | ) |
[ADV. FRONT] Reset the advancing front search data structures, with the exception of list of elements to be treated (should be joined to "FrontSearch_prepare_for_probed_test")
This method is called before starting the inner loop of the advancing front algorithm.
Definition at line 356 of file patch_construction.cpp.
|
protected |
Insert an parent mesh element inside the patch, updating the data structures.
Definition at line 48 of file patch_construction.cpp.
bool carl::Patch_construction::intersection_queue_empty | ( | ) |
[ADV. FRONT] Check if deque of elements to be treated is empty.
Definition at line 220 of file patch_construction.cpp.
unsigned int carl::Patch_construction::intersection_queue_extract_front_elem | ( | ) |
[ADV. FRONT] Pop and returns the first element to be treated.
Definition at line 230 of file patch_construction.cpp.
void carl::Patch_construction::intersection_queue_push_back | ( | unsigned int | elem_id | ) |
[ADV. FRONT] Push back element to the deque containing the elements to be treated.
Definition at line 205 of file patch_construction.cpp.
std::unordered_set< unsigned int > & carl::Patch_construction::neighbors_to_search_next_pair | ( | ) |
[ADV. FRONT] Returns the current element's neighbors that must be tested yet.
Definition at line 264 of file patch_construction.cpp.
std::unordered_set< unsigned int > & carl::Patch_construction::node_indexes | ( | ) |
Returns the set of nodes inside the patch.
Definition at line 28 of file patch_construction.cpp.
libMesh::ReplicatedMesh & carl::Patch_construction::parent_mesh | ( | ) |
Returns the parent mesh.
Definition at line 13 of file patch_construction.cpp.
std::unordered_map< unsigned int, std::unordered_set< unsigned int > > & carl::Patch_construction::patch_elem_neighbours | ( | ) |
Returns the patch mesh element neighbour table.
Definition at line 43 of file patch_construction.cpp.
libMesh::ReplicatedMesh & carl::Patch_construction::patch_mesh | ( | ) |
Returns the patch mesh.
Definition at line 18 of file patch_construction.cpp.
void carl::Patch_construction::set_elem_as_inside_queue | ( | unsigned int | elem_id | ) |
[ADV. FRONT] Mark element as already inside the deque of elements to be treated.
Definition at line 215 of file patch_construction.cpp.
void carl::Patch_construction::set_elem_as_treated | ( | unsigned int | elem_id | ) |
[ADV. FRONT] Mark element as already treated.
Definition at line 210 of file patch_construction.cpp.
bool carl::Patch_construction::set_neighbors_to_search_next_pairs | ( | ) |
[ADV. FRONT] Set the list of neighbors of the current element that must be tested yet.
Returns a boolean that short-circuits the search of new intersection pairs if the list is empty.
Definition at line 270 of file patch_construction.cpp.
unsigned int carl::Patch_construction::size | ( | ) |
Returns the number of elements inside the patch.
Definition at line 33 of file patch_construction.cpp.
bool carl::Patch_construction::test_queue_empty | ( | ) |
[ADV. FRONT] Check if deque of elements to be tested is empty.
Definition at line 225 of file patch_construction.cpp.
unsigned int carl::Patch_construction::test_queue_extract_front_elem | ( | ) |
[ADV. FRONT] Pop and returns the first element to be tested.
Definition at line 237 of file patch_construction.cpp.
|
protected |
Print debug information? Default: false.
Definition at line 126 of file patch_construction.h.
|
protected |
!!!
Definition at line 74 of file patch_construction.h.
|
protected |
Parent mesh communicator.
Definition at line 47 of file patch_construction.h.
|
protected |
Mapping between the parent and patch mesh elements, using the former as keys.
Definition at line 120 of file patch_construction.h.
|
protected |
Mapping between the patch and parent mesh elements, using the former as keys.
Definition at line 123 of file patch_construction.h.
|
protected |
[ADV. FRONT] Marks if an element was already treated or not
In [1], this corresponds to "bd" and "ad".
Definition at line 96 of file patch_construction.h.
|
protected |
[ADV. FRONT] Marks if an element is already inside "m_element_intersection_queue"
This structure is used instead of a search inside "m_element_intersection_queue" due to the inefficiency of doing a search inside a deque.
Definition at line 103 of file patch_construction.h.
|
protected |
[ADV. FRONT] Deque containing the elements to be treated.
In [1], this corresponds to either "bl" or "bil", depending on whenever the patch is associated to the outer or inner 'while' loop.
Definition at line 82 of file patch_construction.h.
|
protected |
[ADV. FRONT] Set containing the current element's neighbors that must be tested yet.
In [1], this corresponds to "n".
Definition at line 110 of file patch_construction.h.
|
protected |
[ADV. FRONT] Deque containing the elements to be tested
In [1], this corresponds to "al", and is only used for the internal 'while' loop.
Definition at line 89 of file patch_construction.h.
|
protected |
Intersection search and construction tools.
Definition at line 59 of file patch_construction.h.
|
protected |
Patch mesh communicator.
Definition at line 51 of file patch_construction.h.
|
protected |
Parent mesh.
Definition at line 54 of file patch_construction.h.
|
protected |
Patch mesh.
Definition at line 55 of file patch_construction.h.
|
protected |
Mapping between the parent and patch mesh nodes, using the former as keys.
Definition at line 114 of file patch_construction.h.
|
protected |
Mapping between the patch and parent mesh nodes, using the former as keys.
Definition at line 117 of file patch_construction.h.
|
protected |
Parent mesh number of processors.
Definition at line 48 of file patch_construction.h.
|
protected |
Parent mesh point locator.
Definition at line 56 of file patch_construction.h.
|
protected |
Set of elements inside the patch.
Definition at line 63 of file patch_construction.h.
|
protected |
Element neighbour table for the patch.
Definition at line 67 of file patch_construction.h.
|
protected |
Set of nodes inside the patch.
Definition at line 65 of file patch_construction.h.
|
protected |
Parent mesh processor rank.
Definition at line 49 of file patch_construction.h.
|
protected |
[ADV. FRONT] Index of the patch element currently being tested
Definition at line 71 of file patch_construction.h.