10 #include <tclap/CmdLine.h>
21 std::vector<std::string>
const& filenames)
23 std::vector<std::unique_ptr<MeshLib::Mesh>> meshes;
24 meshes.reserve(filenames.size());
26 for (
auto const& filename : filenames)
31 OGS_FATAL(
"Could not read mesh from '{:s}' file.", filename);
33 meshes.emplace_back(mesh);
37 OGS_FATAL(
"No subdomain meshes were read.");
42 int main(
int argc,
char* argv[])
45 "Checks if the subdomain meshes are part of the bulk mesh and writes "
46 "the 'bulk_node_ids' and the 'bulk_element_ids' in each of them. The "
47 "documentation is available at "
48 "https://www.opengeosys.org/docs/tools/meshing-submeshes/"
49 "identifysubdomains/.\n\n"
50 "OpenGeoSys-6 software, version " +
53 "Copyright (c) 2012-2021, OpenGeoSys Community "
54 "(http://www.opengeosys.org)",
57 TCLAP::SwitchArg force_overwrite_arg(
58 "f",
"force",
"Overwriting existing subdomain meshes.");
59 cmd.add(force_overwrite_arg);
61 TCLAP::ValueArg<std::string> output_prefix_arg(
64 "Prefix the subdomain meshes' filenames with the output prefix/path.",
68 cmd.add(output_prefix_arg);
70 TCLAP::ValueArg<double> search_length_arg(
73 "search length determining radius for the node search algorithm. "
74 "Non-negative floating point number (default 1e-16) ",
78 cmd.add(search_length_arg);
80 TCLAP::ValueArg<std::string> bulk_mesh_arg(
81 "m",
"mesh",
"the file name of the bulk mesh",
true,
"",
"mesh file");
82 cmd.add(bulk_mesh_arg);
86 TCLAP::UnlabeledMultiArg<std::string> subdomain_meshes_filenames_arg(
87 "subdomain_meshes_filenames",
"mesh file names.",
true,
88 "subdomain mesh file");
89 cmd.add(subdomain_meshes_filenames_arg);
90 cmd.parse(argc, argv);
95 std::unique_ptr<MeshLib::Mesh> bulk_mesh{
97 if (bulk_mesh ==
nullptr)
99 OGS_FATAL(
"Could not read bulk mesh from '{:s}'",
100 bulk_mesh_arg.getValue());
106 auto const subdomain_meshes =
107 readMeshes(subdomain_meshes_filenames_arg.getValue());
112 auto const& mesh_node_searcher =
115 std::make_unique<MeshGeoToolsLib::SearchLength>(
116 search_length_arg.getValue()));
121 for (
auto& mesh_ptr : subdomain_meshes)
125 bool const overwrite_property_vectors =
126 force_overwrite_arg.getValue() ||
127 !output_prefix_arg.getValue().empty();
129 overwrite_property_vectors);
135 for (
auto const& mesh_ptr : subdomain_meshes)
139 output_prefix_arg.getValue() + mesh_ptr->getName() +
".vtu");
Definition of the Mesh class.
Base class for different search length strategies.
int main(int argc, char *argv[])
std::vector< std::unique_ptr< MeshLib::Mesh > > readMeshes(std::vector< std::string > const &filenames)
GITINFOLIB_EXPORT const std::string ogs_version
MeshLib::Mesh * readMeshFromFile(const std::string &file_name)
int writeMeshToFile(const MeshLib::Mesh &mesh, std::filesystem::path const &file_path, [[maybe_unused]] std::set< std::string > variable_output_names)
Definition of readMeshFromFile function.