10 #include <tclap/CmdLine.h>
21 std::unique_ptr<GeoLib::GEOObjects>
readGeometry(std::string
const& filename)
23 auto geo_objects = std::make_unique<GeoLib::GEOObjects>();
26 DBUG(
"Reading geometry file '{:s}'.", filename);
31 int main(
int argc,
char* argv[])
34 "Converts a geometry defined on a given mesh to distinct meshes. The "
35 "documentation is available at "
36 "https://www.opengeosys.org/docs/tools/meshing-submeshes/"
37 "constructmeshesfromgeometry/.\n\n"
38 "OpenGeoSys-6 software, version " +
41 "Copyright (c) 2012-2021, OpenGeoSys Community "
42 "(http://www.opengeosys.org)",
45 TCLAP::ValueArg<double> search_length_arg(
48 "search length determining radius for the node search algorithm. "
49 "Non-negative floating point number (default 1e-16) ",
53 cmd.add(search_length_arg);
55 TCLAP::ValueArg<std::string> geometry_arg(
"g",
57 "the file name the geometry",
60 "geometry file name");
61 cmd.add(geometry_arg);
63 TCLAP::ValueArg<std::string> mesh_arg(
66 "the file name of the mesh where the geometry is defined",
72 TCLAP::SwitchArg multiple_nodes_allowed_arg(
73 "",
"multiple-nodes-allowed",
74 "Allows multiple mesh nodes in eps environment.");
75 cmd.add(multiple_nodes_allowed_arg);
77 cmd.parse(argc, argv);
79 std::unique_ptr<MeshLib::Mesh> mesh{
82 auto const geo_objects =
readGeometry(geometry_arg.getValue());
84 double const search_length = search_length_arg.getValue();
89 std::make_unique<MeshGeoToolsLib::SearchLength>(search_length),
90 multiple_nodes_allowed_arg.getValue());
92 for (
auto const& m_ptr : extracted_meshes)
96 ERR(
"Could not create a mesh for each given geometry.");
99 if (m_ptr->getNodes().empty())
102 "The created mesh '{:s}' hasn't any nodes or elements and thus "
103 "it isn't written to file.",
Definition of the BoostXmlGmlInterface class.
Definition of the GEOObjects class.
void ERR(char const *fmt, Args const &... args)
void DBUG(char const *fmt, Args const &... args)
void WARN(char const *fmt, Args const &... 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)
GITINFOLIB_EXPORT const std::string ogs_version
MeshLib::Mesh * readMeshFromFile(const std::string &file_name)
int writeMeshToFile(const MeshLib::Mesh &mesh, std::filesystem::path const &file_path, [[maybe_unused]] std::set< std::string > variable_output_names)
Definition of readMeshFromFile function.