Alpine3D 20240518.11e082c
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 double getSkyViewFactor(const int &i, const int &j);
30 double GetViewfactor(const int i, const int j, const int a, const int b);
31 double getSymetricTerrainViewFactor(const int &i, const int &j);
32 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);
33 void generate();
35
36 bool getVisibleMatrixEntry(const unsigned int i, const unsigned int j, const unsigned int m, const unsigned int t);
37
38 double min_area; // min (inclined) surface area
39 double min_vterr; // min terrain view factor
41
42 private:
43 VFSymetricMatrix<float, double> vf; // view factor matrix with dynamic dimension
44 VFSymetricMatrix<float, bool> visible; // visible matrix with dynamic dimension
45 mio::DEMObject dem;
46 mio::Array2D<double> sky_vf, vf_t;
47 double cellsize;
48 int dimx, dimy;
49 double sub_crit;
50 int LW_distance_index, SW_distance_index;
51
52 unsigned int start_x, end_x;
53 unsigned int start_y, end_y;
54
55 const static double to_rad;
56
57 const static double vf_thresh; //below this threshold, view factor is forced to 0
58
59 bool visible_matrix_filled;
60
61 double EuclidianDistance(const double x, const double y, const double z);
62 double DoubleRounding(const double aNumber, const double precision);
63 int GetStep(const int a, const int b);
64 double GetMax(const int step, const double azi, const bool x_Mode);
65 double GetDelta(const int step, const double azi, const bool x_Mode);
66 double GetPseudoAzimuth(const int i, const int j, const int m, const int t);
67 void GetNextCell(int &x, int &y, double &tMaxX, double &tMaxY, const int stepsX, const int stepsY, const double tDeltaX, const double tDeltaY);
68 bool CellOutsideGrid(const int a, const int b);
69 double DistanceBetween2Cells(const int i, const int j, const int a, const int b, const double bz);
70 double DistanceOnTheBeamMiddleCell(const int i, const int j, const int a, const int b, const int m, const int t, const double bz);
71 double DistanceOnTheBeamBorderCell(const int i, const int j, const int a, const int b, const int m, const int t, const double bz);
72 bool IsAngleHigher(const double view_angleP, const int i, const int j, int &m, int &t);
73 bool Is2CellsVisible(int i, int j, int m, int t);
74 void ApplySunBorderTreatment(const int i, const int j, int &m, int &t);
75 int ComputeFirstObstacle(const double solar_elev, const int i, const int j, const int mt, const int tt, int& horizon_x, int& horizon_y);
76 double GetZEdgeVector(const double z, const double nx, const double ny, const double deltaX, const double deltaY);
77 int GetSplitFactor(const double sideLength, const double dist);
78 double GetCoordinateForSmallCell(const double veca, const double vecb, const double vecc, const int i, const int j, const int splitFactor);
79 double CosAngleBetween2Vectors(const double nx, const double ny, const double nz, const double bx, const double by, const double bz);
80 double GetSymetricPartOfViewFactor(const int i, const int j, const int a, const int b);
81 int InitGridViewFactors();
82 int InitSkyViewFactors();
83 bool InitializeViewFactor();
84
85 void setVF_IN_RAM(bool);
86};
87
88#endif
Definition: ViewFactorsAlgorithm.h:21
Definition: ViewFactors.h:25
void generate()
Definition: ViewFactors.cc:60
double min_area
Definition: ViewFactors.h:38
double min_vterr
Definition: ViewFactors.h:39
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:40
double getSkyViewFactor(const int &i, const int &j)
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