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");
121 search_coupling_intersections.PreparePreallocationAndLoad();
122 search_coupling_intersections.PreallocateAndPartitionCoupling();
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");
139 search_coupling_intersections.BuildIntersections();
140 search_coupling_intersections.CalculateGlobalVolume();
141 perf_log.pop(
"Search intersection");
146 libMesh::Mesh test_mesh_full_I(LocalComm,3);
150 join_meshes.set_grid_constraints(test_mesh_A,test_mesh_B);
155 join_meshes.set_base_filenames(input_params.
output_base,
".e",nodes);
158 perf_log.push(
"Join intersection tables");
159 join_meshes.join_tables();
160 perf_log.pop(
"Join intersection tables");
165 perf_log.push(
"Stitch intersection meshes");
166 join_meshes.stitch_meshes();
167 perf_log.pop(
"Stitch intersection meshes");
174 const std::unordered_set<unsigned int> * restrict_set_A_ptr = join_meshes.get_restricted_set_pointer_first();
175 const std::unordered_set<unsigned int> * restrict_set_B_ptr = join_meshes.get_restricted_set_pointer_second();
178 perf_log.push(
"Restrict meshes");
180 restrict_A.BuildRestrictionFromSet(restrict_set_A_ptr);
181 restrict_A.export_restriction_mesh(input_params.
output_base +
"_A_restriction");
184 restrict_B.BuildRestrictionFromSet(restrict_set_B_ptr);
185 restrict_B.export_restriction_mesh(input_params.
output_base +
"_B_restriction");
186 perf_log.pop(
"Restrict meshes");
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)
Class used to build a restriction of a parent mesh to the coupling region.
Class containing the structure needed to find all the intersections between two meshes, inside the coupling region mesh.
carl::IntersectionMeshingMethod inter_meshing_method
Intersection meshing method. Values: carl::IntersectionMeshingMethod::CGAL or carl::IntersectionMeshi...
std::string output_base
Output filename base.
Class used to stitch together different meshes.
Structure containing the parameters for the parallel intersection search test program (source: CArl_b...
bool bVerbose
Print coupling partitioning?
std::string mesh_B
Mesh B path.
std::string mesh_C
Coupling mesh path.