33int main(
int argc,
char* argv[])
36 "Sets the property value of a mesh element to a given new value iff at "
37 "least one node of the element is within a polygonal region that is "
38 "given by a polygon. The documentation is available at "
39 "https://docs.opengeosys.org/docs/tools/model-preparation/"
40 "set-properties-in-polygonal-region.\n\n"
41 "OpenGeoSys-6 software, version " +
44 "Copyright (c) 2012-2024, OpenGeoSys Community "
45 "(http://www.opengeosys.org)",
47 TCLAP::ValueArg<std::string> mesh_out(
48 "o",
"mesh-output-file",
49 "the name of the file the mesh will be written to, format depends on "
50 "the given file name extension",
51 true,
"",
"file name");
53 TCLAP::ValueArg<std::string> polygon_name_arg(
54 "p",
"polygon-name",
"name of polygon in the geometry",
true,
"",
56 cmd.add(polygon_name_arg);
57 TCLAP::ValueArg<std::string> geometry_fname(
59 "the name of the file containing the input geometry (gli or gml "
61 true,
"",
"file name");
62 cmd.add(geometry_fname);
63 TCLAP::SwitchArg any_of_arg(
65 "all nodes of an element has to be inside the polygon (default "
66 "behaviour without switch) or any node of an element has to be inside "
70 TCLAP::ValueArg<char> char_property_arg(
71 "c",
"char-property-value",
"new property value (data type char)",
72 false,
'A',
"character");
73 cmd.add(char_property_arg);
74 TCLAP::ValueArg<int> int_property_arg(
"i",
"int-property-value",
75 "new property value (data type int)",
77 cmd.add(int_property_arg);
78 TCLAP::ValueArg<bool> bool_property_arg(
79 "b",
"bool-property-value",
"new property value (data type bool)",
80 false,
false,
"boolean value");
81 cmd.add(bool_property_arg);
82 TCLAP::ValueArg<std::string> property_name_arg(
83 "n",
"property-name",
"name of property in the mesh",
false,
84 "MaterialIDs",
"string");
85 cmd.add(property_name_arg);
86 TCLAP::ValueArg<int> restrict_arg(
87 "r",
"restrict-to-MaterialID",
88 "Restrict resetting the property to the material id",
false, -1,
90 cmd.add(restrict_arg);
91 TCLAP::ValueArg<std::string> mesh_in(
92 "m",
"mesh-input-file",
93 "the name of the file containing the input mesh",
true,
"",
96 TCLAP::ValueArg<std::string> gmsh_path_arg(
"",
"gmsh-path",
97 "the path to the gmsh binary",
98 false,
"",
"path as string");
99 cmd.add(gmsh_path_arg);
100 cmd.parse(argc, argv);
103 MPI_Init(&argc, &argv);
109 gmsh_path_arg.getValue());
118 ERR(
"Could not get vector of polylines out of geometry '{:s}'.",
131 ERR(
"Polyline '{:s}' not found.", polygon_name_arg.getValue());
141 ERR(
"Polyline '{:s}' is not closed, i.e. does not describe a region.",
142 polygon_name_arg.getValue());
152 auto mesh = std::unique_ptr<MeshLib::Mesh>(
162 std::string
const& property_name(property_name_arg.getValue());
164 if (char_property_arg.isSet())
167 *mesh, polygon, property_name, char_property_arg.getValue(),
168 restrict_arg.getValue(), any_of_arg.getValue());
171 if (int_property_arg.isSet())
174 *mesh, polygon, property_name, int_property_arg.getValue(),
175 restrict_arg.getValue(), any_of_arg.getValue());
178 if (bool_property_arg.isSet())
181 *mesh, polygon, property_name, bool_property_arg.getValue(),
182 restrict_arg.getValue(), any_of_arg.getValue());