Documentation for OpenFLUID 2.2.2
Loading...
Searching...
No Matches
ChronFileInterpolator.hpp
Go to the documentation of this file.
1/*
2
3 This file is part of OpenFLUID software
4 Copyright(c) 2021-2026, INRAE
5
6
7 == GNU General Public License Usage ==
8
9 OpenFLUID is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 OpenFLUID is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21
22
23 == Other Usage ==
24
25 Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26 license, and requires a written agreement between You and INRA.
27 Licensees for Other Usage of OpenFLUID may use this file in accordance
28 with the terms contained in the written agreement between You and INRA.
29
30*/
31
32
33/**
34 @file ChronFileInterpolator.hpp
35
36 @author Jean-Christophe FABRE <jean-christophe.fabre@inra.fr>
37 @author Armel THÖNI <armel.thoni@inrae.fr>
38*/
39
40
41#ifndef __OPENFLUID_TOOLS_CHRONFILEINTERPOLATOR_HPP__
42#define __OPENFLUID_TOOLS_CHRONFILEINTERPOLATOR_HPP__
43
44
45#include <list>
46#include <iostream>
47
51
52
53namespace openfluid { namespace tools {
54
55
57{
58 public:
59
60 enum PreProcess { NONE, CUMULATE };
61
62
63 private:
64
65 void checkPreload();
66
67 void checkPostload();
68
69
70 protected:
71
72 std::string m_InFilePath;
73
74 std::string m_InDateFormat;
75
77
78 std::string m_InCommentChar;
79
80 std::string m_OutFilePath;
81
82 std::string m_OutDateFormat;
83
85
86 std::string m_OutCommentChar;
87
89
91
93
95
97
99 {
100 std::cout << "--------------------------------" << std::endl;
101 for (const auto& Datum : Data)
102 {
103 std::cout << Datum.first.getAsISOString() << " -> " << Datum.second << std::endl;
104 }
105 std::cout << "--------------------------------" << std::endl;
106 }
107
108
109 public:
110
111
112 ChronFileInterpolator(const std::string& InFilePath, const std::string& OutFilePath,
113 const openfluid::core::DateTime& BeginDate, const openfluid::core::DateTime& EndDate,
114 const openfluid::core::Duration_t& DeltaT, PreProcess PrePcs = NONE);
115
117
118
119 virtual void runInterpolation() = 0;
120
121
122 std::string getInColumnSeparators() const
123 {
124 return m_InColumnSeparators;
125 }
126
127 void setInColumnSeparators(const std::string& InColumnSeparators)
128 {
129 m_InColumnSeparators = InColumnSeparators;
130 }
131
132 std::string getInCommentChar() const
133 {
134 return m_InCommentChar;
135 }
136
137 void setInCommentChar(const std::string& InCommentChar)
138 {
139 m_InCommentChar = InCommentChar;
140 }
141
142 std::string getInDateFormat() const
143 {
144 return m_InDateFormat;
145 }
146
147 void setInDateFormat(const std::string& InDateFormat)
148 {
149 m_InDateFormat = InDateFormat;
150 }
151
152 std::string getInFilePath() const
153 {
154 return m_InFilePath;
155 }
156
157 std::string getOutColumnSeparator() const
158 {
159 return m_OutColumnSeparator;
160 }
161
162 void setOutColumnSeparator(const std::string& OutColumnSeparator)
163 {
164 m_OutColumnSeparator = OutColumnSeparator;
165 }
166
167 std::string getOutCommentChar() const
168 {
169 return m_OutCommentChar;
170 }
171
172 void setOutCommentChar(const std::string& OutCommentChar)
173 {
174 m_OutCommentChar = OutCommentChar;
175 }
176
177 std::string getOutDateFormat() const
178 {
179 return m_OutDateFormat;
180 }
181
182 void setOutDateFormat(const std::string& OutDateFormat)
183 {
184 m_OutDateFormat = OutDateFormat;
185 }
186
187 std::string getOutFilePath() const
188 {
189 return m_OutFilePath;
190 }
191
193 {
194 return m_BeginDate;
195 }
196
198 {
199 return m_DeltaT;
200 }
201
203 {
204 return m_EndDate;
205 }
206
208 {
209 return m_PreProcess;
210 }
211};
212
213
214} } // namespaces
215
216
217#endif /* __OPENFLUID_TOOLS_CHRONFILEINTERPOLATOR_HPP__ */
Class for management of date and time information.
Definition DateTime.hpp:88
Definition ChronFileInterpolator.hpp:57
std::string getInColumnSeparators() const
Definition ChronFileInterpolator.hpp:122
ChronFileInterpolator(const std::string &InFilePath, const std::string &OutFilePath, const openfluid::core::DateTime &BeginDate, const openfluid::core::DateTime &EndDate, const openfluid::core::Duration_t &DeltaT, PreProcess PrePcs=NONE)
void setInCommentChar(const std::string &InCommentChar)
Definition ChronFileInterpolator.hpp:137
openfluid::core::DateTime m_BeginDate
Definition ChronFileInterpolator.hpp:88
void setInColumnSeparators(const std::string &InColumnSeparators)
Definition ChronFileInterpolator.hpp:127
std::string getInDateFormat() const
Definition ChronFileInterpolator.hpp:142
std::string m_InDateFormat
Definition ChronFileInterpolator.hpp:74
void setOutColumnSeparator(const std::string &OutColumnSeparator)
Definition ChronFileInterpolator.hpp:162
void setOutCommentChar(const std::string &OutCommentChar)
Definition ChronFileInterpolator.hpp:172
std::string getOutCommentChar() const
Definition ChronFileInterpolator.hpp:167
std::string getInFilePath() const
Definition ChronFileInterpolator.hpp:152
void setOutDateFormat(const std::string &OutDateFormat)
Definition ChronFileInterpolator.hpp:182
openfluid::core::DateTime getBeginDate() const
Definition ChronFileInterpolator.hpp:192
openfluid::core::Duration_t m_DeltaT
Definition ChronFileInterpolator.hpp:92
std::string m_InFilePath
Definition ChronFileInterpolator.hpp:72
PreProcess getPreProcess() const
Definition ChronFileInterpolator.hpp:207
void setInDateFormat(const std::string &InDateFormat)
Definition ChronFileInterpolator.hpp:147
std::string m_InColumnSeparators
Definition ChronFileInterpolator.hpp:76
static void displayChronSerie(ChronologicalSerie< double > &Data)
Definition ChronFileInterpolator.hpp:98
std::string getOutColumnSeparator() const
Definition ChronFileInterpolator.hpp:157
PreProcess
Definition ChronFileInterpolator.hpp:60
openfluid::core::Duration_t getDeltaT() const
Definition ChronFileInterpolator.hpp:197
openfluid::core::DateTime m_EndDate
Definition ChronFileInterpolator.hpp:90
std::string getOutDateFormat() const
Definition ChronFileInterpolator.hpp:177
std::string m_OutFilePath
Definition ChronFileInterpolator.hpp:80
std::string getInCommentChar() const
Definition ChronFileInterpolator.hpp:132
std::string m_OutColumnSeparator
Definition ChronFileInterpolator.hpp:84
std::string m_OutDateFormat
Definition ChronFileInterpolator.hpp:82
std::string m_InCommentChar
Definition ChronFileInterpolator.hpp:78
PreProcess m_PreProcess
Definition ChronFileInterpolator.hpp:94
std::string getOutFilePath() const
Definition ChronFileInterpolator.hpp:187
openfluid::core::DateTime getEndDate() const
Definition ChronFileInterpolator.hpp:202
void loadInFile(ChronologicalSerie< double > &Data)
std::string m_OutCommentChar
Definition ChronFileInterpolator.hpp:86
Definition ChronologicalSerie.hpp:63
#define OPENFLUID_API
Definition dllexport.hpp:86
std::uint64_t Duration_t
Definition TypeDefs.hpp:312
Definition ApplicationException.hpp:47