11#include <tclap/CmdLine.h>
25std::unique_ptr<GeoLib::GEOObjects>
readGeometry(std::string
const& filename)
27 auto geo_objects = std::make_unique<GeoLib::GEOObjects>();
30 DBUG(
"Reading geometry file '{:s}'.", filename);
35int main(
int argc,
char* argv[])
38 "Converts a geometry defined on a given mesh to distinct meshes. The "
39 "documentation is available at "
40 "https://www.opengeosys.org/docs/tools/meshing-submeshes/"
41 "constructmeshesfromgeometry/.\n\n"
42 "OpenGeoSys-6 software, version " +
45 "Copyright (c) 2012-2025, OpenGeoSys Community "
46 "(http://www.opengeosys.org)",
49 TCLAP::ValueArg<double> search_length_arg(
52 "search length determining radius for the node search algorithm. "
53 "Non-negative floating point number, (min = 0)",
57 cmd.add(search_length_arg);
59 TCLAP::ValueArg<std::string> geometry_arg(
62 "Input (.gml | .gli). The file name of the input geometry",
66 cmd.add(geometry_arg);
68 TCLAP::ValueArg<std::string> mesh_arg(
72 "The file name of the input mesh where the geometry is defined",
78 TCLAP::SwitchArg multiple_nodes_allowed_arg(
79 "",
"multiple-nodes-allowed",
80 "Allows multiple mesh nodes in eps environment.");
81 cmd.add(multiple_nodes_allowed_arg);
84 cmd.add(log_level_arg);
85 cmd.parse(argc, argv);
90 std::unique_ptr<MeshLib::Mesh> mesh{
93 auto const geo_objects =
readGeometry(geometry_arg.getValue());
95 double const search_length = search_length_arg.getValue();
97 auto const extracted_meshes = constructAdditionalMeshesFromGeoObjects(
100 std::make_unique<MeshGeoToolsLib::SearchLength>(search_length),
101 multiple_nodes_allowed_arg.getValue());
103 for (
auto const& m_ptr : extracted_meshes)
107 ERR(
"Could not create a mesh for each given geometry.");
110 if (m_ptr->getNodes().empty())
113 "The created mesh '{:s}' hasn't any nodes or elements and thus "
114 "it isn't written to file.",
Definition of the BoostXmlGmlInterface class.
Definition of the GEOObjects class.
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition of the Mesh class.
Base class for different search length strategies.
bool readFile(const std::string &fname) override
Reads an xml-file containing OGS geometry.
int main(int argc, char *argv[])
std::unique_ptr< GeoLib::GEOObjects > readGeometry(std::string const &filename)
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 > variable_output_names)
Definition of readMeshFromFile function.