22{
23 TCLAP::CmdLine cmd(
24 "Add element quality as a mesh property.\n\n"
25 "OpenGeoSys-6 software, version " +
27 ".\n"
28 "Copyright (c) 2012-2026, OpenGeoSys Community "
29 "(http://www.opengeosys.org)",
31
32 TCLAP::ValueArg<std::string> mesh_out_arg("o", "output_mesh_file",
33 "Output (.vtu | .msh) mesh file ",
34 true, "", "OUTPUT_FILE");
35 cmd.add(mesh_out_arg);
36 std::vector<std::string> allowed_element_criterions{
37 "ElementSize", "EdgeRatio", "EquiAngleSkew", "RadiusEdgeRatio",
38 "SizeDifference"};
39 TCLAP::ValuesConstraint<std::string> element_criterions{
40 allowed_element_criterions};
41 TCLAP::ValueArg<std::string> criterion_arg{
42 "c", "quality_criterion", "quality criterion", true,
43 "", &element_criterions};
44 cmd.add(criterion_arg);
45 TCLAP::ValueArg<std::string> mesh_in_arg("i", "input_mesh_file",
46 "Input (.vtu | .msh) mesh file",
47 true, "", "INPUT_FILE");
48 cmd.add(mesh_in_arg);
50 cmd.add(log_level_arg);
51 cmd.parse(argc, argv);
52
55
56
60 mesh_in_arg.getValue(), true ));
61 if (!mesh)
62 {
63 return EXIT_FAILURE;
64 }
65 INFO(
"Time for reading: {:g} s", run_time.
elapsed());
66
67
71 auto const element_quality_vector = element_quality.getQualityVector();
74 {element_quality_vector});
75 INFO(
"Writing mesh '{:s}' ... ", mesh_out_arg.getValue());
77 {
78 return EXIT_FAILURE;
79 }
81 return EXIT_SUCCESS;
82}
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
double elapsed() const
Get the elapsed time in seconds.
void start()
Start the timer.
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 > output_variable_names, bool const use_compression, int const data_mode)
MeshLib::MeshQualityType String2MeshQualityType(std::string const &s)
void addPropertyToMesh(Mesh &mesh, std::string_view name, MeshItemType item_type, std::size_t number_of_components, std::span< T const > values)
MeshQualityType
Describes a mesh quality metric.