23int main(
int argc,
char* argv[])
26 "Sets the property value of a mesh element to a given new value iff at "
27 "least one node of the element is within a polygonal region that is "
28 "given by a polygon. The documentation is available at "
29 "https://docs.opengeosys.org/docs/tools/model-preparation/"
30 "set-properties-in-polygonal-region.\n\n"
31 "OpenGeoSys-6 software, version " +
34 "Copyright (c) 2012-2026, OpenGeoSys Community "
35 "(http://www.opengeosys.org)",
37 TCLAP::ValueArg<std::string> mesh_out(
38 "o",
"mesh-output-file",
39 "Output. The name of the file the mesh will be written to, format "
41 "the given file name extension",
42 true,
"",
"OUTPUT_FILE");
44 TCLAP::ValueArg<std::string> polygon_name_arg(
45 "p",
"polygon-name",
"name of polygon in the geometry",
true,
"",
47 cmd.add(polygon_name_arg);
48 TCLAP::ValueArg<std::string> geometry_fname(
50 "Input (.gli | .gml). The name of the file containing the input "
52 true,
"",
"INPUT_FILE");
53 cmd.add(geometry_fname);
54 TCLAP::SwitchArg any_of_arg(
56 "all nodes of an element has to be inside the polygon (default "
57 "behaviour without switch) or any node of an element has to be inside "
61 TCLAP::ValueArg<char> char_property_arg(
62 "c",
"char-property-value",
"new property value (data type char)",
63 false,
'A',
"CHAR_PROPERTY_VALUE");
64 cmd.add(char_property_arg);
65 TCLAP::ValueArg<int> int_property_arg(
"i",
"int-property-value",
66 "new property value (data type int)",
67 false, 0,
"INT_PROPERTY_VALUE");
68 cmd.add(int_property_arg);
69 TCLAP::ValueArg<std::string> property_name_arg(
70 "n",
"property-name",
"name of property in the mesh",
false,
71 "MaterialIDs",
"PROPERTY_NAME");
72 cmd.add(property_name_arg);
73 TCLAP::ValueArg<int> restrict_arg(
74 "r",
"restrict-to-MaterialID",
75 "Restrict resetting the property to the material id",
false, -1,
76 "RESTRICT_MATERIAL_ID");
77 cmd.add(restrict_arg);
78 TCLAP::ValueArg<std::string> mesh_in(
79 "m",
"mesh-input-file",
80 "Input (.vtu | .vtk | .msh). The name of the file containing the input "
82 true,
"",
"INPUT_FILE");
84 TCLAP::ValueArg<std::string> gmsh_path_arg(
85 "",
"gmsh-path",
"Input (.msh). The path to the input binary",
false,
87 cmd.add(gmsh_path_arg);
89 cmd.add(log_level_arg);
90 cmd.parse(argc, argv);
98 gmsh_path_arg.getValue());
107 ERR(
"Could not get vector of polylines out of geometry '{:s}'.",
117 ERR(
"Polyline '{:s}' not found.", polygon_name_arg.getValue());
124 ERR(
"Polyline '{:s}' is not closed, i.e. does not describe a region.",
125 polygon_name_arg.getValue());
132 auto mesh = std::unique_ptr<MeshLib::Mesh>(
139 std::string
const& property_name(property_name_arg.getValue());
141 if (char_property_arg.isSet())
144 *mesh, polygon, property_name, char_property_arg.getValue(),
145 restrict_arg.getValue(), any_of_arg.getValue());
148 if (int_property_arg.isSet())
151 *mesh, polygon, property_name, int_property_arg.getValue(),
152 restrict_arg.getValue(), any_of_arg.getValue());