FFSM++ 1.1.0
French Forest Sector Model ++
Loading...
Searching...
No Matches
BaseClass.h File Reference

This file is the header of BaseClass and it is included by ALL compiled code. More...

#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <algorithm>
#include <numeric>
#include <limits>
#include <cstddef>
#include <random>
#include <fenv.h>
Include dependency graph for BaseClass.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  iskey
 Class to provide a simple integer-string key to be used in std maps. More...
 
class  iiskey
 Class to provide a simple integer-integer-string key in std maps. More...
 
class  iisskey
 Class to provide a simple integer-integer-string-string key in std maps. More...
 
class  BaseClass
 Base class for the regmas application. More...
 

Macros

#define M_PI   3.1415926535897932384626433832795
 
#define M_LN2   0.69314718055994530941723212145818
 
#define M_LN10   2.3025850929940456840179914546844
 
#define PROD_ALL   "PROD_ALL"
 All primary and transformed products.
 
#define PROD_PRI   "PROD_PRI"
 Primary products.
 
#define PROD_SEC   "PROD_SEC"
 Secondary products.
 
#define DIAM_ALL   "DIAM_ALL"
 All diameter classes.
 
#define DIAM_PROD   "DIAM_PROD"
 Diameter classes used for production (e.g. excluded the first one)
 
#define DIAM_FIRST   "DIAM_FIRST_CLASS"
 First diameter class (NOT used for production)
 
#define FT_ALL   "FT_ALL"
 All forest types.
 
#define LBOUND_MIN   -20000000000000000000.0
 Lower bound in optimisation -10^19.
 
#define UBOUND_MAX   20000000000000000000.0
 Upper bound in optimisation 10^19.
 

Enumerations

enum  messageType {
  MSG_NO_MSG = 0 , MSG_DEBUG = 1 , MSG_INFO = 2 , MSG_WARNING = 3 ,
  MSG_ERROR = 4 , MSG_CRITICAL_ERROR = 5
}
 Type of message to be printed. More...
 
enum  dataType { TYPE_INT =0 , TYPE_DOUBLE =1 , TYPE_STRING =2 , TYPE_BOOL =3 }
 Type of data requested. More...
 
enum  dataRequest {
  DATA_NOW = -1 , DATA_INIT = -2 , DATA_ERROR = -99999999999 , OP_SUM =1 ,
  OP_AVG =5 , RETNA = -9999 , WORLD = -99999
}
 A generic enum to deal with data requests. More...
 
enum  outputVerbosity {
  OUTVL_NONE =0 , OUTVL_AGGREGATED =10 , OUTVL_DETAILED =15 , OUTVL_MAPS =18 ,
  OUTVL_BINMAPS =20 , OUTVL_ALL =25
}
 Verbosity level of the output. More...
 
enum  domains {
  DOM_PRI_PR =1 , DOM_SEC_PR =2 , DOM_ALL_PR =3 , DOM_R2_PRI_PR =4 ,
  DOM_R2_SEC_PR =5 , DOM_R2_ALL_PR =6 , DOM_SCALAR =7 , DOM_PRI_PR_ALLCOMBS =8
}
 Domain associated to a variable or a constrain in the optimisation of the market module. More...
 
enum  carbonStocks { STOCK_INV =1 , STOCK_EXTRA =2 , STOCK_PRODUCTS =3 }
 Carbon stocks. More...
 
enum  emissionType { EM_ENSUB =4 , EM_MATSUB =5 , EM_FOROP =6 }
 Emission types. More...
 
enum  contrainDirection { CONSTR_EQ =1 , CONSTR_LE0 =2 , CONSTR_GE0 =3 }
 
enum  varType { VAR_VOL =1 , VAR_AREA =2 , VAR_IN =3 }
 
enum  boundType { LBOUND =1 , UBOUND =2 }
 

Detailed Description

This file is the header of BaseClass and it is included by ALL compiled code.

It contains also global enum and macro definitions that can be used anywhere in the code. If the code require some "case" parameter, put the cases in the enum here. DON'T USE NEGATIVE NUMBERS in the enums, as often negative numbers have a different meaning !

Definition in file BaseClass.h.

Macro Definition Documentation

◆ DIAM_ALL

#define DIAM_ALL   "DIAM_ALL"

All diameter classes.

Definition at line 157 of file BaseClass.h.

◆ DIAM_FIRST

#define DIAM_FIRST   "DIAM_FIRST_CLASS"

First diameter class (NOT used for production)

Definition at line 163 of file BaseClass.h.

◆ DIAM_PROD

#define DIAM_PROD   "DIAM_PROD"

Diameter classes used for production (e.g. excluded the first one)

Definition at line 160 of file BaseClass.h.

◆ FT_ALL

#define FT_ALL   "FT_ALL"

All forest types.

Definition at line 166 of file BaseClass.h.

◆ LBOUND_MIN

#define LBOUND_MIN   -20000000000000000000.0

Lower bound in optimisation -10^19.

Definition at line 171 of file BaseClass.h.

◆ M_LN10

#define M_LN10   2.3025850929940456840179914546844

Definition at line 143 of file BaseClass.h.

◆ M_LN2

#define M_LN2   0.69314718055994530941723212145818

Definition at line 139 of file BaseClass.h.

◆ M_PI

#define M_PI   3.1415926535897932384626433832795

Definition at line 135 of file BaseClass.h.

◆ PROD_ALL

#define PROD_ALL   "PROD_ALL"

All primary and transformed products.

Definition at line 148 of file BaseClass.h.

◆ PROD_PRI

#define PROD_PRI   "PROD_PRI"

Primary products.

Definition at line 151 of file BaseClass.h.

◆ PROD_SEC

#define PROD_SEC   "PROD_SEC"

Secondary products.

Definition at line 154 of file BaseClass.h.

◆ UBOUND_MAX

#define UBOUND_MAX   20000000000000000000.0

Upper bound in optimisation 10^19.

Definition at line 174 of file BaseClass.h.

Enumeration Type Documentation

◆ boundType

enum boundType
Enumerator
LBOUND 
UBOUND 

Definition at line 127 of file BaseClass.h.

127 {
128 LBOUND =1,
129 UBOUND =2
130};
@ LBOUND
Definition BaseClass.h:128
@ UBOUND
Definition BaseClass.h:129

◆ carbonStocks

Carbon stocks.

Enumerator
STOCK_INV 

Invetoried biomass (live and death tree logs)

STOCK_EXTRA 

Extra biomass (soils, branches..)

STOCK_PRODUCTS 

Biomass in forest products (sawns, pannels..)

Definition at line 103 of file BaseClass.h.

103 {
104 STOCK_INV =1, ///< Invetoried biomass (live and death tree logs)
105 STOCK_EXTRA =2, ///< Extra biomass (soils, branches..)
106 STOCK_PRODUCTS =3, ///< Biomass in forest products (sawns, pannels..)
107};
@ STOCK_EXTRA
Extra biomass (soils, branches..)
Definition BaseClass.h:105
@ STOCK_PRODUCTS
Biomass in forest products (sawns, pannels..)
Definition BaseClass.h:106
@ STOCK_INV
Invetoried biomass (live and death tree logs)
Definition BaseClass.h:104

◆ contrainDirection

Enumerator
CONSTR_EQ 
CONSTR_LE0 
CONSTR_GE0 

Definition at line 115 of file BaseClass.h.

115 {
116 CONSTR_EQ =1, // constrain of type equality
117 CONSTR_LE0 =2, // constrain of type lower or equal than 0
118 CONSTR_GE0 =3, // constrain of type greater or equal 0
119};
@ CONSTR_LE0
Definition BaseClass.h:117
@ CONSTR_EQ
Definition BaseClass.h:116
@ CONSTR_GE0
Definition BaseClass.h:118

◆ dataRequest

A generic enum to deal with data requests.

Enumerator
DATA_NOW 

The required data is for the current year.

DATA_INIT 

Setting a data request for the init period.

DATA_ERROR 

There is an error in retrieving the data.

OP_SUM 

Perform a SUM operation.

OP_AVG 

Perform an AVERAGE operation.

RETNA 

Request the (scenario specific) NO VALUE to be returned.

WORLD 

Request something that is not region-specific.

Definition at line 72 of file BaseClass.h.

72 {
73 DATA_NOW = -1, ///< The required data is for the current year
74 DATA_INIT = -2, ///< Setting a data request for the init period
75 DATA_ERROR = -99999999999, ///< There is an error in retrieving the data
76 // operations possible in certain contexts
77 OP_SUM =1, ///< Perform a SUM operation
78 OP_AVG =5, ///< Perform an AVERAGE operation
79 RETNA = -9999, ///< Request the (scenario specific) NO VALUE to be returned
80 WORLD = -99999 ///< Request something that is not region-specific
81};
@ OP_SUM
Perform a SUM operation.
Definition BaseClass.h:77
@ OP_AVG
Perform an AVERAGE operation.
Definition BaseClass.h:78
@ DATA_ERROR
There is an error in retrieving the data.
Definition BaseClass.h:75
@ WORLD
Request something that is not region-specific.
Definition BaseClass.h:80
@ DATA_NOW
The required data is for the current year.
Definition BaseClass.h:73
@ DATA_INIT
Setting a data request for the init period.
Definition BaseClass.h:74
@ RETNA
Request the (scenario specific) NO VALUE to be returned.
Definition BaseClass.h:79

◆ dataType

enum dataType

Type of data requested.

Enumerator
TYPE_INT 

The required data is an integer.

TYPE_DOUBLE 

The required data is a double.

TYPE_STRING 

The required data is a string.

TYPE_BOOL 

The required data is a bool.

Definition at line 65 of file BaseClass.h.

65 {
66 TYPE_INT =0, ///< The required data is an integer
67 TYPE_DOUBLE =1, ///< The required data is a double
68 TYPE_STRING =2, ///< The required data is a string
69 TYPE_BOOL =3, ///< The required data is a bool
70};
@ TYPE_DOUBLE
The required data is a double.
Definition BaseClass.h:67
@ TYPE_BOOL
The required data is a bool.
Definition BaseClass.h:69
@ TYPE_INT
The required data is an integer.
Definition BaseClass.h:66
@ TYPE_STRING
The required data is a string.
Definition BaseClass.h:68

◆ domains

enum domains

Domain associated to a variable or a constrain in the optimisation of the market module.

Enumerator
DOM_PRI_PR 

Primary products // domain of variables and constrains: primary, secondary, all products or all products over r2 couple regions (in-country commercial flows)

DOM_SEC_PR 

Secondary products.

DOM_ALL_PR 

All products (primary+secondary)

DOM_R2_PRI_PR 

Primary products over r2 couple regions (in-country commercial flows)

DOM_R2_SEC_PR 

Secondary products over r2 couple regions (in-country commercial flows)

DOM_R2_ALL_PR 

All products over r2 couple regions (in-country commercial flows)

DOM_SCALAR 

Scalar variable (not used)

DOM_PRI_PR_ALLCOMBS 

All possible combinations of primary products (2^ number of primary products)

Definition at line 92 of file BaseClass.h.

92 {
93 DOM_PRI_PR =1, ///< Primary products // domain of variables and constrains: primary, secondary, all products or all products over r2 couple regions (in-country commercial flows)
94 DOM_SEC_PR =2, ///< Secondary products
95 DOM_ALL_PR =3, ///< All products (primary+secondary)
96 DOM_R2_PRI_PR =4, ///< Primary products over r2 couple regions (in-country commercial flows)
97 DOM_R2_SEC_PR =5, ///< Secondary products over r2 couple regions (in-country commercial flows)
98 DOM_R2_ALL_PR =6, ///< All products over r2 couple regions (in-country commercial flows)
99 DOM_SCALAR =7, ///< Scalar variable (not used)
100 DOM_PRI_PR_ALLCOMBS =8, ///< All possible combinations of primary products (2^ number of primary products)
101};
@ DOM_PRI_PR
Primary products // domain of variables and constrains: primary, secondary, all products or all produ...
Definition BaseClass.h:93
@ DOM_R2_SEC_PR
Secondary products over r2 couple regions (in-country commercial flows)
Definition BaseClass.h:97
@ DOM_SEC_PR
Secondary products.
Definition BaseClass.h:94
@ DOM_SCALAR
Scalar variable (not used)
Definition BaseClass.h:99
@ DOM_R2_PRI_PR
Primary products over r2 couple regions (in-country commercial flows)
Definition BaseClass.h:96
@ DOM_R2_ALL_PR
All products over r2 couple regions (in-country commercial flows)
Definition BaseClass.h:98
@ DOM_PRI_PR_ALLCOMBS
All possible combinations of primary products (2^ number of primary products)
Definition BaseClass.h:100
@ DOM_ALL_PR
All products (primary+secondary)
Definition BaseClass.h:95

◆ emissionType

Emission types.

Enumerator
EM_ENSUB 

Energy substitution.

EM_MATSUB 

Material substitution.

EM_FOROP 

Flow from forest operations.

Definition at line 109 of file BaseClass.h.

109 {
110 EM_ENSUB =4, ///< Energy substitution
111 EM_MATSUB =5, ///< Material substitution
112 EM_FOROP =6, ///< Flow from forest operations
113};
@ EM_ENSUB
Energy substitution.
Definition BaseClass.h:110
@ EM_MATSUB
Material substitution.
Definition BaseClass.h:111
@ EM_FOROP
Flow from forest operations.
Definition BaseClass.h:112

◆ messageType

Type of message to be printed.

Enumerator
MSG_NO_MSG 

Do not actually output any message.

MSG_DEBUG 

Print a debug message, normally filtered out.

MSG_INFO 

Print an INFO message.

MSG_WARNING 

Print a WARNING message.

MSG_ERROR 

Print an ERROR message, but don't stop the model.

MSG_CRITICAL_ERROR 

Print an error message and stop the model.

Definition at line 55 of file BaseClass.h.

55 {
56
57 MSG_NO_MSG = 0, ///< Do not actually output any message
58 MSG_DEBUG = 1, ///< Print a debug message, normally filtered out
59 MSG_INFO = 2, ///< Print an INFO message
60 MSG_WARNING = 3, ///< Print a WARNING message
61 MSG_ERROR = 4, ///< Print an ERROR message, but don't stop the model
62 MSG_CRITICAL_ERROR = 5, ///< Print an error message and stop the model
63};
@ MSG_CRITICAL_ERROR
Print an error message and stop the model.
Definition BaseClass.h:62
@ MSG_ERROR
Print an ERROR message, but don't stop the model.
Definition BaseClass.h:61
@ MSG_DEBUG
Print a debug message, normally filtered out.
Definition BaseClass.h:58
@ MSG_WARNING
Print a WARNING message.
Definition BaseClass.h:60
@ MSG_INFO
Print an INFO message.
Definition BaseClass.h:59
@ MSG_NO_MSG
Do not actually output any message.
Definition BaseClass.h:57

◆ outputVerbosity

Verbosity level of the output.

Enumerator
OUTVL_NONE 

Output verbosity level none.

OUTVL_AGGREGATED 

Output verbosity level print aggregated output (e.g. optimisation log)

OUTVL_DETAILED 

Output verbosity level print (also) detailed output.

OUTVL_MAPS 

Output verbosity level print (also) the maps in ascii grid format.

OUTVL_BINMAPS 

Output verbosity level print (also) binary (png) maps.

OUTVL_ALL 

Output verbosity level print everything.

Definition at line 83 of file BaseClass.h.

83 {
84 OUTVL_NONE =0, ///< Output verbosity level none
85 OUTVL_AGGREGATED =10, ///< Output verbosity level print aggregated output (e.g. optimisation log)
86 OUTVL_DETAILED =15, ///< Output verbosity level print (also) detailed output
87 OUTVL_MAPS =18, ///< Output verbosity level print (also) the maps in ascii grid format
88 OUTVL_BINMAPS =20, ///< Output verbosity level print (also) binary (png) maps
89 OUTVL_ALL =25, ///< Output verbosity level print everything
90};
@ OUTVL_DETAILED
Output verbosity level print (also) detailed output.
Definition BaseClass.h:86
@ OUTVL_MAPS
Output verbosity level print (also) the maps in ascii grid format.
Definition BaseClass.h:87
@ OUTVL_BINMAPS
Output verbosity level print (also) binary (png) maps.
Definition BaseClass.h:88
@ OUTVL_NONE
Output verbosity level none.
Definition BaseClass.h:84
@ OUTVL_ALL
Output verbosity level print everything.
Definition BaseClass.h:89
@ OUTVL_AGGREGATED
Output verbosity level print aggregated output (e.g. optimisation log)
Definition BaseClass.h:85

◆ varType

enum varType
Enumerator
VAR_VOL 
VAR_AREA 
VAR_IN 

Definition at line 121 of file BaseClass.h.

121 {
122 VAR_VOL =1,
123 VAR_AREA =2,
124 VAR_IN =3
125};
@ VAR_VOL
Definition BaseClass.h:122
@ VAR_AREA
Definition BaseClass.h:123
@ VAR_IN
Definition BaseClass.h:124