FMT 1.2.0
Forest management tools for forest planning
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
Parallel::FMTParallelWriter Class Reference

Writer used in concurrency to write multiple results in the same layer. More...

#include <FMTParallelWriter.h>

Inheritance diagram for Parallel::FMTParallelWriter:
[legend]
Collaboration diagram for Parallel::FMTParallelWriter:
[legend]

Public Member Functions

 FMTParallelWriter ()=default
 Default constructor for FMTParallelWriter.
 
virtual ~FMTParallelWriter ()
 Default destructor for FMTParallelWriter.
 
 FMTParallelWriter (const FMTParallelWriter &rhs)=default
 Default copy constructor for FMTParallelWriter.
 
FMTParallelWriteroperator= (const FMTParallelWriter &rhs)=default
 Default copy assignment operator for FMTParallelWriter.
 
 FMTParallelWriter (const std::string &location, const std::string &driver, const std::vector< Core::FMTOutput > &outputs, const std::vector< Models::FMTModel * > &allmodels, std::vector< std::string >layersoptions=std::vector< std::string >(), double minimaldrift=0.5, Core::FMToutputlevel outputlevel=Core::FMToutputlevel::totalonly)
 Construct a FMTParallelWriter from the location, driver and outputs and the base models to write.
 
 FMTParallelWriter (const std::string &location, const std::string &driver, Core::FMToutputlevel outputlevel=Core::FMToutputlevel::totalonly, std::vector< std::string >layersoptions=std::vector< std::string >(), int firstPeriod=1, int lastPeriod=1, std::string primaryfilelocation=std::string())
 Construct a FMTParallelWriter without layers and outputs.
 
void setLayer (const std::string &p_name)
 Add a new layer for a given model.
 
void write (const std::string &modelname, const std::map< std::string, std::vector< std::vector< double > > > &results, const int &firstPeriod, const int &lastPeriod, const int &iteration) const
 Write the model results from the first to the last period for a given iteration (replicate).
 
void writeSchedules (const std::string seqName, const std::vector< Core::FMTSchedule > scheduleList, bool append) const
 Write schedules to a file.
 
std::map< std::string, std::vector< std::vector< double > > > getResults (const std::unique_ptr< Models::FMTModel > &modelptr, const int &firstPeriod, const int &lastPeriod) const
 Get the results of a model.
 
void setDriftProbability (const std::string &globalmodel, const std::string &localmodel) const
 Compute the drift probability from the global and local models starting from a minimal drift proportion.
 
void getAndWrite (const std::unique_ptr< Models::FMTModel > &modelptr, const std::vector< Core::FMTOutput > &loutputs)
 Get the results of a model and write them down.
 
void close () noexcept
 Close the dataset and destroy the layers, after which the writer is no longer usable.
 
- Public Member Functions inherited from Parser::FMTModelParser
 FMTModelParser ()
 Default constructor for FMTModelParser.
 
virtual ~FMTModelParser ()=default
 Default virtual destructor for FMTModelParser.
 
 FMTModelParser (const FMTModelParser &rhs)
 Copy constructor for FMTModelParser.
 
FMTModelParseroperator= (const FMTModelParser &rhs)
 Copy assignment operator for FMTModelParser.
 
Models::FMTModel read (const std::string &con, const std::string &lan, const std::string &lif, const std::string &are, const std::string &yld, const std::string &act, const std::string &tr, const std::string &out, std::string opt=std::string())
 Read a single model and return it as a FMTModel.
 
std::vector< Models::FMTModelreadTemplates (const std::string &primarym_location, const std::string &templatefolder)
 Read the base model then load each folder in the template folder as a scenario of the base model.
 
std::vector< Models::FMTModelreadproject (const std::string &primarym_location, std::vector< std::string >scenarios=std::vector< std::string >(), bool readarea=true, bool readoutputs=true, bool readoptimize=true)
 Read multiple scenarios based on a primary file location.
 
void writeToProject (const std::string &primarym_location, const Models::FMTModel &model)
 Create a primary file if needed and write the model as a root scenario, or as a new scenario if the primary file exists.
 
std::vector< std::vector< Core::FMTSchedule > > readSchedules (const std::string &primarym_location, const std::vector< Models::FMTModel > &models)
 Read the schedule files of the models based on a primary file.
 
std::vector< Core::FMTConstraintgetConstraintsFromString (std::string constraintstr, const Models::FMTModel &model, Core::FMTConstants constants=Core::FMTConstants())
 Get constraints from a string.
 
void write (const Models::FMTModel &model, const std::string &folder) const
 Write a model into a folder, naming the files based on the model name.
 
OGRLayer * createResultsLayer (const std::string &p_modelName, GDALDataset *p_dataset, std::vector< std::string > p_creationOptions=std::vector< std::string >()) const
 Create a results layer on a dataset for a given model name.
 
void fillUpInfeasibles (OGRLayer *layer, const std::vector< Core::FMTOutput > &theoutputs, const int &iteration, const int &firstPeriod, const int &lastPeriod) const
 Fill up an OGR layer with infeasible values.
 
void writeFeatures (OGRLayer *layer, const int &firstPeriod, const int &iteration, const std::vector< Core::FMTOutput > &theoutputs, const std::map< std::string, std::vector< std::vector< double > > > &values, bool writeNaN=false) const
 Write multiple features to a layer.
 
void writeResults (const Models::FMTModel &model, const std::vector< Core::FMTOutput > &theoutputs, const int &firstPeriod, const int &lastPeriod, const std::string &location, Core::FMToutputlevel level=Core::FMToutputlevel::standard, std::string gdaldrivername="CSV") const
 Write the results of a model from the first to the last period for a vector of outputs into a GDAL driver.
 
- Public Member Functions inherited from Parser::FMTParser
 FMTParser ()
 Default constructor for FMTParser.
 
 FMTParser (const FMTParser &rhs)
 Copy constructor for FMTParser.
 
FMTParseroperator= (const FMTParser &rhs)
 Copy assignment operator for FMTParser.
 
virtual ~FMTParser ()=default
 Default destructor for FMTParser.
 
std::time_t getMostRecentFiletime () const
 Return the most recent file time of the files read by the parser.
 
void setHeader (const std::string &header)
 Set a string as the header written when the file is opened in write mode, replacing the comment attribute.
 
GDALDataset * createOGRDataset (std::string location=std::string(), std::string gdaldrivername="CSV") const
 Create an OGR vector dataset based on a driver name and a location.
 
OGRLayer * createLayer (GDALDataset *dataset, const std::string &name, std::vector< std::string > creationoptions=std::vector< std::string >()) const
 Create a layer in a dataset, deleting any existing layer with the same name.
 
std::vector< std::string > getGDALVectorDriverNames (bool testcreation=true) const
 Return a vector of GDAL vector driver names.
 
std::vector< std::string > getGDALRasterDriverNames (bool testcreation=true) const
 Return a vector of GDAL raster driver names.
 
std::vector< std::vector< std::string > > getGDALVectorDriverExtensions (bool testcreation=true) const
 Return a vector of GDAL vector driver extensions organized by driver.
 
std::vector< std::vector< std::string > > getGDALRasterDriverExtensions (bool testcreation=true) const
 Return a vector of GDAL raster driver extensions organized by driver.
 
bool tryOpening (const std::ifstream &stream, const std::string &location) const
 Open an input stream at a given location.
 
bool tryOpening (std::ofstream &stream, const std::string &location) const
 Open an output stream at a given location.
 
std::string getCleanLine (std::istream &stream) const
 Clean a line and make it ready to be read by a parser.
 
std::string getCleanLine (const std::string &p_input) const
 Clean a line and make it ready to be read by a parser.
 
std::string createSubDirectory (const std::string &p_Directory, const std::string &p_SubDirectory)
 Create a sub directory in directory.
 
- Public Member Functions inherited from Core::FMTObject
 FMTObject ()
 Default constructor for FMTObject.
 
virtual ~FMTObject ()
 Default virtual destructor for FMTObject.
 
 FMTObject (const std::unique_ptr< Exception::FMTExceptionHandler > exhandler)
 Construct a FMTObject passing in the exception handler of another FMTObject.
 
 FMTObject (const FMTObject &rhs)
 Copy constructor for FMTObject.
 
FMTObjectoperator= (const FMTObject &rhs)
 Copy assignment operator for FMTObject.
 
virtual void passInLogger (const std::unique_ptr< Logging::FMTLogger > &logger)
 Pass in the logger of another FMTObject.
 
void passInExceptionHandler (const std::unique_ptr< Exception::FMTExceptionHandler > &exhandler)
 Pass in the exception handler of another FMTObject.
 
void redirectLogToFile (const std::string &location)
 Redirect the log to a specific file, appending to it.
 
virtual void setDefaultLogger ()
 Create and set a default logger to the FMTObject.
 
virtual void setQuietLogger ()
 Create and set a quiet logger to the FMTObject.
 
virtual void setTaskLogger ()
 Create and set a task logger to the FMTObject.
 
virtual void setDebugLogger ()
 Create and set a debug logger to the FMTObject.
 
void setDefaultExceptionHandler ()
 Create and set a default exception handler to the FMTObject.
 
void setQuietExceptionHandler ()
 Create and set a quiet exception handler to the FMTObject.
 
void setDebugExceptionHandler ()
 Create and set a debug exception handler to the FMTObject.
 
void setFreeExceptionHandler ()
 Create and set a free exception handler to the FMTObject.
 
void disableNestedExceptions ()
 Disable the nested exception throw of the exception handler.
 
void enableNestedExceptions ()
 Enable the nested exception throw of the exception handler.
 
void setErrorsToWarnings (const std::vector< Exception::FMTexc > &errors)
 Set a list of errors to be cast to warnings on the exception handler.
 
void setMaxWarningsBeforeSilenced (const size_t &maxwarningcount)
 Set the number of warnings raised before being silenced.
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Protected Member Functions

const std::map< std::string, std::map< double, std::vector< double > > > _getDriftProbability (const std::map< std::string, std::vector< std::vector< double > > > &globalvalues, const std::map< std::string, std::vector< std::vector< double > > > &localvalues, const bool lower=true) const
 Compute the drift probabilities from the global and local values.
 
- Protected Member Functions inherited from Parser::FMTModelParser
std::map< std::string, std::vector< std::vector< double > > > getIterationsValues (OGRLayer *layer) const
 Return all the values per iteration and period from a layer.
 
OGRLayer * createDriftLayer (GDALDataset *dataset, std::vector< std::string > creationoptions=std::vector< std::string >()) const
 Create an output drift layer.
 
void writeDrift (OGRLayer *layer, const std::map< std::string, std::map< double, std::vector< double > > > &lowervalues, const std::map< std::string, std::map< double, std::vector< double > > > &uppervalues) const
 Write the drift lower and upper values to a layer.
 
void writePrimary (const std::string &location, const std::string &lanfile, const std::string &arefile, const std::string &yldfile, const std::string &actfile, const std::string &trnfile, const std::string &outfile, const std::string &optfile, const std::string &liffile, std::string seqfile=std::string()) const
 Write the primary file with the section file names.
 
void writeModel (const Models::FMTModel &model, const std::string &lanfile, const std::string &arefile, const std::string &yldfile, const std::string &actfile, const std::string &trnfile, const std::string &outfile, const std::string &optfile, const std::string &liffile, const std::string &seqfile) const
 Write the sections of a model, and the schedules if the schedule file is not empty.
 
- Protected Member Functions inherited from Parser::FMTParser
void _setSection (const Core::FMTsection &section) const
 Set the section member of the parser.
 
std::vector< GDALDriver * > _getAllGDALDrivers (const char *spatialtype, bool testcreation=true) const
 Return the GDAL drivers for a given spatial type.
 
std::vector< std::vector< std::string > > getGDALExtensions (const char *spatialtype, bool testcreation=true) const
 Return the GDAL extensions organized by driver for a given spatial type.
 
void _setCategories (GDALRasterBand *band, const std::vector< std::string > &categories) const
 Write the categories in the band information.
 
OGRCoordinateTransformation * _getProjTransform (OGRLayer *baselayer, bool fittoforel=true) const
 Return a coordinate transformation for a layer, optionally fitting to FOREL.
 
GDALDataset * _getTransFormMemLayerCopy (OGRLayer *baselayer, const OGRSpatialReference *newreference, const std::string &fieldname) const
 Create a memory dataset copying a layer with a new field, optionally with a new spatial reference.
 
std::unique_ptr< OGRSpatialReference > _getFORELSpatialRef () const
 Return the spatial reference used for FORELs in Quebec.
 
template<typename T >
GDALDataset * _createDataset (const std::string &location, const Spatial::FMTLayer< T > &layer, const int datatypeid, std::string format="GTiff") const
 Create an empty GDAL dataset for a layer.
 
GDALDataset * _getDataset (const std::string &location) const
 Open a GDAL dataset in read only from a location, throwing on error.
 
GDALDataset * _getVectorDataset (const std::string &location) const
 Open a GDAL vector dataset in read only from a location, throwing on error.
 
OGRLayer * _getLayer (GDALDataset *dataset, int id) const
 Open a GDAL layer from a vector dataset by its id, throwing on error.
 
GDALRasterBand * _getBand (GDALDataset *dataset, int bandid=1) const
 Open a GDAL raster band from a dataset.
 
GDALRasterBand * _createBand (GDALDataset *dataset, const std::vector< std::string > &categories, int bandid=1) const
 Create a GDAL raster band in a dataset with categories.
 
std::vector< std::string > _getCat (GDALDataset *dataset, int bandid=1) const
 Return the categories of a dataset for a given band.
 
GDALRasterBand * _getOverview (GDALRasterBand *band, int view=1) const
 Return an overview of a raster band.
 
void _getWSFields (OGRLayer *layer, std::map< int, int > &themes, int &age, int &area, int &lock, std::string agefield="", std::string areafield="", std::string lockfield="") const
 Fill up the field ids of the themes, age, area and lock of a layer.
 
GDALDataset * _createVectorMemoryDs () const
 Create a vector memory dataset.
 
bool _isValidFile (const std::string &location) const
 Check if a file location is valid.
 
bool _isValid (const std::string &line) const
 Check if a line is valid and clean it.
 
std::vector< std::string > regexLoop (const boost::regex &cutregex, std::string &str) const
 Capture a for loop from a line and return the variables to loop on.
 
std::vector< std::string > spliter (std::string strmask, const boost::regex &xspliter) const
 Split a string into multiple strings.
 
void _clearComments (std::string &line) const
 Clear the comments from a line and fill up the comment member.
 
std::string _upper (const std::string &lowercases) const
 Convert a string to upper case.
 
virtual std::queue< FMTLineInfo_tryInclude (const std::vector< Core::FMTTheme > &p_themes, const Core::FMTConstants &p_cons, std::queue< FMTLineInfo >p_ForOut) const
 Return the next lines to be read by the parser, considering included files.
 
virtual std::queue< FMTLineInfo_getCleanLinewfor (std::ifstream &p_stream, const std::vector< Core::FMTTheme > &p_themes, const Core::FMTConstants &p_cons) const
 Get a clean line considering for loops when reading the file.
 
std::queue< FMTLineInfo_getAllLines (std::ifstream &p_stream) const
 Get all the lines of a file.
 
std::queue< FMTLineInfo_processForLoopsNInclude (const std::vector< Core::FMTTheme > &p_themes, const Core::FMTConstants &p_cons, std::queue< FMTLineInfo >p_AllLines) const
 Process the for loops and include lines.
 
bool _isNum (std::string value) const
 Return true if the value is a number.
 
bool _isNum (const std::string &value, const Core::FMTConstants &constant, bool throwerror=true) const
 Return true if the value is a number, raising if it is not a valid number when throwerror is true.
 
template<typename T >
_getNum (const std::string &value, const Core::FMTConstants &constant, int period=0) const
 Return a numeric value from a string based on the constants and a period.
 
template<typename T >
_getNum (const std::string &value, bool omitnumtest=false) const
 Return a numeric value from a string.
 
template<typename T >
bool _tryFillNumber (T &number, const std::string &value, const Core::FMTConstants &constant, int period=0) const
 Try to get a number from a string, returning false on failure.
 
template<typename T >
Core::FMTBounds< T > bounds (const Core::FMTConstants &constants, const std::string &value, const std::string &ope, Core::FMTsection section) const
 Return a FMTBounds from a value based on the constants and a section.
 
std::array< std::string, 5 > getBaseOperators () const
 Return the operators normally found in the different sections.
 
std::vector< std::string > _sameAs (const std::string &allset) const
 Handle the _sameAs keyword.
 
std::map< Core::FMTsection, std::string > _getPrimary (const std::string &primarylocation)
 Return the file locations of the different sections from a primary file.
 
bool _isYld (const Core::FMTYields &p_ylds, const std::string &p_value, Core::FMTsection pm_section, bool p_throwError=true) const
 Check if a value is a valid yield.
 
bool _isAct (Core::FMTsection section, const std::vector< Core::FMTAction > &actions, std::string action) const
 Check if a value is an action.
 
std::string _setSpecs (Core::FMTsection section, Core::FMTkwor key, const Core::FMTYields &ylds, const Core::FMTConstants &constants, std::vector< Core::FMTSpec > &specs, const std::string &line)
 Set the specifications of one or multiple specs and return the rest of the line.
 
std::string _setSpec (Core::FMTsection section, Core::FMTkwor key, const Core::FMTYields &ylds, const Core::FMTConstants &constants, Core::FMTSpec &spec, const std::string &line)
 Set the specification of a spec and return the rest of the line.
 
std::vector< std::vector< std::string > > readCsv (const std::string &location, const char &separator)
 Read a CSV file from a location using a separator.
 
Core::FMTPerBounds _getPerBound (const std::string &p_lower, const std::string &p_upper, const Core::FMTConstants &p_constants) const
 Return the period bound of an input.
 
void _setPeriodWithBounds (Core::FMTSpec &p_spec, const std::string &p_lower, const std::string &p_upper, const Core::FMTConstants &p_constants) const
 Set the periods of a spec from a lower and upper bound.
 
bool _setPeriods (Core::FMTSpec &p_spec, const std::string &p_periods, const Core::FMTConstants &p_constants) const
 Set the periods of a spec from a parsed period string.
 
std::map< std::string, std::vector< std::string > > _getForLoops (const std::string &p_line, const std::vector< Core::FMTTheme > &p_themes, const Core::FMTConstants &p_cons) const
 Fill up the for loops queue with the targeted variables.
 
void _processForLoops (const std::vector< Core::FMTTheme > &p_themes, const Core::FMTConstants &p_constants, std::queue< FMTLineInfo > &p_queue) const
 Unroll the for loops in the queue and set the results in the queue.
 
bool _isForLoops (const std::string &p_line) const
 Return true if a line is a for loop header.
 
bool _isForLoopsEnd (const std::string &p_line) const
 Return true if a line is the end of a for loop.
 
std::string _getLine (std::queue< FMTLineInfo > &p_Lines) const
 Get and pop the front line of a queue.
 
- Protected Member Functions inherited from Core::FMTObject
template<class Archive >
void forceSave (Archive &ar, const unsigned int version) const
 Force the serialization to save useful information, which the default FMTObject serialization does not.
 
template<class Archive >
void forceLoad (Archive &ar, const unsigned int version)
 Force the serialization to load useful information, which the default FMTObject serialization does not.
 
void checkSignals () const
 Check if the user has sent a ctrl-c signal using boost::python to FMT.
 
void setCplHandler ()
 Pass the FMT exception handler to the GDAL exception handler (GDAL only).
 

Additional Inherited Members

- Static Public Member Functions inherited from Parser::FMTParser
static Core::FMTsection fromExtension (const std::string &p_Extension)
 Return the FMTsection matching the extension of a file.
 
- Static Public Member Functions inherited from Core::FMTObject
static Logging::FMTLoggergetLogger ()
 get a pointer to the actual logger.
 
static Exception::FMTExceptionHandlergetExceptionHandler ()
 get a pointer to the actual exception handler.
 
static std::string getRuntimeLocation ()
 Return the location of the FMT shared library.
 
static unsigned long long getAvailableMemory ()
 Return the available memory in bytes.
 
static void setTerminateStack ()
 will write the stack in the log when terminate called and raise a function failed.
 
static void setAbortStack ()
 will write the stack in the log when abort called with SIGABRT and raise a function failed.
 
- Static Protected Member Functions inherited from Core::FMTObject
static std::chrono::time_point< std::chrono::high_resolution_clock > getClock ()
 Return a clock of the current time.
 
template<class chrono >
static double getDuration (const std::chrono::time_point< std::chrono::high_resolution_clock > &startclock)
 Return the time elapsed since a start clock as a double.
 
static std::string getDurationInSeconds (const std::chrono::time_point< std::chrono::high_resolution_clock > &startclock)
 Return the time elapsed since a start clock in seconds as a string.
 
static void _logStack ()
 Log the stack trace...
 
static void _terminate ()
 Raise an error with the boost stacktrace.
 
static void _abort (int p_signal)
 Raise an error with the boost stacktrace on abort.
 
- Protected Attributes inherited from Parser::FMTParser
boost::recursive_mutex m_MTX
 Mutex for multi-threading.
 
Core::FMTsection m_section
 The section in which the child class is in.
 
int m_constrePlacement
 Number of constant replaced by a numerical number.
 
int m_line
 Line id at which the parser is reading the values.
 
std::string m_comment
 Comment found in the actual line read by the parser.
 
std::string m_location
 File location of the section read by the parser.
 
std::time_t m_MostRecentFile
 The most recent file time read by this parser.
 
- Static Protected Attributes inherited from Parser::FMTParser
static const boost::regex m_SEPARATOR
 A regex for splitting general string.
 
static const boost::regex m_AYLD
 A regex for capturing age/period/yield specification.
 
static const boost::regex m_AAGE
 A regex for capturing age specificaiton.
 
static const boost::regex m_AYLD_AGE
 A regex for capturing age or yield specification.
 
static const boost::regex m_BOUNDS
 A regex for capturing bounds for yield or age specification.
 
static const boost::regex m_OPERATORS
 A regex for capturing simple operators.
 
static const boost::regex m_PRIMARY
 A regex for capturing the primary file.
 
- Static Protected Attributes inherited from Core::FMTObject
static std::unique_ptr< Exception::FMTExceptionHandler_exhandler
 A shared pointer to the exception handler.
 
static std::unique_ptr< Logging::FMTLogger_logger
 A shared pointer to the logger.
 

Detailed Description

Writer used in concurrency to write multiple results in the same layer.

Constructor & Destructor Documentation

◆ FMTParallelWriter() [1/4]

Parallel::FMTParallelWriter::FMTParallelWriter ( )
default

Default constructor for FMTParallelWriter.

◆ ~FMTParallelWriter()

virtual Parallel::FMTParallelWriter::~FMTParallelWriter ( )
virtual

Default destructor for FMTParallelWriter.

◆ FMTParallelWriter() [2/4]

Parallel::FMTParallelWriter::FMTParallelWriter ( const FMTParallelWriter rhs)
default

Default copy constructor for FMTParallelWriter.

Parameters
[in]rhsthe FMTParallelWriter to copy.

◆ FMTParallelWriter() [3/4]

Parallel::FMTParallelWriter::FMTParallelWriter ( const std::string &  location,
const std::string &  driver,
const std::vector< Core::FMTOutput > &  outputs,
const std::vector< Models::FMTModel * > &  allmodels,
std::vector< std::string >  layersoptions = std::vector< std::string >(),
double  minimaldrift = 0.5,
Core::FMToutputlevel  outputlevel = Core::FMToutputlevel::totalonly 
)

Construct a FMTParallelWriter from the location, driver and outputs and the base models to write.

Parameters
[in]locationthe output location.
[in]driverthe output driver.
[in]outputsthe outputs.
[in]allmodelsthe models.
[in]layersoptionsthe layer options.
[in]minimaldriftthe minimal drift.
[in]outputlevelthe output level.

◆ FMTParallelWriter() [4/4]

Parallel::FMTParallelWriter::FMTParallelWriter ( const std::string &  location,
const std::string &  driver,
Core::FMToutputlevel  outputlevel = Core::FMToutputlevel::totalonly,
std::vector< std::string >  layersoptions = std::vector< std::string >(),
int  firstPeriod = 1,
int  lastPeriod = 1,
std::string  primaryfilelocation = std::string() 
)

Construct a FMTParallelWriter without layers and outputs.

Parameters
[in]locationthe output location.
[in]driverthe output driver.
[in]outputlevelthe output level.
[in]layersoptionsthe layer options.
[in]firstPeriodthe first period.
[in]lastPeriodthe last period.
[in]primaryfilelocationthe primary file location.

Member Function Documentation

◆ _getDriftProbability()

const std::map< std::string, std::map< double, std::vector< double > > > Parallel::FMTParallelWriter::_getDriftProbability ( const std::map< std::string, std::vector< std::vector< double > > > &  globalvalues,
const std::map< std::string, std::vector< std::vector< double > > > &  localvalues,
const bool  lower = true 
) const
protected

Compute the drift probabilities from the global and local values.

Parameters
[in]globalvaluesthe global values.
[in]localvaluesthe local values.
[in]lowerif true computes the lower drift.
Returns
the drift probabilities.

◆ close()

void Parallel::FMTParallelWriter::close ( )
noexcept

Close the dataset and destroy the layers, after which the writer is no longer usable.

◆ getAndWrite()

void Parallel::FMTParallelWriter::getAndWrite ( const std::unique_ptr< Models::FMTModel > &  modelptr,
const std::vector< Core::FMTOutput > &  loutputs 
)

Get the results of a model and write them down.

Parameters
[in]modelptrthe model.
[in]loutputsthe outputs.

◆ getResults()

std::map< std::string, std::vector< std::vector< double > > > Parallel::FMTParallelWriter::getResults ( const std::unique_ptr< Models::FMTModel > &  modelptr,
const int &  firstPeriod,
const int &  lastPeriod 
) const

Get the results of a model.

Parameters
[in]modelptrthe model.
[in]firstPeriodthe first period.
[in]lastPeriodthe last period.
Returns
the results.

◆ operator=()

FMTParallelWriter & Parallel::FMTParallelWriter::operator= ( const FMTParallelWriter rhs)
default

Default copy assignment operator for FMTParallelWriter.

Parameters
[in]rhsthe FMTParallelWriter to copy.
Returns
a reference to this FMTParallelWriter.

◆ setDriftProbability()

void Parallel::FMTParallelWriter::setDriftProbability ( const std::string &  globalmodel,
const std::string &  localmodel 
) const

Compute the drift probability from the global and local models starting from a minimal drift proportion.

Parameters
[in]globalmodelthe global model name.
[in]localmodelthe local model name.

◆ setLayer()

void Parallel::FMTParallelWriter::setLayer ( const std::string &  p_name)

Add a new layer for a given model.

Parameters
[in]p_namethe name of the layer.

◆ write()

void Parallel::FMTParallelWriter::write ( const std::string &  modelname,
const std::map< std::string, std::vector< std::vector< double > > > &  results,
const int &  firstPeriod,
const int &  lastPeriod,
const int &  iteration 
) const

Write the model results from the first to the last period for a given iteration (replicate).

Parameters
[in]modelnamethe model name.
[in]resultsthe results.
[in]firstPeriodthe first period.
[in]lastPeriodthe last period.
[in]iterationthe iteration.

◆ writeSchedules()

void Parallel::FMTParallelWriter::writeSchedules ( const std::string  seqName,
const std::vector< Core::FMTSchedule scheduleList,
bool  append 
) const

Write schedules to a file.

Parameters
[in]seqNamethe schedule file name.
[in]scheduleListthe schedules.
[in]appendif true appends to the file.

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