#include <dynamicgrowthcurvetransform.h>
Inherits ITransform.
|
| DynamicGrowthCurveTransform (std::shared_ptr< std::map< std::tuple< std::string, double, double >, DynamicVar >> gcIdCache, std::shared_ptr< std::map< int, std::map< std::string, DynamicVar >>> gcCache, std::shared_ptr< Poco::Mutex > cacheLock, std::shared_ptr< std::atomic< int >> nextGcId) |
|
void | configure (DynamicObject config, const flint::ILandUnitController &landUnitController, datarepository::DataRepository &dataRepository) override |
|
void | controllerChanged (const flint::ILandUnitController &controller) override |
|
const DynamicVar & | value () const override |
|
◆ DynamicGrowthCurveTransform()
DynamicGrowthCurveTransform |
( |
std::shared_ptr< std::map< std::tuple< std::string, double, double >, DynamicVar >> |
gcIdCache, |
|
|
std::shared_ptr< std::map< int, std::map< std::string, DynamicVar >>> |
gcCache, |
|
|
std::shared_ptr< Poco::Mutex > |
cacheLock, |
|
|
std::shared_ptr< std::atomic< int >> |
nextGcId |
|
) |
| |
◆ configure()
void configure |
( |
DynamicObject |
config, |
|
|
const flint::ILandUnitController & |
landUnitController, |
|
|
datarepository::DataRepository & |
dataRepository |
|
) |
| |
|
override |
Configuration function
Assign DynamicGrowthCurveTransform._landUnitController as parameter &landUnitController,
Assign values of variables "classifier_set", "mean_annual_precipitation", "mean_annual_growing_days", "volume_to_biomass_parameters", "growth_and_yield_parameters" in DynamicGrowthCurveTransform._landUnitController
to DynamicGrowthCurveTransform._csetVar, DynamicGrowthCurveTransform._precipitationVar, DynamicGrowthCurveTransform._growingDaysVar, DynamicGrowthCurveTransform._volToBioVar, DynamicGrowthCurveTransform._growthAndYieldParamsVar
If parameter config contains "age", "increment_length", "debugging_enabled", assign it to DynamicGrowthCurveTransform._maxAge, DynamicGrowthCurveTransform._incrementLength, DynamicGrowthCurveTransform._debug
- Parameters
-
config | DynamicObject |
landUnitController | flint::ILandUnitController& |
dataRepository | datarepository::DataRepository& |
- Returns
- void
◆ controllerChanged()
void controllerChanged |
( |
const flint::ILandUnitController & |
controller | ) |
|
|
override |
◆ value()
const DynamicVar & value |
( |
| ) |
const |
|
override |
If the value of DynamicGrowthCurveTransform._csetVar or DynamicGrowthCurveTransform._precipitationVar or DynamicGrowthCurveTransform._growingDaysVar is empty, assign DynamicGrowthCurveTransform._value as an object of Poco::Dynamic::Var, and return DynamicGrowthCurveTransform._value
Assign a variable key, to the tuple, species (value of "Species" in DynamicGrowthCurveTransform._csetVar), precipitation (value of DynamicGrowthCurveTransform._precipitationVar) and growingDays (value of DynamicGrowthCurveTransform._growingDaysVar)
If key exists in DynamicGrowthCurveTransform._gcIdCache return it
Apply Poco::Mutex::ScopedLock, generate a new Growth Curvce and check again in case of a race condition
If value of _growthAndYieldParamsVar is empty, add variable key, -1 to DynamicGrowthCurveTransform._gcIdCache, assign DynamicGrowthCurveTransform._value as an object of Poco::Dynamic::Var, and return DynamicGrowthCurveTransform._value
Return value of variable key in DynamicGrowthCurveTransform._gcIdCache
- Returns
- DynamicVar&
◆ _cacheLock
std::shared_ptr<Poco::Mutex> _cacheLock |
|
private |
◆ _csetVar
const flint::IVariable* _csetVar |
|
mutableprivate |
◆ _debug
◆ _gcCache
std::shared_ptr<std::map<int, std::map<std::string, DynamicVar> > > _gcCache |
|
private |
◆ _gcIdCache
std::shared_ptr<std::map<std::tuple<std::string, double, double>, DynamicVar> > _gcIdCache |
|
private |
◆ _growingDaysVar
const flint::IVariable* _growingDaysVar |
|
mutableprivate |
◆ _growthAndYieldParamsVar
const flint::IVariable* _growthAndYieldParamsVar |
|
mutableprivate |
◆ _incrementLength
int _incrementLength = 10 |
|
mutableprivate |
◆ _landUnitController
const flint::ILandUnitController* _landUnitController |
|
private |
◆ _maxAge
◆ _nextGcId
std::shared_ptr<std::atomic<int> > _nextGcId |
|
private |
◆ _precipitationVar
const flint::IVariable* _precipitationVar |
|
mutableprivate |
◆ _value
◆ _volToBioVar
const flint::IVariable* _volToBioVar |
|
mutableprivate |
The documentation for this class was generated from the following files: