32int main(
int argc,
char* argv[])
35 "Sets the property value of a mesh element to a given new value iff at "
36 "least one node of the element is within a polygonal region that is "
37 "given by a polygon. The documentation is available at "
38 "https://docs.opengeosys.org/docs/tools/model-preparation/"
39 "set-properties-in-polygonal-region.\n\n"
40 "OpenGeoSys-6 software, version " +
43 "Copyright (c) 2012-2025, OpenGeoSys Community "
44 "(http://www.opengeosys.org)",
46 TCLAP::ValueArg<std::string> mesh_out(
47 "o",
"mesh-output-file",
48 "Output. The name of the file the mesh will be written to, format "
50 "the given file name extension",
51 true,
"",
"OUTPUT_FILE");
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 "Input (.gli | .gml). The name of the file containing the input "
61 true,
"",
"INPUT_FILE");
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',
"CHAR_PROPERTY_VALUE");
73 cmd.add(char_property_arg);
74 TCLAP::ValueArg<int> int_property_arg(
"i",
"int-property-value",
75 "new property value (data type int)",
76 false, 0,
"INT_PROPERTY_VALUE");
77 cmd.add(int_property_arg);
78 TCLAP::ValueArg<std::string> property_name_arg(
79 "n",
"property-name",
"name of property in the mesh",
false,
80 "MaterialIDs",
"PROPERTY_NAME");
81 cmd.add(property_name_arg);
82 TCLAP::ValueArg<int> restrict_arg(
83 "r",
"restrict-to-MaterialID",
84 "Restrict resetting the property to the material id",
false, -1,
85 "RESTRICT_MATERIAL_ID");
86 cmd.add(restrict_arg);
87 TCLAP::ValueArg<std::string> mesh_in(
88 "m",
"mesh-input-file",
89 "Input (.vtu | .vtk | .msh). The name of the file containing the input "
91 true,
"",
"INPUT_FILE");
93 TCLAP::ValueArg<std::string> gmsh_path_arg(
94 "",
"gmsh-path",
"Input (.msh). The path to the input binary",
false,
96 cmd.add(gmsh_path_arg);
98 cmd.add(log_level_arg);
99 cmd.parse(argc, argv);
107 gmsh_path_arg.getValue());
116 ERR(
"Could not get vector of polylines out of geometry '{:s}'.",
126 ERR(
"Polyline '{:s}' not found.", polygon_name_arg.getValue());
133 ERR(
"Polyline '{:s}' is not closed, i.e. does not describe a region.",
134 polygon_name_arg.getValue());
141 auto mesh = std::unique_ptr<MeshLib::Mesh>(
148 std::string
const& property_name(property_name_arg.getValue());
150 if (char_property_arg.isSet())
153 *mesh, polygon, property_name, char_property_arg.getValue(),
154 restrict_arg.getValue(), any_of_arg.getValue());
157 if (int_property_arg.isSet())
160 *mesh, polygon, property_name, int_property_arg.getValue(),
161 restrict_arg.getValue(), any_of_arg.getValue());