33 int main(
int argc,
char *argv[])
36 libMesh::LibMeshInit init(argc, argv);
39 libMesh::Parallel::Communicator& WorldComm = init.comm();
42 unsigned int nodes = WorldComm.size();
43 unsigned int rank = WorldComm.rank();
46 libMesh::Parallel::Communicator LocalComm;
47 WorldComm.split(rank,rank,LocalComm);
50 libMesh::PerfLog perf_log(
"Main program");
55 GetPot command_line(argc, argv);
61 std::string input_filename;
62 if (command_line.search(2,
"--inputfile",
"-i")) {
63 input_filename = command_line.next(input_filename);
64 field_parser.parse_input_file(input_filename,
"#",
"\n",
" \t\n");
66 field_parser = command_line;
73 libMesh::Mesh test_mesh_A(WorldComm);
74 libMesh::Mesh test_mesh_B(WorldComm);
75 libMesh::Mesh test_mesh_C(WorldComm);
78 libMesh::Mesh test_mesh_I(LocalComm);
81 test_mesh_A.read(input_params.
mesh_A);
82 test_mesh_B.read(input_params.
mesh_B);
83 test_mesh_C.read(input_params.
mesh_C);
85 test_mesh_A.prepare_for_use();
86 test_mesh_B.prepare_for_use();
87 test_mesh_C.prepare_for_use();
93 perf_log.push(
"Set up");
104 perf_log.pop(
"Set up");
110 std::cout <<
" -> Nb. coupling elements before repartitioning (intersection partition) : "
111 << test_mesh_C.n_partitions() <<
" ( ";
112 for(
unsigned int iii = 0; iii < nodes; ++iii)
114 std::cout << test_mesh_C.n_elem_on_proc(iii) <<
" ";
116 std::cout <<
")" << std::endl << std::endl;
120 perf_log.push(
"Prepare intersection load");
123 perf_log.push(
"Prepare intersection load");
128 std::cout <<
" -> Nb. coupling elements after repartitioning (intersection partition) : "
129 << test_mesh_C.n_partitions() <<
" ( ";
130 for(
unsigned int iii = 0; iii < nodes; ++iii)
132 std::cout << test_mesh_C.n_elem_on_proc(iii) <<
" ";
134 std::cout <<
")" << std::endl << std::endl;
138 perf_log.push(
"Search intersection");
141 perf_log.pop(
"Search intersection");
146 libMesh::Mesh test_mesh_full_I(LocalComm,3);
158 perf_log.push(
"Join intersection tables");
160 perf_log.pop(
"Join intersection tables");
165 perf_log.push(
"Stitch intersection meshes");
167 perf_log.pop(
"Stitch intersection meshes");
178 perf_log.push(
"Restrict meshes");
186 perf_log.pop(
"Restrict meshes");
void BuildRestrictionFromSet(const std::unordered_set< unsigned int > *restricted_mesh_set)
Build the restriction of the parent mesh from a given element set. This version is useful if the inte...
std::string mesh_A
Mesh A path.
bool bStitchInterMeshes
Stitch the intersection meshes?
void get_intersection_input_params(GetPot &field_parser, parallel_intersection_params &input_params)
Parser function for the parallel intersection search program (source: CArl_build_intersections.cpp)
void export_restriction_mesh(const std::string &filename_base)
Export the restricted mesh to a file.
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...
Class used to build a restriction of a parent mesh to the coupling region.
void set_base_filenames(std::vector< std::string > &mesh_filenames, std::vector< std::string > &table_filenames)
Set by hand the filenames used to build the stitched mesh.
Class containing the structure needed to find all the intersections between two meshes, inside the coupling region mesh.
void stitch_meshes()
Stitch the meshes.
void set_grid_constraints(const libMesh::Mesh &mesh_A, const libMesh::Mesh &mesh_B, double vol_tol=-1)
Set the boundaries of the discrete points grid, using the intersected meshes as a base...
carl::IntersectionMeshingMethod inter_meshing_method
Intersection meshing method. Values: carl::IntersectionMeshingMethod::CGAL or carl::IntersectionMeshi...
void join_tables()
Join the intersection tables.
std::string output_base
Output filename base.
Class used to stitch together different meshes.
void CalculateGlobalVolume()
Calculate the total intersection volume over all the processors.
const std::unordered_set< unsigned int > * get_restricted_set_pointer_second()
Returns the pointer to the set with the elements used to form the second restricted mesh...
Structure containing the parameters for the parallel intersection search test program (source: CArl_b...
const std::unordered_set< unsigned int > * get_restricted_set_pointer_first()
Returns the pointer to the set with the elements used to form the first restricted mesh...
bool bVerbose
Print coupling partitioning?
void BuildIntersections(SearchMethod search_type=BRUTE)
Find and build all the intersections.
std::string mesh_B
Mesh B path.
int main(int argc, char *argv[])
std::string mesh_C
Coupling mesh path.