39int main(
int argc,
char* argv[])
42 "Generates properties for mesh elements of an input mesh deploying a "
43 "ASC raster file.\n\n"
44 "OpenGeoSys-6 software, version " +
47 "Copyright (c) 2012-2024, OpenGeoSys Community "
48 "(http://www.opengeosys.org)",
51 TCLAP::ValueArg<std::string> out_mesh_arg(
54 "the mesh is stored to a file of this name",
57 "filename for mesh output");
58 cmd.add(out_mesh_arg);
60 TCLAP::SwitchArg refinement_raster_output_arg(
61 "",
"output-refined-raster",
62 "Write refined raster to an additional, new ASC file.");
63 cmd.add(refinement_raster_output_arg);
65 TCLAP::ValueArg<unsigned> refinement_arg(
68 "refinement factor that raises the resolution of the raster data",
71 "factor (default = 1)");
72 cmd.add(refinement_arg);
74 TCLAP::ValueArg<std::string> raster_arg(
"",
76 "the name of the ASC raster file",
82 TCLAP::ValueArg<std::string> property_arg(
85 "the name of the property the values are stored for",
88 "property name as string");
89 cmd.add(property_arg);
91 TCLAP::ValueArg<std::string> mesh_arg(
92 "m",
"mesh",
"the mesh is read from this file",
true,
"",
"file name");
95 cmd.parse(argc, argv);
98 MPI_Init(&argc, &argv);
102 std::unique_ptr<MeshLib::Mesh> dest_mesh(
106 auto raster = std::unique_ptr<GeoLib::Raster>(
108 raster_arg.getValue()));
110 if (refinement_arg.getValue() > 1)
112 raster->refineRaster(refinement_arg.getValue());
113 if (refinement_raster_output_arg.getValue())
116 std::string new_raster_fname(
118 new_raster_fname +=
"-" + std::to_string(header.
n_rows) +
"x" +
119 std::to_string(header.
n_cols) +
".asc";
125 std::unique_ptr<MeshLib::Mesh> src_mesh(
129 property_arg.getValue()));
133 *src_mesh, property_arg.getValue());
136 if (!out_mesh_arg.getValue().empty())