12 #include <tclap/CmdLine.h>
30 int main(
int argc,
char* argv[])
33 "Tool extracts the boundary of the given mesh. The documentation is "
35 "https://docs.opengeosys.org/docs/tools/meshing-submeshes/"
36 "extract-boundary.\n\n"
37 "OpenGeoSys-6 software, version " +
40 "Copyright (c) 2012-2021, OpenGeoSys Community "
41 "(http://www.opengeosys.org)",
43 TCLAP::ValueArg<std::string> mesh_in(
44 "i",
"mesh-input-file",
45 "the name of the file containing the input mesh",
true,
"",
46 "file name of input mesh");
48 TCLAP::ValueArg<std::string> mesh_out(
49 "o",
"mesh-output-file",
50 "the name of the file the surface mesh should be written to",
false,
"",
51 "file name of output mesh");
54 TCLAP::ValueArg<std::string> node_prop_name(
55 "n",
"node-property-name",
56 "the name of the data array the subsurface/bulk node id will be stored "
58 false,
"bulk_node_ids",
"string");
59 cmd.add(node_prop_name);
60 TCLAP::ValueArg<std::string> element_prop_name(
61 "e",
"element-property-name",
62 "the name of the data array the subsurface/bulk element id will be "
64 false,
"bulk_element_ids",
"string");
65 cmd.add(element_prop_name);
66 TCLAP::ValueArg<std::string> face_prop_name(
67 "f",
"face-property-name",
68 "the name of the data array the surface face id of the subsurface/bulk "
69 "element will be stored to",
70 false,
"bulk_face_ids",
"string");
71 cmd.add(face_prop_name);
73 TCLAP::SwitchArg use_ascii_arg(
"",
"ascii-output",
74 "If the switch is set use ascii instead of "
75 "binary format for data in the vtu output.",
77 cmd.add(use_ascii_arg);
79 cmd.parse(argc, argv);
81 std::unique_ptr<MeshLib::Mesh const> mesh(
89 INFO(
"Mesh read: {:d} nodes, {:d} elements.", mesh->getNumberOfNodes(),
90 mesh->getNumberOfElements());
93 std::unique_ptr<MeshLib::Mesh> surface_mesh(
95 *mesh, node_prop_name.getValue(), element_prop_name.getValue(),
96 face_prop_name.getValue()));
98 INFO(
"Created surface mesh: {:d} nodes, {:d} elements.",
99 surface_mesh->getNumberOfNodes(), surface_mesh->getNumberOfElements());
101 std::string out_fname(mesh_out.getValue());
102 if (out_fname.empty())
107 auto const data_mode =
108 use_ascii_arg.getValue() ? vtkXMLWriter::Ascii : vtkXMLWriter::Binary;
Definition of the Element class.
void INFO(char const *fmt, Args const &... args)
Definition of the Mesh class.
Definition of the Node class.
Implementation of the VtuInterface class.
std::string dropFileExtension(std::string const &filename)
GITINFOLIB_EXPORT const std::string ogs_version
int writeVtu(MeshLib::Mesh const &mesh, std::string const &file_name, int const data_mode)
MeshLib::Mesh * readMeshFromFile(const std::string &file_name)
Definition of readMeshFromFile function.