Alpine3D  Alpine3D-3.1.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
SnowpackInterfaceWorker Class Reference

#include <SnowpackInterfaceWorker.h>

Public Member Functions

 SnowpackInterfaceWorker (const mio::Config &io_cfg, const mio::DEMObject &dem_in, const mio::Grid2DObject &landuse_in, const std::vector< std::pair< size_t, size_t > > &pts_in, const std::vector< SnowStation * > &snow_stations, const size_t offset_in)
 Constructs and initialise Snowpack Interface Worker. Create one worker and init values for slice which the worker need to simulate it slice. More...
 
 ~SnowpackInterfaceWorker ()
 
void setUseDrift (const bool useDrift_in)
 
void setUseEBalance (const bool useEBalance_in)
 
void getOutputSNO (std::vector< SnowStation * > &snow_station) const
 method that returns SnowCover files for specific date. More...
 
void getOutputSpecialPoints (std::vector< SnowStation * > &ptr_snow_pixel, std::vector< CurrentMeteo * > &ptr_meteo_pixel, std::vector< SurfaceFluxes * > &ptr_surface_flux)
 
void clearSpecialPointsData ()
 
void getGrid (const SnGrids::Parameters &param, mio::Grid2DObject &o_grid2D) const
 Method that the Master can search the neded data (in grids) from Worker (Pull from client) More...
 
double & getGridPoint (const SnGrids::Parameters &param, const size_t &ii, const size_t &jj)
 Retrieve one point (ii,jj) from the specified grid. More...
 
void runModel (const mio::Date &julian, const mio::Grid2DObject &psum, const mio::Grid2DObject &psum_ph, const mio::Grid2DObject &rh, const mio::Grid2DObject &ta, const mio::Grid2DObject &vw, const mio::Grid2DObject &mns, const mio::Grid2DObject &shortwave, const mio::Grid2DObject &diffuse, const mio::Grid2DObject &longwave, const double solarElevation)
 method which prepares all data for simulation and then access correctly the Snowpack model interfaces. More...
 

Static Public Member Functions

static int round_landuse (const double &landuse_dbl)
 optimised way to round landuse More...
 
static bool skipThisCell (const double &landuse_val, const double &dem_val)
 check if a cell should be simulated or skipped More...
 
static bool is_special (const std::vector< std::pair< size_t, size_t > > &pts_in, const size_t &ix, const size_t &iy)
 

Constructor & Destructor Documentation

SnowpackInterfaceWorker::SnowpackInterfaceWorker ( const mio::Config &  io_cfg,
const mio::DEMObject &  dem_in,
const mio::Grid2DObject &  landuse_in,
const std::vector< std::pair< size_t, size_t > > &  pts_in,
const std::vector< SnowStation * > &  snow_stations,
const size_t  offset_in 
)

Constructs and initialise Snowpack Interface Worker. Create one worker and init values for slice which the worker need to simulate it slice.

Parameters
io_cfgconfiguration to pass to Snowpack
dem_ingives the demographic Data. Also tetermines size and position of the slice
landuse_ingives the landuse Data. Also tetermines size and position of the landuse for slice
pts_ingives the spezial points. For this points more output is done then for the others. Calcualtion is the same.
snow_stationsgives a vector of pointers to the SnowStation objects relevant for this thread
offset_ingives the offsett on X for this slice (needed to read data and error messages)
SnowpackInterfaceWorker::~SnowpackInterfaceWorker ( )

Member Function Documentation

void SnowpackInterfaceWorker::clearSpecialPointsData ( )
void SnowpackInterfaceWorker::getGrid ( const SnGrids::Parameters param,
mio::Grid2DObject &  o_grid2D 
) const

Method that the Master can search the neded data (in grids) from Worker (Pull from client)

Parameters
paramsays which grid param the Master wants to have
o_grid2Dis the output grid, which gives back the data to the master
double & SnowpackInterfaceWorker::getGridPoint ( const SnGrids::Parameters param,
const size_t &  ii,
const size_t &  jj 
)

Retrieve one point (ii,jj) from the specified grid.

Parameters
paramsays which grid param the Master wants to have
iiii index
jjjj index
Returns
grid value at point (ii,jj) for parameter param
void SnowpackInterfaceWorker::getOutputSNO ( std::vector< SnowStation * > &  snow_station) const

method that returns SnowCover files for specific date.

Parameters
snow_stationvector that will be filled with the SnowStation data for each pixels
void SnowpackInterfaceWorker::getOutputSpecialPoints ( std::vector< SnowStation * > &  ptr_snow_pixel,
std::vector< CurrentMeteo * > &  ptr_meteo_pixel,
std::vector< SurfaceFluxes * > &  ptr_surface_flux 
)
bool SnowpackInterfaceWorker::is_special ( const std::vector< std::pair< size_t, size_t > > &  pts_in,
const size_t &  ix,
const size_t &  iy 
)
static
int SnowpackInterfaceWorker::round_landuse ( const double &  landuse_dbl)
static

optimised way to round landuse

Parameters
landuse_dblis the landuse to round
void SnowpackInterfaceWorker::runModel ( const mio::Date &  date,
const mio::Grid2DObject &  psum,
const mio::Grid2DObject &  psum_ph,
const mio::Grid2DObject &  rh,
const mio::Grid2DObject &  ta,
const mio::Grid2DObject &  vw,
const mio::Grid2DObject &  mns,
const mio::Grid2DObject &  shortwave,
const mio::Grid2DObject &  diffuse,
const mio::Grid2DObject &  longwave,
const double  solarElevation 
)

method which prepares all data for simulation and then access correctly the Snowpack model interfaces.

Parameters
datecurrent simulation time step
psumprecipitation grid (kg m-2)
psum_phprecipitation phase grid (between 0 and 1)
rhrelative humidity grid (% or 1)
taair temperature grid (K)
vwwind velocity grid (m s-1)
mnsmap of the Precipitation (mm/h) HACK get this map only if per pull from Master if Drift is used !!
shortwaveincoming shortwave radiation grid (W m-2)
diffusediffuse radiation from the sky grid (W m-2)
longwaveincoming longwave grid (W m-2)
solarElevationsolar elevation (in dec)
void SnowpackInterfaceWorker::setUseDrift ( const bool  useDrift_in)
inline
void SnowpackInterfaceWorker::setUseEBalance ( const bool  useEBalance_in)
inline
bool SnowpackInterfaceWorker::skipThisCell ( const double &  landuse_val,
const double &  dem_val 
)
static

check if a cell should be simulated or skipped

Parameters
landuse_valland use parameter for this pixel
dem_valdem altitude for this pixel

The documentation for this class was generated from the following files: