Alpine3D  Alpine3D-3.2.0
ViewFactorsHelbig.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 VIEWFACTORSHELBIG_H
19 #define VIEWFACTORSHELBIG_H
20 
21 #include <meteoio/MeteoIO.h>
24 
25 #include <string>
26 
28  public:
29  ViewFactorsHelbig(const mio::Config& cfg, const mio::DEMObject &dem_in);
30  double getSkyViewFactor(const int &i, const int &j);
31  void getSkyViewFactor(mio::Array2D<double> &o_sky_vf) const;
32  double GetViewfactor(const int i, const int j, const int a, const int b);
33  double getSymetricTerrainViewFactor(const int &i, const int &j);
34 
35  double min_area; // min (inclined) surface area
36  double min_vterr; // min terrain view factor
37  bool vf_in_ram;
38 
39  private:
40  mio::IOManager io;
41  mio::Array2D<double> sky_vf, vf_t;
42  double cellsize;
43  int dimx, dimy;
44  mio::DEMObject dem;
45  std::string vf_file_in, tvfarea_file_in; //where to read the sky view factors and the terrain view factor x surface
46  std::string vf_file_out, tvfarea_file_out; //where to write the sky view factors and the terrain view factor x surface
47  double sub_crit;
48  VFSymetricMatrix<float, double> vf; // view factor matrix with dynamic dimension
49  int LW_distance_index, SW_distance_index;
50 
51  const static double to_rad;
52 
53  const static double vf_thresh; //below this threshold, view factor is forced to 0
54 
55  double EuclidianDistance(const double x, const double y, const double z);
56  double DoubleRounding(const double aNumber, const double precision);
57  int GetStep(const int a, const int b);
58  double GetMax(const int step, const double azi, const bool x_Mode);
59  double GetDelta(const int step, const double azi, const bool x_Mode);
60  double GetPseudoAzimuth(const int i, const int j, const int m, const int t);
61  void GetNextCell(int& x, int& y, double& tMaxX, double& tMaxY,
62  const int stepsX, const int stepsY, const double tDeltaX, const double tDeltaY);
63  bool CellOutsideGrid(const int a, const int b);
64  double DistanceBetween2Cells(const int i, const int j, const int a, const int b, const double bz);
65  double DistanceOnTheBeamMiddleCell(const int i, const int j, const int a, const int b,
66  const int m, const int t, const double bz);
67  double DistanceOnTheBeamBorderCell(const int i, const int j, const int a, const int b,
68  const int m, const int t, const double bz);
69  bool IsAngleHigher(const double view_angleP, const int i, const int j, int &m, int &t);
70  bool Is2CellsVisible(int i, int j, int m, int t);
71  void ApplySunBorderTreatment(const int i, const int j, int &m, int &t);
72  int ComputeFirstObstacle(const double solar_elev, const int i, const int j, const int mt, const int tt,
73  int& horizon_x, int& horizon_y);
74  double GetZEdgeVector(const double z, const double nx, const double ny, const double deltaX, const double deltaY);
75  int GetSplitFactor(const double sideLength, const double dist);
76  double GetCoordinateForSmallCell(const double veca, const double vecb, const double vecc,
77  const int i, const int j, const int splitFactor);
78  double CosAngleBetween2Vectors(const double nx, const double ny, const double nz, const double bx,
79  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
double getSkyViewFactor(const int &i, const int &j)
Definition: ViewFactorsHelbig.cc:66
double min_vterr
Definition: ViewFactorsHelbig.h:36
Definition: ViewFactorsAlgorithm.h:21
double getSymetricTerrainViewFactor(const int &i, const int &j)
Definition: ViewFactorsHelbig.cc:923
double GetViewfactor(const int i, const int j, const int a, const int b)
Definition: ViewFactorsHelbig.cc:723
double min_area
Definition: ViewFactorsHelbig.h:35
ViewFactorsHelbig(const mio::Config &cfg, const mio::DEMObject &dem_in)
Definition: ViewFactorsHelbig.cc:32
Definition: ViewFactorsHelbig.h:27
bool vf_in_ram
Definition: ViewFactorsHelbig.h:37