28{
29 TCLAP::CmdLine cmd(
30 "Append line elements into a mesh.\n\n"
31 "OpenGeoSys-6 software, version " +
33 ".\n"
34 "Copyright (c) 2012-2024, OpenGeoSys Community "
35 "(http://www.opengeosys.org)",
37 TCLAP::ValueArg<std::string> mesh_in(
38 "i", "mesh-input-file",
39 "the name of the file containing the input mesh", true, "",
40 "file name of input mesh");
41 cmd.add(mesh_in);
42 TCLAP::ValueArg<std::string> mesh_out(
43 "o", "mesh-output-file",
44 "the name of the file the mesh will be written to", true, "",
45 "file name of output mesh");
46 cmd.add(mesh_out);
47 TCLAP::ValueArg<std::string> geoFileArg(
48 "g", "geo-file",
49 "the name of the geometry file which contains polylines", true, "",
50 "the name of the geometry file");
51 cmd.add(geoFileArg);
52
53 TCLAP::ValueArg<std::string> gmsh_path_arg("", "gmsh-path",
54 "the path to the gmsh binary",
55 false, "", "path as string");
56 cmd.add(gmsh_path_arg);
57
58
59 cmd.parse(argc, argv);
60
61#ifdef USE_PETSC
62 MPI_Init(&argc, &argv);
63#endif
64
65
68 gmsh_path_arg.getValue());
69
71 if (geo_names.empty())
72 {
73 ERR(
"No geometries found.");
74#ifdef USE_PETSC
75 MPI_Finalize();
76#endif
77 return EXIT_FAILURE;
78 }
81 if (!ply_vec)
82 {
83 ERR(
"Could not find polylines in geometry '{:s}'.", geo_names.front());
84#ifdef USE_PETSC
85 MPI_Finalize();
86#endif
87 return EXIT_FAILURE;
88 }
89
90
92 mesh_in.getValue(), true ));
93 if (!mesh)
94 {
95 ERR(
"Mesh file '{:s}' not found", mesh_in.getValue());
96#ifdef USE_PETSC
97 MPI_Finalize();
98#endif
99 return EXIT_FAILURE;
100 }
101 INFO(
"Mesh read: {:d} nodes, {:d} elements.", mesh->getNumberOfNodes(),
102 mesh->getNumberOfElements());
103
104
105 std::unique_ptr<MeshLib::Mesh> new_mesh =
107 INFO(
"Mesh created: {:d} nodes, {:d} elements.",
108 new_mesh->getNumberOfNodes(), new_mesh->getNumberOfElements());
109
111
112#ifdef USE_PETSC
113 MPI_Finalize();
114#endif
115 return EXIT_SUCCESS;
116}
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)