29const std::vector<std::pair<std::size_t, double>>&
31 const std::string& filename)
39 ERR(
"Error in DirectConditionGenerator::directToSurfaceNodes() - "
40 "could not load raster file.");
44 Eigen::Vector3d
const dir = -Eigen::Vector3d::UnitZ();
45 const std::vector<MeshLib::Node*> surface_nodes(
50 for (
auto const* surface_node : surface_nodes)
53 val = (val == no_data) ? 0 : val;
58 std::for_each(surface_nodes.begin(), surface_nodes.end(),
59 std::default_delete<MeshLib::Node>());
62 ERR(
"Error in DirectConditionGenerator::directToSurfaceNodes() - Data "
63 "vector contains outdated values.");
68const std::vector<std::pair<std::size_t, double>>&
70 MeshLib::Mesh& mesh,
const std::string& filename,
double scaling)
74 ERR(
"Error in DirectConditionGenerator::directWithSurfaceIntegration()"
75 "- Data vector contains outdated values...");
79 std::unique_ptr<GeoLib::Raster> raster(
83 ERR(
"Error in DirectConditionGenerator::directWithSurfaceIntegration()"
84 "- could not load raster file.");
88 Eigen::Vector3d
const dir({0.0, 0.0, -1.0});
89 double const angle(90);
91 std::unique_ptr<MeshLib::Mesh> surface_mesh(
95 std::vector<double> node_area_vec =
98 const std::vector<MeshLib::Node*>& surface_nodes(surface_mesh->getNodes());
99 const std::size_t nNodes(surface_mesh->getNumberOfNodes());
100 const double no_data(raster->getHeader().no_data);
105 node_id_pv = surface_mesh->getProperties().getPropertyVector<
int>(
108 catch (std::runtime_error
const& e)
110 WARN(
"{:s}", e.what());
115 for (std::size_t i = 0; i < nNodes; ++i)
117 double val(raster->getValueAtPoint(*surface_nodes[i]));
118 val = (val == no_data) ? 0 : ((val * node_area_vec[i]) / scaling);
127 std::ofstream out(name.c_str(), std::ios::out);
133 out << direct_value.first <<
"\t" << direct_value.second <<
"\n";
Definition of the AsciiRasterInterface class.
Definition of the DirectConditionGenerator class.
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition of the Mesh class.
Definition of the Node class.
Definition of the GeoLib::Raster class.
const std::vector< std::pair< std::size_t, double > > & directToSurfaceNodes(const MeshLib::Mesh &mesh, const std::string &filename)
std::vector< std::pair< std::size_t, double > > _direct_values
int writeToFile(const std::string &name) const
const std::vector< std::pair< std::size_t, double > > & directWithSurfaceIntegration(MeshLib::Mesh &mesh, const std::string &filename, double scaling)
static GeoLib::Raster * readRaster(std::string const &fname)
Class Raster is used for managing raster data.
double getValueAtPoint(const MathLib::Point3d &pnt) const
RasterHeader const & getHeader() const
Returns the complete header information.
constexpr std::string_view getBulkIDString(MeshItemType mesh_item_type)