27{
28 TCLAP::CmdLine cmd(
29 "Append line elements into a mesh.\n\n"
30 "OpenGeoSys-6 software, version " +
32 ".\n"
33 "Copyright (c) 2012-2025, OpenGeoSys Community "
34 "(http://www.opengeosys.org)",
36 TCLAP::ValueArg<std::string> mesh_in(
37 "i", "mesh-input-file",
38 "Input (.vtu). The name of the file containing the input mesh", true,
39 "", "INPUT_FILE");
40 cmd.add(mesh_in);
41 TCLAP::ValueArg<std::string> mesh_out(
42 "o", "mesh-output-file",
43 "Output (.vtu | .msh). The name of the file the mesh will be written "
44 "to",
45 true, "", "OUTPUT_FILE");
46 cmd.add(mesh_out);
47 TCLAP::ValueArg<std::string> geoFileArg(
48 "g", "geo-file",
49 "Input (.gml). The name of the input geometry file which contains "
50 "polylines",
51 true, "", "INPUT_FILE");
52 cmd.add(geoFileArg);
54 cmd.add(log_level_arg);
55
56 TCLAP::ValueArg<std::string> gmsh_path_arg(
57 "", "gmsh-path", "Input (.msh). The path to the input gmsh binary file",
58 false, "", "INPUT_FILE");
59 cmd.add(gmsh_path_arg);
60
61
62 cmd.parse(argc, argv);
63
66
67
70 gmsh_path_arg.getValue());
71
73 if (geo_names.empty())
74 {
75 ERR(
"No geometries found.");
76 return EXIT_FAILURE;
77 }
80 if (!ply_vec)
81 {
82 ERR(
"Could not find polylines in geometry '{:s}'.", geo_names.front());
83 return EXIT_FAILURE;
84 }
85
86
88 mesh_in.getValue(), true ));
89 if (!mesh)
90 {
91 ERR(
"Mesh file '{:s}' not found", mesh_in.getValue());
92 return EXIT_FAILURE;
93 }
94 INFO(
"Mesh read: {:d} nodes, {:d} elements.", mesh->getNumberOfNodes(),
95 mesh->getNumberOfElements());
96
97
98 std::unique_ptr<MeshLib::Mesh> new_mesh =
100 INFO(
"Mesh created: {:d} nodes, {:d} elements.",
101 new_mesh->getNumberOfNodes(), new_mesh->getNumberOfElements());
102
104
105 return EXIT_SUCCESS;
106}
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Container class for geometric objects.
std::vector< std::string > getGeometryNames() const
Returns the names of all geometry vectors.
const PolylineVec * getPolylineVecObj(const std::string &name) const
The class TemplateVec takes a unique name and manages a std::vector of pointers to data elements of t...
TCLAP::ValueArg< std::string > makeLogLevelArg()
void initOGSLogger(std::string const &log_level)
void readGeometryFromFile(std::string const &fname, GeoLib::GEOObjects &geo_objs, std::string const &gmsh_path)
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)