25{
26 TCLAP::CmdLine cmd(
27 "Append line elements into a mesh.\n\n"
28 "OpenGeoSys-6 software, version " +
30 ".\n"
31 "Copyright (c) 2012-2025, OpenGeoSys Community "
32 "(http://www.opengeosys.org)",
34 TCLAP::ValueArg<std::string> mesh_in(
35 "i", "mesh-input-file",
36 "Input (.vtu). The name of the file containing the input mesh", true,
37 "", "INPUT_FILE");
38 cmd.add(mesh_in);
39 TCLAP::ValueArg<std::string> mesh_out(
40 "o", "mesh-output-file",
41 "Output (.vtu | .msh). The name of the file the mesh will be written "
42 "to",
43 true, "", "OUTPUT_FILE");
44 cmd.add(mesh_out);
45 TCLAP::ValueArg<std::string> geoFileArg(
46 "g", "geo-file",
47 "Input (.gml). The name of the input geometry file which contains "
48 "polylines",
49 true, "", "INPUT_FILE");
50 cmd.add(geoFileArg);
51
52 TCLAP::ValueArg<std::string> gmsh_path_arg(
53 "", "gmsh-path", "Input (.msh). The path to the input gmsh binary file",
54 false, "", "INPUT_FILE");
55 cmd.add(gmsh_path_arg);
56
57
58 cmd.parse(argc, argv);
59
61
62
65 gmsh_path_arg.getValue());
66
68 if (geo_names.empty())
69 {
70 ERR(
"No geometries found.");
71 return EXIT_FAILURE;
72 }
75 if (!ply_vec)
76 {
77 ERR(
"Could not find polylines in geometry '{:s}'.", geo_names.front());
78 return EXIT_FAILURE;
79 }
80
81
83 mesh_in.getValue(), true ));
84 if (!mesh)
85 {
86 ERR(
"Mesh file '{:s}' not found", mesh_in.getValue());
87 return EXIT_FAILURE;
88 }
89 INFO(
"Mesh read: {:d} nodes, {:d} elements.", mesh->getNumberOfNodes(),
90 mesh->getNumberOfElements());
91
92
93 std::unique_ptr<MeshLib::Mesh> new_mesh =
95 INFO(
"Mesh created: {:d} nodes, {:d} elements.",
96 new_mesh->getNumberOfNodes(), new_mesh->getNumberOfElements());
97
99
100 return EXIT_SUCCESS;
101}
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...
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)