47int main(
int argc,
char* argv[])
53 "Checks if the subdomain meshes are part of the bulk mesh and writes "
54 "the 'bulk_node_ids' and the 'bulk_element_ids' in each of them. The "
55 "documentation is available at "
56 "https://www.opengeosys.org/docs/tools/meshing-submeshes/"
57 "identifysubdomains/.\n\n"
58 "OpenGeoSys-6 software, version " +
61 "Copyright (c) 2012-2025, OpenGeoSys Community "
62 "(http://www.opengeosys.org)",
65 TCLAP::SwitchArg force_overwrite_arg(
66 "f",
"force",
"Overwriting existing subdomain meshes.");
67 cmd.add(force_overwrite_arg);
69 TCLAP::ValueArg<std::string> output_prefix_arg(
72 "Output. Prefix the subdomain meshes' filenames with the output "
76 "BASE_FILENAME_OUTPUT");
77 cmd.add(output_prefix_arg);
79 TCLAP::ValueArg<double> search_length_arg(
82 "search length determining radius for the node search algorithm. "
83 "Non-negative floating point number (min = 0) ",
87 cmd.add(search_length_arg);
89 TCLAP::ValueArg<std::string> bulk_mesh_arg(
90 "m",
"mesh",
"Input (.vtu). The file name of the bulk mesh",
true,
"",
92 cmd.add(bulk_mesh_arg);
96 TCLAP::UnlabeledMultiArg<std::string> subdomain_meshes_filenames_arg(
97 "subdomain_meshes_filenames",
"mesh file names.",
true,
99 cmd.add(subdomain_meshes_filenames_arg);
101 cmd.add(log_level_arg);
102 cmd.parse(argc, argv);
111 mesh_reading_time.
start();
112 std::unique_ptr<MeshLib::Mesh> bulk_mesh{
114 if (bulk_mesh ==
nullptr)
116 OGS_FATAL(
"Could not read bulk mesh from '{:s}'",
117 bulk_mesh_arg.getValue());
123 auto const subdomain_meshes =
124 readMeshes(subdomain_meshes_filenames_arg.getValue());
125 INFO(
"Mesh reading time: {:g} s", mesh_reading_time.
elapsed());
131 mesh_node_searcher_construction_time.
start();
132 auto const& mesh_node_searcher =
135 std::make_unique<MeshGeoToolsLib::SearchLength>(
136 search_length_arg.getValue()));
137 INFO(
"MeshNodeSearcher construction time: {:g} s",
138 mesh_node_searcher_construction_time.
elapsed());
144 identify_subdomain_time.
start();
145 for (
auto& mesh_ptr : subdomain_meshes)
149 bool const overwrite_property_vectors =
150 force_overwrite_arg.getValue() ||
151 !output_prefix_arg.getValue().empty();
152 identifySubdomainMesh(*mesh_ptr, *bulk_mesh, mesh_node_searcher,
153 overwrite_property_vectors);
155 INFO(
"identifySubdomains time: {:g} s", identify_subdomain_time.
elapsed());
161 writing_time.
start();
162 for (
auto const& mesh_ptr : subdomain_meshes)
166 output_prefix_arg.getValue() + mesh_ptr->getName() +
".vtu");
168 INFO(
"writing time: {:g} s", writing_time.
elapsed());
170 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)