36int main(
int argc,
char* argv[])
39 "Generates properties for mesh elements of an input mesh deploying a "
40 "ASC raster file.\n\n"
41 "OpenGeoSys-6 software, version " +
44 "Copyright (c) 2012-2024, OpenGeoSys Community "
45 "(http://www.opengeosys.org)",
48 TCLAP::ValueArg<std::string> out_mesh_arg(
51 "the mesh is stored to a file of this name",
54 "filename for mesh output");
55 cmd.add(out_mesh_arg);
57 TCLAP::SwitchArg refinement_raster_output_arg(
58 "",
"output-refined-raster",
59 "Write refined raster to an additional, new ASC file.");
60 cmd.add(refinement_raster_output_arg);
62 TCLAP::ValueArg<unsigned> refinement_arg(
65 "refinement factor that raises the resolution of the raster data",
68 "factor (default = 1)");
69 cmd.add(refinement_arg);
71 TCLAP::ValueArg<std::string> raster_arg(
"",
73 "the name of the ASC raster file",
79 TCLAP::ValueArg<std::string> property_arg(
82 "the name of the property the values are stored for",
85 "property name as string");
86 cmd.add(property_arg);
88 TCLAP::ValueArg<std::string> mesh_arg(
89 "m",
"mesh",
"the mesh is read from this file",
true,
"",
"file name");
92 cmd.parse(argc, argv);
97 std::unique_ptr<MeshLib::Mesh> dest_mesh(
101 auto raster = std::unique_ptr<GeoLib::Raster>(
103 raster_arg.getValue()));
105 if (refinement_arg.getValue() > 1)
107 raster->refineRaster(refinement_arg.getValue());
108 if (refinement_raster_output_arg.getValue())
111 std::string new_raster_fname(
113 new_raster_fname +=
"-" + std::to_string(header.
n_rows) +
"x" +
114 std::to_string(header.
n_cols) +
".asc";
120 std::unique_ptr<MeshLib::Mesh> src_mesh(
124 property_arg.getValue()));
128 *src_mesh, property_arg.getValue());
131 if (!out_mesh_arg.getValue().empty())