Alpine3D 20250608.8e11c36
ViewFactors.h
Go to the documentation of this file.
1/***********************************************************************************/
2/* Copyright 2009-2015 WSL Institute for Snow and Avalanche Research SLF-DAVOS */
3/***********************************************************************************/
4/* This file is part of Alpine3D.
5 Alpine3D is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 Alpine3D is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with Alpine3D. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef VIEWFACTORS_H
19#define VIEWFACTORS_H
20
21#include <meteoio/MeteoIO.h>
24
26
27 public:
28 ViewFactors(const mio::Config& cfg, const mio::DEMObject &dem_in);
29
30 double getSkyViewFactor(const int &i, const int &j) override;
31 double GetViewfactor(const int i, const int j, const int a, const int b);
32 double getSymetricTerrainViewFactor(const int &i, const int &j);
33 void setBoundarys(const unsigned int in_start_x, const unsigned int in_end_x, const unsigned int in_start_y, const unsigned int in_end_y);
34 void generate();
36
37 bool getVisibleMatrixEntry(const unsigned int i, const unsigned int j, const unsigned int m, const unsigned int t);
38
39 double min_area; // min (inclined) surface area
40 double min_vterr; // min terrain view factor
42
43 private:
44 VFSymetricMatrix<float, double> vf; // view factor matrix with dynamic dimension
45 VFSymetricMatrix<float, bool> visible; // visible matrix with dynamic dimension
46 mio::DEMObject dem;
47 mio::Array2D<double> sky_vf, vf_t;
48 double cellsize;
49 int dimx, dimy;
50 double sub_crit;
51 int LW_distance_index, SW_distance_index;
52
53 unsigned int start_x, end_x;
54 unsigned int start_y, end_y;
55
56 const static double to_rad;
57
58 const static double vf_thresh; //below this threshold, view factor is forced to 0
59
60 bool visible_matrix_filled;
61
62 double EuclidianDistance(const double x, const double y, const double z);
63 double DoubleRounding(const double aNumber, const double precision);
64 int GetStep(const int a, const int b);
65 double GetMax(const int step, const double azi, const bool x_Mode);
66 double GetDelta(const int step, const double azi, const bool x_Mode);
67 double GetPseudoAzimuth(const int i, const int j, const int m, const int t);
68 void GetNextCell(int &x, int &y, double &tMaxX, double &tMaxY, const int stepsX, const int stepsY, const double tDeltaX, const double tDeltaY);
69 bool CellOutsideGrid(const int a, const int b);
70 double DistanceBetween2Cells(const int i, const int j, const int a, const int b, const double bz);
71 double DistanceOnTheBeamMiddleCell(const int i, const int j, const int a, const int b, const int m, const int t, const double bz);
72 double DistanceOnTheBeamBorderCell(const int i, const int j, const int a, const int b, const int m, const int t, const double bz);
73 bool IsAngleHigher(const double view_angleP, const int i, const int j, int &m, int &t);
74 bool Is2CellsVisible(int i, int j, int m, int t);
75 void ApplySunBorderTreatment(const int i, const int j, int &m, int &t);
76 int ComputeFirstObstacle(const double solar_elev, const int i, const int j, const int mt, const int tt, int& horizon_x, int& horizon_y);
77 double GetZEdgeVector(const double z, const double nx, const double ny, const double deltaX, const double deltaY);
78 int GetSplitFactor(const double sideLength, const double dist);
79 double GetCoordinateForSmallCell(const double veca, const double vecb, const double vecc, const int i, const int j, const int splitFactor);
80 double CosAngleBetween2Vectors(const double nx, const double ny, const double nz, const double bx, const double by, const double bz);
81 double GetSymetricPartOfViewFactor(const int i, const int j, const int a, const int b);
82 int InitGridViewFactors();
83 int InitSkyViewFactors();
84 bool InitializeViewFactor();
85
86 void setVF_IN_RAM(bool);
87};
88
89#endif
Definition: ViewFactorsAlgorithm.h:21
Definition: ViewFactors.h:25
void generate()
Definition: ViewFactors.cc:60
double min_area
Definition: ViewFactors.h:39
double min_vterr
Definition: ViewFactors.h:40
void setBoundarys(const unsigned int in_start_x, const unsigned int in_end_x, const unsigned int in_start_y, const unsigned int in_end_y)
Definition: ViewFactors.cc:947
ViewFactors(const mio::Config &cfg, const mio::DEMObject &dem_in)
Definition: ViewFactors.cc:29
double getSymetricTerrainViewFactor(const int &i, const int &j)
Definition: ViewFactors.cc:941
bool vf_in_ram
Definition: ViewFactors.h:41
double getSkyViewFactor(const int &i, const int &j) override
Definition: ViewFactors.cc:72
double GetViewfactor(const int i, const int j, const int a, const int b)
Definition: ViewFactors.cc:758
void generate_visible_matrix()
Definition: ViewFactors.cc:405
bool getVisibleMatrixEntry(const unsigned int i, const unsigned int j, const unsigned int m, const unsigned int t)
Definition: ViewFactors.cc:430