31 "Sets the property value of a mesh element to a given new value iff at "
32 "least one node of the element is within a polygonal region that is "
33 "given by a polygon. The documentation is available at "
34 "https://docs.opengeosys.org/docs/tools/model-preparation/"
35 "set-properties-in-polygonal-region.\n\n"
36 "OpenGeoSys-6 software, version " +
39 "Copyright (c) 2012-2021, OpenGeoSys Community "
40 "(http://www.opengeosys.org)",
42 TCLAP::ValueArg<std::string> mesh_out(
43 "o",
"mesh-output-file",
44 "the name of the file the mesh will be written to, format depends on "
45 "the given file name extension",
46 true,
"",
"file name");
48 TCLAP::ValueArg<std::string> polygon_name_arg(
49 "p",
"polygon-name",
"name of polygon in the geometry",
true,
"",
51 cmd.add(polygon_name_arg);
52 TCLAP::ValueArg<std::string> geometry_fname(
54 "the name of the file containing the input geometry (gli or gml "
56 true,
"",
"file name");
57 cmd.add(geometry_fname);
58 TCLAP::SwitchArg any_of_arg(
60 "all nodes of an element has to be inside the polygon (default "
61 "behaviour without switch) or any node of an element has to be inside "
65 TCLAP::ValueArg<char> char_property_arg(
66 "c",
"char-property-value",
"new property value (data type char)",
67 false,
'A',
"character");
68 cmd.add(char_property_arg);
69 TCLAP::ValueArg<int> int_property_arg(
"i",
"int-property-value",
70 "new property value (data type int)",
72 cmd.add(int_property_arg);
73 TCLAP::ValueArg<bool> bool_property_arg(
74 "b",
"bool-property-value",
"new property value (data type bool)",
75 false,
false,
"boolean value");
76 cmd.add(bool_property_arg);
77 TCLAP::ValueArg<std::string> property_name_arg(
78 "n",
"property-name",
"name of property in the mesh",
false,
79 "MaterialIDs",
"string");
80 cmd.add(property_name_arg);
81 TCLAP::ValueArg<int> restrict_arg(
82 "r",
"restrict-to-MaterialID",
83 "Restrict resetting the property to the material id",
false, -1,
85 cmd.add(restrict_arg);
86 TCLAP::ValueArg<std::string> mesh_in(
87 "m",
"mesh-input-file",
88 "the name of the file containing the input mesh",
true,
"",
91 TCLAP::ValueArg<std::string> gmsh_path_arg(
"",
"gmsh-path",
92 "the path to the gmsh binary",
93 false,
"",
"path as string");
94 cmd.add(gmsh_path_arg);
95 cmd.parse(argc, argv);
100 gmsh_path_arg.getValue());
109 ERR(
"Could not get vector of polylines out of geometry '{:s}'.",
116 plys->getElementByName(polygon_name_arg.getValue()));
119 ERR(
"Polyline '{:s}' not found.", polygon_name_arg.getValue());
124 if (!ply->isClosed())
126 ERR(
"Polyline '{:s}' is not closed, i.e. does not describe a region.",
127 polygon_name_arg.getValue());
134 auto mesh = std::unique_ptr<MeshLib::Mesh>(
141 std::string
const& property_name(property_name_arg.getValue());
143 if (char_property_arg.isSet())
146 *mesh, polygon, property_name, char_property_arg.getValue(),
147 restrict_arg.getValue(), any_of_arg.getValue());
150 if (int_property_arg.isSet())
153 *mesh, polygon, property_name, int_property_arg.getValue(),
154 restrict_arg.getValue(), any_of_arg.getValue());
157 if (bool_property_arg.isSet())
160 *mesh, polygon, property_name, bool_property_arg.getValue(),
161 restrict_arg.getValue(), any_of_arg.getValue());
void ERR(char const *fmt, Args const &... 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
Class Polyline consists mainly of a reference to a point vector and a vector that stores the indices ...
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)
int writeMeshToFile(const MeshLib::Mesh &mesh, std::filesystem::path const &file_path, [[maybe_unused]] std::set< std::string > variable_output_names)