27{
28 TCLAP::CmdLine cmd(
29 "Converting a mesh in FEFLOW file format (ASCII, version 5.4) to a vtk "
30 "unstructured grid file (new OGS file format) or to the old OGS file "
31 "format - see options.\n\n"
32 "OpenGeoSys-6 software, version " +
34 ".\n"
35 "Copyright (c) 2012-2026, OpenGeoSys Community "
36 "(http://www.opengeosys.org)",
38
39 TCLAP::ValueArg<std::string> ogs_mesh_arg(
40 "o",
41 "out",
42 "Output. Filename for output mesh (if extension is msh, old OGS file "
43 "format is "
44 "written)",
45 true,
46 "",
47 "OUTPUT_FILE");
48 cmd.add(ogs_mesh_arg);
49
50 TCLAP::ValueArg<std::string> feflow_mesh_arg(
51 "i", "in", "Input (.fem). FEFLOW input file", true, "", "INPUT_FILE");
52 cmd.add(feflow_mesh_arg);
53
55 cmd.add(log_level_arg);
56 cmd.parse(argc, argv);
57
60
61
62 INFO(
"Reading {:s}.", feflow_mesh_arg.getValue());
63#ifndef WIN32
66#endif
70 std::unique_ptr<MeshLib::Mesh const> mesh(
72
73 if (mesh == nullptr)
74 {
75 INFO(
"Could not read mesh from {:s}.", feflow_mesh_arg.getValue());
76 return EXIT_FAILURE;
77 }
78#ifndef WIN32
80 INFO(
"Mem for mesh: {} MiB",
81 (mem_with_mesh - mem_without_mesh) / (1024 * 1024));
82#endif
83 INFO(
"Time for reading: {:f} seconds.", run_time.
elapsed());
84 INFO(
"Read {:d} nodes and {:d} elements.", mesh->getNumberOfNodes(),
85 mesh->getNumberOfElements());
86
87 std::string ogs_mesh_fname(ogs_mesh_arg.getValue());
88 INFO(
"Writing {:s}.", ogs_mesh_fname);
90 {
91 return EXIT_FAILURE;
92 }
94 return EXIT_SUCCESS;
95}
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
unsigned long getVirtMemUsage()
double elapsed() const
Get the elapsed time in seconds.
void start()
Start the timer.
MeshLib::Mesh * readFEFLOWFile(const std::string &filename)
TCLAP::ValueArg< std::string > makeLogLevelArg()
void initOGSLogger(std::string const &log_level)
GITINFOLIB_EXPORT const std::string ogs_version
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)