Skip to content
Snippets Groups Projects
Commit b136a974 authored by Tom Fischer's avatar Tom Fischer
Browse files

[A/U/ME] Clang fmt. ResetPropertiesInPolygonalRegion.

parent 8f08e7ec
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,7 @@
#include "MeshLib/IO/writeMeshToFile.h"
#include "MeshLib/Mesh.h"
int main (int argc, char* argv[])
int main(int argc, char* argv[])
{
ApplicationsLib::LogogSetup logog_setup;
......@@ -41,37 +41,47 @@ int main (int argc, char* argv[])
"Copyright (c) 2012-2019, OpenGeoSys Community "
"(http://www.opengeosys.org)",
' ', BaseLib::BuildInfo::ogs_version);
TCLAP::ValueArg<std::string> mesh_out("o", "mesh-output-file",
TCLAP::ValueArg<std::string> mesh_out(
"o", "mesh-output-file",
"the name of the file the mesh will be written to, format depends on "
"the given file name extension", true, "", "file name");
"the given file name extension",
true, "", "file name");
cmd.add(mesh_out);
TCLAP::ValueArg<std::string> polygon_name_arg("p", "polygon-name",
"name of polygon in the geometry", true, "", "string");
TCLAP::ValueArg<std::string> polygon_name_arg(
"p", "polygon-name", "name of polygon in the geometry", true, "",
"string");
cmd.add(polygon_name_arg);
TCLAP::ValueArg<std::string> geometry_fname("g", "geometry", "the name of "
"the file containing the input geometry (gli or gml format)", true,
"", "file name");
TCLAP::ValueArg<std::string> geometry_fname(
"g", "geometry",
"the name of "
"the file containing the input geometry (gli or gml format)",
true, "", "file name");
cmd.add(geometry_fname);
TCLAP::ValueArg<char> char_property_arg("c", "char-property-value",
"new property value (data type char)", false, 'A', "character");
TCLAP::ValueArg<char> char_property_arg(
"c", "char-property-value", "new property value (data type char)",
false, 'A', "character");
cmd.add(char_property_arg);
TCLAP::ValueArg<int> int_property_arg("i", "int-property-value",
"new property value (data type int)", false, 0, "number");
"new property value (data type int)",
false, 0, "number");
cmd.add(int_property_arg);
TCLAP::ValueArg<bool> bool_property_arg("b", "bool-property-value",
"new property value (data type bool)", false, false, "boolean value");
TCLAP::ValueArg<bool> bool_property_arg(
"b", "bool-property-value", "new property value (data type bool)",
false, false, "boolean value");
cmd.add(bool_property_arg);
TCLAP::ValueArg<std::string> property_name_arg("n", "property-name",
"name of property in the mesh", false, "MaterialIDs", "string");
TCLAP::ValueArg<std::string> property_name_arg(
"n", "property-name", "name of property in the mesh", false,
"MaterialIDs", "string");
cmd.add(property_name_arg);
TCLAP::ValueArg<int> restrict_arg(
"r", "restrict-to-MaterialID",
"Restrict reseting the property to the material id", false, -1,
"MaterialID");
cmd.add(restrict_arg);
TCLAP::ValueArg<std::string> mesh_in("m", "mesh-input-file",
"the name of the file containing the input mesh", true,
"", "file name");
TCLAP::ValueArg<std::string> mesh_in(
"m", "mesh-input-file",
"the name of the file containing the input mesh", true, "",
"file name");
cmd.add(mesh_in);
TCLAP::ValueArg<std::string> gmsh_path_arg("", "gmsh-path",
"the path to the gmsh binary",
......@@ -94,7 +104,8 @@ int main (int argc, char* argv[])
// *** check if the data is usable
// *** get vector of polylines
GeoLib::PolylineVec const* plys(geometries.getPolylineVecObj(geo_name));
if (!plys) {
if (!plys)
{
ERR("Could not get vector of polylines out of geometry '%s'.",
geo_name.c_str());
return EXIT_FAILURE;
......@@ -102,19 +113,18 @@ int main (int argc, char* argv[])
// *** get polygon
GeoLib::Polyline const* ply(
plys->getElementByName(polygon_name_arg.getValue())
);
if (! ply) {
plys->getElementByName(polygon_name_arg.getValue()));
if (!ply)
{
ERR("Polyline '%s' not found.", polygon_name_arg.getValue().c_str());
return EXIT_FAILURE;
}
// *** check if the polyline is closed (i.e. is a polygon)
bool closed (ply->isClosed());
bool closed(ply->isClosed());
if (!closed)
{
ERR("Polyline '%s' is not closed, i.e. does not describe a\
region.",
ERR("Polyline '%s' is not closed, i.e. does not describe a region.",
polygon_name_arg.getValue().c_str());
return EXIT_FAILURE;
}
......@@ -131,19 +141,22 @@ int main (int argc, char* argv[])
}
std::string const& property_name(property_name_arg.getValue());
if (char_property_arg.isSet()) {
if (char_property_arg.isSet())
{
MeshGeoToolsLib::resetMeshElementProperty(*mesh, polygon, property_name,
char_property_arg.getValue(),
restrict_arg.getValue());
}
if (int_property_arg.isSet()) {
if (int_property_arg.isSet())
{
MeshGeoToolsLib::resetMeshElementProperty(*mesh, polygon, property_name,
int_property_arg.getValue(),
restrict_arg.getValue());
}
if (bool_property_arg.isSet()) {
if (bool_property_arg.isSet())
{
MeshGeoToolsLib::resetMeshElementProperty(*mesh, polygon, property_name,
bool_property_arg.getValue(),
restrict_arg.getValue());
......@@ -152,7 +165,8 @@ int main (int argc, char* argv[])
std::vector<std::string> property_names(
mesh->getProperties().getPropertyVectorNames());
INFO("Mesh contains %d property vectors:", property_names.size());
for (const auto& name : property_names) {
for (const auto& name : property_names)
{
INFO("- %s", name.c_str());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment