14int main(
int argc,
char* argv[])
17 "Tool to create gmsh geometry (geo-file) out of a gml geometry.\n\n"
18 "OpenGeoSys-6 software, version " +
21 "Copyright (c) 2012-2026, OpenGeoSys Community "
22 "(http://www.opengeosys.org)",
24 TCLAP::ValueArg<std::string> geo_output_arg(
25 "o",
"output",
"Output (.geo) gmsh geometry file ",
true,
"",
27 cmd.add(geo_output_arg);
28 TCLAP::MultiArg<std::string> geo_input_arg(
29 "i",
"input",
"Input (.gml) geometry file",
true,
"INPUT_FILE");
30 cmd.add(geo_input_arg);
31 TCLAP::ValueArg<unsigned> max_number_of_points_in_quadtree_leaf_arg(
32 "",
"max_points_in_quadtree_leaf",
"positive number/ (min = 0)",
false,
33 2,
"POINTS_QUADTREE");
34 cmd.add(max_number_of_points_in_quadtree_leaf_arg);
35 TCLAP::ValueArg<double> mesh_density_scaling_points_arg(
36 "",
"mesh_density_scaling_at_points",
37 "positive floating point number, (min = 0)",
false, 0.2,
39 cmd.add(mesh_density_scaling_points_arg);
40 TCLAP::ValueArg<double> mesh_density_scaling_stations_arg(
41 "",
"mesh_density_scaling_at_stations",
42 "positive floating point number, (min = 0)",
false, 0.05,
44 cmd.add(mesh_density_scaling_stations_arg);
45 TCLAP::ValueArg<double> average_point_density_arg(
46 "a",
"average_point_density",
47 "average point density / average edge length as a positive floating "
48 "point number, (min = 0)",
49 false, 1,
"AVERAGE_POINT_DENSITY");
50 cmd.add(average_point_density_arg);
51 TCLAP::SwitchArg homogeneous_flag(
52 "",
"homogeneous",
"Use Gmsh homogeneous meshing method.",
false);
53 cmd.add(homogeneous_flag);
54 TCLAP::ValueArg<std::string> merged_geometries_output(
55 "",
"write_merged_geometries",
56 "Output (.gml). File name for the output of the internal created "
57 "geometry (useful for debugging the data)",
58 false,
"",
"OUTPUT_FILE");
59 cmd.add(merged_geometries_output);
61 cmd.add(log_level_arg);
63 cmd.parse(argc, argv);
69 for (
auto const& geometry_name : geo_input_arg.getValue())
79 catch (std::runtime_error
const& err)
81 ERR(
"Failed to read file '{:s}'.", geometry_name);
82 ERR(
"{:s}", err.what());
85 INFO(
"Successfully read file '{:s}'.", geometry_name);
90 bool const rotate =
false;
91 bool const keep_preprocessed_geometry =
false;
95 if (homogeneous_flag.getValue())
97 double const average_mesh_density =
98 average_point_density_arg.getValue();
102 average_mesh_density, 0.0, 0, geo_names, rotate,
103 keep_preprocessed_geometry);
105 geo_output_arg.getValue());
109 unsigned const max_number_of_points_in_quadtree_leaf =
110 max_number_of_points_in_quadtree_leaf_arg.getValue();
111 double const mesh_density_scaling_points =
112 mesh_density_scaling_points_arg.getValue();
113 double const mesh_density_scaling_stations =
114 mesh_density_scaling_stations_arg.getValue();
118 mesh_density_scaling_points, mesh_density_scaling_stations,
119 max_number_of_points_in_quadtree_leaf, geo_names, rotate,
120 keep_preprocessed_geometry);
122 geo_output_arg.getValue());
125 catch (std::runtime_error& error)
127 ERR(
"{}", error.what());
128 if (merged_geometries_output.isSet())
133 merged_geometries_output.getValue());
138 "Hint: Using the command line flag "
139 "'--write_merged_geometries buggy_geometry.gml' allows "
140 "for better analysis of the problem.");
142 ERR(
"An error has occurred - programme will be terminated.");