22int main(
int argc,
char* argv[])
25 "Tool to create gmsh geometry (geo-file) out of a gml geometry.\n\n"
26 "OpenGeoSys-6 software, version " +
29 "Copyright (c) 2012-2025, OpenGeoSys Community "
30 "(http://www.opengeosys.org)",
32 TCLAP::ValueArg<std::string> geo_output_arg(
33 "o",
"output",
"Output (.geo) gmsh geometry file ",
true,
"",
35 cmd.add(geo_output_arg);
36 TCLAP::MultiArg<std::string> geo_input_arg(
37 "i",
"input",
"Input (.gml) geometry file",
true,
"INPUT_FILE");
38 cmd.add(geo_input_arg);
39 TCLAP::ValueArg<unsigned> max_number_of_points_in_quadtree_leaf_arg(
40 "",
"max_points_in_quadtree_leaf",
"positive number/ (min = 0)",
false,
41 2,
"POINTS_QUADTREE");
42 cmd.add(max_number_of_points_in_quadtree_leaf_arg);
43 TCLAP::ValueArg<double> mesh_density_scaling_points_arg(
44 "",
"mesh_density_scaling_at_points",
45 "positive floating point number, (min = 0)",
false, 0.2,
47 cmd.add(mesh_density_scaling_points_arg);
48 TCLAP::ValueArg<double> mesh_density_scaling_stations_arg(
49 "",
"mesh_density_scaling_at_stations",
50 "positive floating point number, (min = 0)",
false, 0.05,
52 cmd.add(mesh_density_scaling_stations_arg);
53 TCLAP::ValueArg<double> average_point_density_arg(
54 "a",
"average_point_density",
55 "average point density / average edge length as a positive floating "
56 "point number, (min = 0)",
57 false, 1,
"AVERAGE_POINT_DENSITY");
58 cmd.add(average_point_density_arg);
59 TCLAP::SwitchArg homogeneous_flag(
60 "",
"homogeneous",
"Use Gmsh homogeneous meshing method.",
false);
61 cmd.add(homogeneous_flag);
62 TCLAP::ValueArg<std::string> merged_geometries_output(
63 "",
"write_merged_geometries",
64 "Output (.gml). File name for the output of the internal created "
65 "geometry (useful for debugging the data)",
66 false,
"",
"OUTPUT_FILE");
67 cmd.add(merged_geometries_output);
69 cmd.add(log_level_arg);
71 cmd.parse(argc, argv);
77 for (
auto const& geometry_name : geo_input_arg.getValue())
87 catch (std::runtime_error
const& err)
89 ERR(
"Failed to read file '{:s}'.", geometry_name);
90 ERR(
"{:s}", err.what());
93 INFO(
"Successfully read file '{:s}'.", geometry_name);
98 bool const rotate =
false;
99 bool const keep_preprocessed_geometry =
false;
103 if (homogeneous_flag.getValue())
105 double const average_mesh_density =
106 average_point_density_arg.getValue();
110 average_mesh_density, 0.0, 0, geo_names, rotate,
111 keep_preprocessed_geometry);
113 geo_output_arg.getValue());
117 unsigned const max_number_of_points_in_quadtree_leaf =
118 max_number_of_points_in_quadtree_leaf_arg.getValue();
119 double const mesh_density_scaling_points =
120 mesh_density_scaling_points_arg.getValue();
121 double const mesh_density_scaling_stations =
122 mesh_density_scaling_stations_arg.getValue();
126 mesh_density_scaling_points, mesh_density_scaling_stations,
127 max_number_of_points_in_quadtree_leaf, geo_names, rotate,
128 keep_preprocessed_geometry);
130 geo_output_arg.getValue());
133 catch (std::runtime_error& error)
135 ERR(
"{}", error.what());
136 if (merged_geometries_output.isSet())
141 merged_geometries_output.getValue());
146 "Hint: Using the command line flag "
147 "'--write_merged_geometries buggy_geometry.gml' allows "
148 "for better analysis of the problem.");
150 ERR(
"An error has occurred - programme will be terminated.");