21int main(
int argc,
char* argv[])
24 "Tool to create gmsh geometry (geo-file) out of a gml geometry.\n\n"
25 "OpenGeoSys-6 software, version " +
28 "Copyright (c) 2012-2024, OpenGeoSys Community "
29 "(http://www.opengeosys.org)",
31 TCLAP::ValueArg<std::string> geo_output_arg(
32 "o",
"output",
"output gmsh geometry file (*.geo)",
true,
"",
34 cmd.add(geo_output_arg);
35 TCLAP::MultiArg<std::string> geo_input_arg(
36 "i",
"input",
"input geometry file (*.gml)",
true,
"input file name");
37 cmd.add(geo_input_arg);
38 TCLAP::ValueArg<unsigned> max_number_of_points_in_quadtree_leaf_arg(
39 "",
"max_points_in_quadtree_leaf",
"positive number",
false, 2,
40 "max points in a quadtree leaf before the leaf is split");
41 cmd.add(max_number_of_points_in_quadtree_leaf_arg);
42 TCLAP::ValueArg<double> mesh_density_scaling_points_arg(
43 "",
"mesh_density_scaling_at_points",
"positive floating point number",
44 false, 0.2,
"desired mesh density at points");
45 cmd.add(mesh_density_scaling_points_arg);
46 TCLAP::ValueArg<double> mesh_density_scaling_stations_arg(
47 "",
"mesh_density_scaling_at_stations",
48 "positive floating point number",
false, 0.05,
49 "desired mesh density at stations");
50 cmd.add(mesh_density_scaling_stations_arg);
51 TCLAP::ValueArg<double> average_point_density_arg(
52 "a",
"average_point_density",
53 "average point density / average edge length as a positive floating "
56 "desired point density / edge length in homogeneous meshing approach");
57 cmd.add(average_point_density_arg);
58 TCLAP::SwitchArg homogeneous_flag(
59 "",
"homogeneous",
"Use Gmsh homogeneous meshing method.",
false);
60 cmd.add(homogeneous_flag);
61 TCLAP::ValueArg<std::string> merged_geometries_output(
62 "",
"write_merged_geometries",
63 "file name for the output of the internal created geometry (*.gml) "
64 "(useful for debugging the data)",
65 false,
"",
"output file name");
66 cmd.add(merged_geometries_output);
68 cmd.parse(argc, argv);
73 for (
auto const& geometry_name : geo_input_arg.getValue())
83 catch (std::runtime_error
const& err)
85 ERR(
"Failed to read file '{:s}'.", geometry_name);
86 ERR(
"{:s}", err.what());
89 INFO(
"Successfully read file '{:s}'.", geometry_name);
94 bool const rotate =
false;
95 bool const keep_preprocessed_geometry =
false;
99 if (homogeneous_flag.getValue())
101 double const average_mesh_density =
102 average_point_density_arg.getValue();
106 average_mesh_density, 0.0, 0, geo_names, rotate,
107 keep_preprocessed_geometry);
109 geo_output_arg.getValue());
113 unsigned const max_number_of_points_in_quadtree_leaf =
114 max_number_of_points_in_quadtree_leaf_arg.getValue();
115 double const mesh_density_scaling_points =
116 mesh_density_scaling_points_arg.getValue();
117 double const mesh_density_scaling_stations =
118 mesh_density_scaling_stations_arg.getValue();
122 mesh_density_scaling_points, mesh_density_scaling_stations,
123 max_number_of_points_in_quadtree_leaf, geo_names, rotate,
124 keep_preprocessed_geometry);
126 geo_output_arg.getValue());
129 catch (std::runtime_error& error)
131 ERR(
"{}", error.what());
132 if (merged_geometries_output.isSet())
137 merged_geometries_output.getValue());
142 "Hint: Using the command line flag "
143 "'--write_merged_geometries buggy_geometry.gml' allows "
144 "for better analysis of the problem.");
146 ERR(
"An error has occurred - programme will be terminated.");