12 #include <tclap/CmdLine.h>
23 int main(
int argc,
char* argv[])
26 "Adds a layer to an existing mesh."
27 "The documentation is available at "
28 "https://docs.opengeosys.org/docs/tools/meshing/addlayer.\n\n"
29 "OpenGeoSys-6 software, version " +
32 "Copyright (c) 2012-2021, OpenGeoSys Community "
33 "(http://www.opengeosys.org)",
35 TCLAP::ValueArg<std::string> mesh_arg(
36 "i",
"input-mesh-file",
"the name of the file containing the mesh",
37 true,
"",
"file name");
40 TCLAP::ValueArg<std::string> mesh_out_arg(
41 "o",
"output-mesh-file",
42 "the name of the file the mesh should be written to (vtu format)",
true,
44 cmd.add(mesh_out_arg);
46 TCLAP::ValueArg<double> layer_thickness_arg(
47 "t",
"layer-tickness",
"the thickness of the new layer",
false, 10,
48 "floating point value");
49 cmd.add(layer_thickness_arg);
51 TCLAP::SwitchArg layer_position_arg(
52 "",
"add-layer-on-bottom",
53 "Per default the layer is add on the top, if this argument is set the "
54 "layer is add on the bottom.",
56 cmd.add(layer_position_arg);
58 TCLAP::SwitchArg copy_material_ids_arg(
59 "",
"copy-material-ids",
60 "Copy the existing material distribution of the layer which is to be "
61 "extended. If the switch isn't given a new material id will be "
64 cmd.add(copy_material_ids_arg);
66 cmd.parse(argc, argv);
68 INFO(
"Reading mesh '{:s}' ... ", mesh_arg.getValue());
69 auto subsfc_mesh = std::unique_ptr<MeshLib::Mesh>(
73 ERR(
"Error reading mesh '{:s}'.", mesh_arg.getValue());
79 *subsfc_mesh, layer_thickness_arg.getValue(), mesh_out_arg.getValue(),
80 layer_position_arg.getValue(), copy_material_ids_arg.getValue()));
83 ERR(
"Failure while adding layer.");
87 INFO(
"Writing mesh '{:s}' ... ", mesh_out_arg.getValue());
Definition of AddLayerToMesh class.
int main(int argc, char *argv[])
void INFO(char const *fmt, Args const &... args)
void ERR(char const *fmt, Args const &... args)
Definition of the Mesh class.
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)
MeshLib::Mesh * addLayerToMesh(MeshLib::Mesh const &mesh, double thickness, std::string const &name, bool on_top, bool copy_material_ids)
Definition of readMeshFromFile function.