28{
29 TCLAP::CmdLine cmd(
30 "Revises meshes by collapsing duplicate nodes, (optionally) removing "
31 "elements of lower dimension than the mesh itself, and subdividing "
32 "geometrically broken mesh elements.\n\n"
33 "OpenGeoSys-6 software, version " +
35 ".\n"
36 "Copyright (c) 2012-2024, OpenGeoSys Community "
37 "(http://www.opengeosys.org)",
39 TCLAP::ValueArg<unsigned> minDim_arg(
40 "d", "min-ele-dim",
41 "Minimum dimension of elements to be inserted into new mesh", false, 1,
42 "unsigned");
43 cmd.add(minDim_arg);
44
45 TCLAP::ValueArg<double> eps_arg(
46 "e", "eps", "Minimum distance for nodes not to be collapsed", false,
47 std::numeric_limits<double>::epsilon(), "float");
48 cmd.add(eps_arg);
49
50 TCLAP::ValueArg<std::string> output_arg(
51 "o", "output-mesh-file", "output mesh file", true, "", "string");
52 cmd.add(output_arg);
53
54 TCLAP::ValueArg<std::string> input_arg(
55 "i", "input-mesh-file", "input mesh file", true, "", "string");
56 cmd.add(input_arg);
57 cmd.parse(argc, argv);
58
60
61
62 std::unique_ptr<MeshLib::Mesh> org_mesh(
64 if (!org_mesh)
65 {
66 return EXIT_FAILURE;
67 }
68 INFO(
"Mesh read: {:d} nodes, {:d} elements.", org_mesh->getNumberOfNodes(),
69 org_mesh->getNumberOfElements());
70
71
72 INFO(
"Simplifying the mesh...");
74 unsigned int minDim =
75 (minDim_arg.isSet() ? minDim_arg.getValue() : org_mesh->getDimension());
76 std::unique_ptr<MeshLib::Mesh> new_mesh(
77 rev.simplifyMesh("revised_mesh", eps_arg.getValue(), minDim));
78
79
80 if (new_mesh)
81 {
82 INFO(
"Revised mesh: {:d} nodes, {:d} elements.",
83 new_mesh->getNumberOfNodes(), new_mesh->getNumberOfElements());
85 }
86
87 return EXIT_SUCCESS;
88}
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
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)