FFSM++  1.1.0
French Forest Sector Model ++
Output.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2015 by Laboratoire d'Economie Forestière *
3  * http://ffsm-project.org *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU 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, given the compliance with the *
9  * exceptions listed in the file COPYING that is distribued together *
10  * with this file. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program; if not, write to the *
19  * Free Software Foundation, Inc., *
20  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  ***************************************************************************/
22 #ifndef STDOUTPUT_H
23 #define STDOUTPUT_H
24 
25 // Core C++ headers
26 #include <string>
27 #include <vector>
28 #include <map>
29 #include <stdexcept>
30 #include <iostream>
31 #include <sstream>
32 #include <time.h>
33 #include <tr1/array>
34 
35 //regmas headers
36 #include "BaseClass.h"
37 
38 
39 class Pixel;
40 
41 
42 /// %Output methods
43 
44 /**
45 Class responsable to output the data, both as all kind of log as well as georeferenciated one.
46 @author Antonello Lobianco
47 */
48 class Output: public BaseClass{
49 public:
50  Output(ThreadManager* MTHREAD_h); ///< Constructor
51  ~Output();
52 
53  void initOutput();
54  void commonInit();
55  void initOutputMaps();
56  void initOutputForestData();
57  void initOutputProductData();
58  void initOptimisationLog();
59  void initDebugOutput();
60  void initDebugPixelValues();
61  void initCarbonBalance();
62  void print(bool earlyPrint=true); ///< Print output. If earlyPrinting it doesn't print some stuff for which we don't yet have values
63  void printMaps();
64  void printForestData(bool finalFlush);
65  void printProductData(bool finalFlush);
66  void printCarbonBalance();
67  void printFinalOutput();
68  void printDebugOutput();
69  void printDetailedHV(map<tr1::array<string, 4>,double> hVol_byPrd);
70  void printDebugPixelValues();
71  void printOptLog(bool optimal, int &nIterations, double &obj);
73  void cleanScenario(string fileName, string scenarioName, char d);
74 
75  vector <vector < vector <vector <vector <double> > > > > expReturnsDebug; ///< l2_region, for type, d.c., pr prod, variable name
76  vector <string> expReturnsDebugVariables;
77 
78 private:
79  int oLevel;
80  char d;
81  int inYear;
82  int nYears;
83  string baseDir;
84  string oDir;
85  string scenarioName;
86  string oFileExt;
87  bool oHRedeable;
89  vector<int> oYears; // list of output years for data
90  vector<int> mapsOYears; // list of output years for maps
91  int wRegId_l1;
92  int wRegId_l2;
93  string outFileName;
94  vector <string> outForVariables;
95  vector <string> outProdVariables;
96  bool oForData;
97  bool oProdData;
101  vector<string> priPr;
102  vector<string> secPr;
103  vector<string> allPr;
104  vector<int> l1regIds;
105  vector < vector <int> > l2r;
106  vector <string> fTypes;
107  vector <string> dClasses; /// includes an empty string for variables without diameter attribute
108  vector <string> pDClasses; ///< production diameter classes: exclude the fist diameter class below 15 cm
109  int nPriPr;
110  int nSecPr;
111  int nAllPr;
112  int nL2r;
113  string logFilename;
116  bool spMode; // spatial mode
117 };
118 #endif
void initOutput()
Definition: Output.cpp:48
void printDebugOutput()
Definition: Output.cpp:843
vector< int > mapsOYears
Definition: Output.h:90
void initOutputProductData()
Definition: Output.cpp:338
int nSecPr
Definition: Output.h:110
string debugFilename
Definition: Output.h:114
void initOutputForestData()
Definition: Output.cpp:296
vector< string > dClasses
Definition: Output.h:107
int nL2r
Definition: Output.h:112
void printCarbonBalance()
Definition: Output.cpp:727
Output(ThreadManager *MTHREAD_h)
Constructor.
Definition: Output.cpp:37
void printMaps()
Definition: Output.cpp:451
void printDebugPixelValues()
Definition: Output.cpp:880
string outFileName
Definition: Output.h:93
vector< string > expReturnsDebugVariables
Definition: Output.h:76
vector< string > pDClasses
includes an empty string for variables without diameter attribute
Definition: Output.h:108
void initDebugPixelValues()
Definition: Output.cpp:207
int outStepRange
Definition: Output.h:99
string logFilename
Definition: Output.h:113
void printOptLog(bool optimal, int &nIterations, double &obj)
Definition: Output.cpp:827
string debugPxValuesFilename
Definition: Output.h:115
vector< string > secPr
Definition: Output.h:102
Thread manager. Responsable to manage the main thread and "speak" with the GUI.
Definition: ThreadManager.h:65
void initOptimisationLog()
Definition: Output.cpp:131
int oLevel
Definition: Output.h:79
string oFileExt
Definition: Output.h:86
void printProductData(bool finalFlush)
Definition: Output.cpp:589
string baseDir
Definition: Output.h:83
vector< int > l1regIds
Definition: Output.h:104
int inYear
Definition: Output.h:81
bool oHRedeable
Definition: Output.h:87
Output methods
Definition: Output.h:48
vector< string > allPr
Definition: Output.h:103
vector< vector< int > > l2r
Definition: Output.h:105
int wRegId_l2
Definition: Output.h:92
vector< int > oYears
Definition: Output.h:89
void cleanScenario(string fileName, string scenarioName, char d)
Definition: Output.cpp:1149
Pixel-level class.
Definition: Pixel.h:47
char getOutputFieldDelimiter()
Definition: Output.cpp:802
void initCarbonBalance()
Definition: Output.cpp:370
char d
Definition: Output.h:80
int nAllPr
Definition: Output.h:111
vector< string > priPr
Definition: Output.h:101
bool oCarbonData
Definition: Output.h:98
Base class for the regmas application.
Definition: BaseClass.h:239
vector< string > outProdVariables
Definition: Output.h:95
void printFinalOutput()
Definition: Output.cpp:462
void commonInit()
Definition: Output.cpp:61
void printDetailedHV(map< tr1::array< string, 4 >, double > hVol_byPrd)
Definition: Output.cpp:1173
bool oForData
Definition: Output.h:96
int nYears
Definition: Output.h:82
~Output()
Definition: Output.cpp:41
void print(bool earlyPrint=true)
Print output. If earlyPrinting it doesn&#39;t print some stuff for which we don&#39;t yet have values...
Definition: Output.cpp:426
bool oSingleFile
Definition: Output.h:88
bool forestDiamDetailedOutput
Definition: Output.h:100
void initDebugOutput()
Definition: Output.cpp:170
int nPriPr
Definition: Output.h:109
int wRegId_l1
Definition: Output.h:91
vector< vector< vector< vector< vector< double > > > > > expReturnsDebug
l2_region, for type, d.c., pr prod, variable name
Definition: Output.h:75
bool oProdData
Definition: Output.h:97
void printForestData(bool finalFlush)
Definition: Output.cpp:474
This file is the header of BaseClass and it is included by ALL compiled code.
vector< string > fTypes
Definition: Output.h:106
void initOutputMaps()
Definition: Output.cpp:406
string scenarioName
Definition: Output.h:85
bool spMode
Definition: Output.h:116
string oDir
Definition: Output.h:84
vector< string > outForVariables
Definition: Output.h:94