45int main(
int argc,
char* argv[])
51 "Checks if the subdomain meshes are part of the bulk mesh and writes "
52 "the 'bulk_node_ids' and the 'bulk_element_ids' in each of them. The "
53 "documentation is available at "
54 "https://www.opengeosys.org/docs/tools/meshing-submeshes/"
55 "identifysubdomains/.\n\n"
56 "OpenGeoSys-6 software, version " +
59 "Copyright (c) 2012-2024, OpenGeoSys Community "
60 "(http://www.opengeosys.org)",
63 TCLAP::SwitchArg force_overwrite_arg(
64 "f",
"force",
"Overwriting existing subdomain meshes.");
65 cmd.add(force_overwrite_arg);
67 TCLAP::ValueArg<std::string> output_prefix_arg(
70 "Prefix the subdomain meshes' filenames with the output prefix/path.",
74 cmd.add(output_prefix_arg);
76 TCLAP::ValueArg<double> search_length_arg(
79 "search length determining radius for the node search algorithm. "
80 "Non-negative floating point number (default 1e-16) ",
84 cmd.add(search_length_arg);
86 TCLAP::ValueArg<std::string> bulk_mesh_arg(
87 "m",
"mesh",
"the file name of the bulk mesh",
true,
"",
"mesh file");
88 cmd.add(bulk_mesh_arg);
92 TCLAP::UnlabeledMultiArg<std::string> subdomain_meshes_filenames_arg(
93 "subdomain_meshes_filenames",
"mesh file names.",
true,
94 "subdomain mesh file");
95 cmd.add(subdomain_meshes_filenames_arg);
96 cmd.parse(argc, argv);
104 mesh_reading_time.
start();
105 std::unique_ptr<MeshLib::Mesh> bulk_mesh{
107 if (bulk_mesh ==
nullptr)
109 OGS_FATAL(
"Could not read bulk mesh from '{:s}'",
110 bulk_mesh_arg.getValue());
116 auto const subdomain_meshes =
117 readMeshes(subdomain_meshes_filenames_arg.getValue());
118 INFO(
"Mesh reading time: {:g} s", mesh_reading_time.
elapsed());
124 mesh_node_searcher_construction_time.
start();
125 auto const& mesh_node_searcher =
128 std::make_unique<MeshGeoToolsLib::SearchLength>(
129 search_length_arg.getValue()));
130 INFO(
"MeshNodeSearcher construction time: {:g} s",
131 mesh_node_searcher_construction_time.
elapsed());
137 identify_subdomain_time.
start();
138 for (
auto& mesh_ptr : subdomain_meshes)
142 bool const overwrite_property_vectors =
143 force_overwrite_arg.getValue() ||
144 !output_prefix_arg.getValue().empty();
145 identifySubdomainMesh(*mesh_ptr, *bulk_mesh, mesh_node_searcher,
146 overwrite_property_vectors);
148 INFO(
"identifySubdomains time: {:g} s", identify_subdomain_time.
elapsed());
154 writing_time.
start();
155 for (
auto const& mesh_ptr : subdomain_meshes)
159 output_prefix_arg.getValue() + mesh_ptr->getName() +
".vtu");
161 INFO(
"writing time: {:g} s", writing_time.
elapsed());
163 INFO(
"Entire run time: {:g} s", run_time.
elapsed());
int main(int argc, char *argv[])
std::vector< std::unique_ptr< MeshLib::Mesh > > readMeshes(std::vector< std::string > const &filenames)