8 #ifndef COMMON_INTERSECTIONS_PARALLEL_INTERSECTION_SEARCH_H_
9 #define COMMON_INTERSECTIONS_PARALLEL_INTERSECTION_SEARCH_H_
38 const libMesh::Parallel::Communicator&
m_comm;
134 std::pair<unsigned int,unsigned int> & First_intersection);
144 std::pair<unsigned int,unsigned int> & First_intersection);
182 libMesh::Mesh & mesh_I,
183 const std::string & output_base = std::string(
"test"),
185 double Min_Inter_Volume = 1E-15,
186 bool bDoPerf_log =
true,
187 bool bDebugOutput =
false) :
190 m_Mesh_Coupling { mesh_Coupling },
191 m_comm { m_Mesh_Coupling.comm() },
192 m_nodes { m_comm.size() },
193 m_rank { m_comm.rank() },
194 m_local_comm { mesh_I.comm() },
195 m_Patch_Constructor_A { Patch_construction(m_Mesh_A,m_local_comm)},
196 m_Patch_Constructor_B { Patch_construction(m_Mesh_B,m_local_comm)},
197 m_MeshingMethod { MeshingMethod },
198 m_Mesh_Intersection { Mesh_Intersection(mesh_I,m_Mesh_A,m_Mesh_B,m_MeshingMethod)},
199 m_bSaveInterData {
true },
200 m_bDidPreliminarySearch {
false },
201 m_bHavePreallocData {
false },
202 m_bIntersectionsBuilt {
false },
203 m_Min_Inter_Volume { Min_Inter_Volume },
204 m_bSkipIntersectionConstruction {
false },
205 m_bSkipIntersectionPartitioning {
false },
206 m_Output_filename_base { output_base +
"_r_" + std::to_string(m_rank) +
"_n_" + std::to_string(m_nodes)},
207 MASTER_bPerfLog_intersection_search {bDoPerf_log},
208 m_perf_log { libMesh::PerfLog(
"Intersection search", MASTER_bPerfLog_intersection_search) },
209 m_bPrintDebug { bDebugOutput },
210 m_bPrintTimingData {
false },
211 m_bPrintIntersectionsPerPartData {
false }
214 m_Nb_Of_Intersections_Elem_C.resize(mesh_Coupling.n_elem(),0);
247 m_bSkipIntersectionConstruction = bSkipIntersectionConstruction;
253 m_bSkipIntersectionPartitioning = bSkipIntersectionPartitioning;
bool m_bDidPreliminarySearch
Boolean flag determining if we did a preliminary intersection search, used for the coupling mesh repa...
std::string m_timing_data_file_base
Output filenames base for the timing data.
bool m_bIntersectionsBuilt
Boolean flag indicating if the intersections were built. (A bit useless right now ...
double m_Min_Inter_Volume
Volume cutoff for the intersection polyhedrons. Default: 1E-15.
void SkipIntersectionConstruction(bool bSkipIntersectionConstruction)
Set the "Skip intersection construction" flag.
bool m_bSkipIntersectionConstruction
Boolean indicating if we should skip the intersection construction. Default: false.
void FindAndBuildIntersections_Front()
Find and build all the intersections, using the advancing front method.
void FindIntersections_Front()
Find all the intersections, using the advancing front method.
void FindIntersections_Brute()
Find all the intersections, using the brute force method.
const libMesh::Parallel::Communicator & m_local_comm
Local communicator, used for mesh patches.
Class used to build a mesh patch from a parent mesh and an coupling mesh element. ...
std::string m_Output_filename_base
Output filenames base.
bool m_bPrintIntersectionsPerPartData
Print intersections per partition. Default: false.
void FindPatchIntersections_Brute(const libMesh::Elem *Query_elem)
Find all the intersections between the patches associated to the Query_elem, using a brute force meth...
libMesh::Mesh & m_Mesh_Coupling
Mesh representing the coupling region.
const libMesh::Parallel::Communicator & m_comm
Global communicator.
const unsigned int m_nodes
Number of MPI processors.
Intersection_Search(libMesh::Mesh &mesh_A, libMesh::Mesh &mesh_B, libMesh::Mesh &mesh_Coupling, libMesh::Mesh &mesh_I, const std::string &output_base=std::string("test"), IntersectionMeshingMethod MeshingMethod=IntersectionMeshingMethod::CGAL, double Min_Inter_Volume=1E-15, bool bDoPerf_log=true, bool bDebugOutput=false)
Constructor.
void BuildCoupledPatches(const libMesh::Elem *Query_elem, int patch_counter=0)
Build both patches associated a given query element from the coupling region mesh.
void BruteForce_FindFirstPair(Patch_construction *Patch_guide, Patch_construction *Patch_probed, std::pair< unsigned int, unsigned int > &First_intersection)
Find the first intersecting pair from a patch, doing a full scan of the patches.
IntersectionMeshingMethod m_MeshingMethod
Flag defining the intersection meshing algorithm.
void PreparePreallocationAndLoad(SearchMethod search_type=BRUTE)
Do a preliminary search, to optimize the intersection search and construction.
void PreallocateAndPartitionCoupling()
Preallocate Intersection_Search::m_Intersection_Pairs_multimap and repartition the coupling mesh...
bool m_bSkipIntersectionPartitioning
Boolean indicating if we should skip the intersection repartitioning. Default: false.
Patch_construction m_Patch_Constructor_B
Patch_construction object for mesh B.
void UpdateCouplingIntersection(const libMesh::Elem *Query_elem)
Build the intersections associated to the Query_elem and update the intersection mesh.
Class containing the structure needed to find all the intersections between two meshes, inside the coupling region mesh.
libMesh::PerfLog m_perf_log
libMesh::PerfLog object.
Patch_construction m_Patch_Constructor_A
Patch_construction object for mesh A.
IntersectionMeshingMethod
std::unordered_multimap< unsigned int, unsigned int > m_Intersection_Pairs_multimap
Multimap containing the intersection pairs.
std::vector< unsigned int > m_Nb_Of_Intersections_Elem_C
Vector containing the number of intersections found inside each of the coupling mesh elements...
bool m_bHavePreallocData
Boolean flag determining if we have the data for a proper preallocation of m_Intersection_Pairs_multi...
void FindFirstPair(Patch_construction *Patch_guide, Patch_construction *Patch_probed, std::pair< unsigned int, unsigned int > &First_intersection)
Find the first intersecting pair from a patch.
Mesh_Intersection m_Mesh_Intersection
Object containing the intersection mesh.
libMesh::ErrorVector m_coupling_weights
libMesh::ErrorVector used to repartition the coupling mesh.
Intersection_Tools m_Intersection_test
Intersection operations for the main intersection tests.
bool m_bPrintDebug
Print debug data. Default: false.
void CalculateGlobalVolume()
Calculate the total intersection volume over all the processors.
libMesh::Mesh & mesh_A()
Reference to the mesh A.
void SetScalingFiles(const std::string &timing_data_file_base)
Set up timing output file.
libMesh::Mesh & mesh_Coupling()
Reference to the coupling mesh.
void SkipIntersectionPartitioning(bool bSkipIntersectionPartitioning)
Set the "Skip the coupling mesh repartition" flag.
bool MASTER_bPerfLog_intersection_search
Do performance log? Default: true.
void FindPatchIntersections_Front(const libMesh::Elem *Query_elem)
Find all the intersections between the patches associated to the Query_elem, using an advancing front...
Class used to construct the intersection meshes.
bool m_bSaveInterData
Boolean flag determining if we should save the intersection data or not. Default: true...
void CalculateIntersectionVolume(const libMesh::Elem *Query_elem)
Calculate the volume of the intersections associated to Query_elem without updating the intersection ...
Intersection_Tools m_Intersection_test_neighbors
Intersection operations for the neighbor intersection tests. (why do we need both?)
void FindAndBuildIntersections_Brute()
Find and build all the intersections, using the brute force method.
const unsigned int m_rank
This processor's rank (or ID in the communicator)
void BuildIntersections(SearchMethod search_type=BRUTE)
Find and build all the intersections.
libMesh::Mesh & mesh_B()
Reference to the mesh B.
bool m_bPrintTimingData
Print timing data. Default: false.