10 #include <tclap/CmdLine.h> 22 std::vector<std::string>
const& filenames)
24 std::vector<std::unique_ptr<MeshLib::Mesh>> meshes;
25 meshes.reserve(filenames.size());
27 for (
auto const& filename : filenames)
32 OGS_FATAL(
"Could not read mesh from '%s' file.", filename.c_str());
34 meshes.emplace_back(mesh);
38 OGS_FATAL(
"No subdomain meshes were read.");
43 int main(
int argc,
char* argv[])
48 "Checks if the subdomain meshes are part of the bulk mesh and writes " 49 "the 'bulk_node_ids' and the 'bulk_element_ids' in each of them.\n\n" 50 "OpenGeoSys-6 software, version " +
53 "Copyright (c) 2012-2019, OpenGeoSys Community " 54 "(http://www.opengeosys.org)",
57 TCLAP::ValueArg<bool> force_overwrite_arg(
60 "Overwrites the existing subdomain meshes. (default: do not " 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);
101 std::unique_ptr<MeshLib::Mesh> bulk_mesh{
103 if (bulk_mesh ==
nullptr)
105 OGS_FATAL(
"Could not read bulk mesh from '%s'",
106 bulk_mesh_arg.getValue().c_str());
112 auto const subdomain_meshes =
113 readMeshes(subdomain_meshes_filenames_arg.getValue());
118 auto const& mesh_node_searcher =
121 std::make_unique<MeshGeoToolsLib::SearchLength>(
122 search_length_arg.getValue()));
127 for (
auto& mesh_ptr : subdomain_meshes)
131 bool const overwrite_property_vectors =
132 force_overwrite_arg.getValue() ||
133 !output_prefix_arg.getValue().empty();
135 overwrite_property_vectors);
141 for (
auto const& mesh_ptr : subdomain_meshes)
145 output_prefix_arg.getValue() + mesh_ptr->getName() +
".vtu");
Definition of the Mesh class.
MeshLib::Mesh * readMeshFromFile(const std::string &file_name)
Initialization and shutting down of the logog library.
Definition of readMeshFromFile function.
int writeMeshToFile(const MeshLib::Mesh &mesh, const std::string &file_name)
BASELIB_EXPORT const std::string git_describe
std::vector< std::unique_ptr< MeshLib::Mesh > > readMeshes(std::vector< std::string > const &filenames)
#define OGS_FATAL(fmt,...)
int main(int argc, char *argv[])