30{
31 TCLAP::CmdLine cmd(
32 "Revises meshes by collapsing duplicate nodes, (optionally) removing "
33 "elements of lower dimension than the mesh itself, and subdividing "
34 "geometrically broken mesh elements.\n\n"
35 "OpenGeoSys-6 software, version " +
37 ".\n"
38 "Copyright (c) 2012-2025, OpenGeoSys Community "
39 "(http://www.opengeosys.org)",
41 TCLAP::ValueArg<unsigned> minDim_arg(
42 "d", "min-ele-dim",
43 "Minimum dimension of elements to be inserted into new mesh", false, 1,
44 "MIN_DIMENSION");
45 cmd.add(minDim_arg);
46
47 TCLAP::ValueArg<double> eps_arg(
48 "e", "eps", "Minimum distance for nodes not to be collapsed", false,
49 std::numeric_limits<double>::epsilon(), "MIN_DISTANCE");
50 cmd.add(eps_arg);
51
52 TCLAP::ValueArg<std::string> output_arg("o", "output-mesh-file",
53 "Output (.vtu) mesh file", true, "",
54 "OUTPUT_FILE");
55 cmd.add(output_arg);
56
57 TCLAP::ValueArg<std::string> input_arg("i", "input-mesh-file",
58 "Input (.vtu) mesh file", true, "",
59 "INPUT_FILE");
60 cmd.add(input_arg);
62 cmd.add(log_level_arg);
63 cmd.parse(argc, argv);
64
67
68
69 std::unique_ptr<MeshLib::Mesh> org_mesh(
71 if (!org_mesh)
72 {
73 return EXIT_FAILURE;
74 }
75 INFO(
"Mesh read: {:d} nodes, {:d} elements.", org_mesh->getNumberOfNodes(),
76 org_mesh->getNumberOfElements());
77
78
79 INFO(
"Simplifying the mesh...");
81 unsigned int minDim =
82 (minDim_arg.isSet() ? minDim_arg.getValue() : org_mesh->getDimension());
83 std::unique_ptr<MeshLib::Mesh> new_mesh(
84 rev.simplifyMesh("revised_mesh", eps_arg.getValue(), minDim));
85
86
87 if (new_mesh)
88 {
89 INFO(
"Revised mesh: {:d} nodes, {:d} elements.",
90 new_mesh->getNumberOfNodes(), new_mesh->getNumberOfElements());
92 }
93
94 return EXIT_SUCCESS;
95}
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
TCLAP::ValueArg< std::string > makeLogLevelArg()
void initOGSLogger(std::string const &log_level)
GITINFOLIB_EXPORT const std::string ogs_version
MeshLib::Mesh * readMeshFromFile(const std::string &file_name, bool const compute_element_neighbors)
int writeMeshToFile(const MeshLib::Mesh &mesh, std::filesystem::path const &file_path, std::set< std::string > variable_output_names)