21 #ifndef __SOLVER_VARIABLE_STORAGE_RAW_H__
22 #define __SOLVER_VARIABLE_STORAGE_RAW_H__
26 #include <yuni/yuni.h>
28 #include <antares/memory/memory.h>
32 namespace Antares::Solver::Variable::R::AllYears
34 template<
class NextT ,
int FileFilter >
35 struct Raw:
public NextT
46 categoryFile = NextT::categoryFile | Variable::Category::FileLevel::allFile,
80 inline void merge(uint year,
const IntermediateValues& rhs)
82 rawdata.merge(year, rhs);
84 NextType::merge(year, rhs);
87 template<
class S,
class VCardT>
88 void buildSurveyReport(SurveyResults& report,
94 if (fileLevel & FileFilter && !(fileLevel & Category::FileLevel::id))
98 case Category::hourly:
99 InternalExportValues<Category::hourly, HOURS_PER_YEAR, VCardT>(
101 ::Antares::Memory::RawPointer(rawdata.hourly));
103 case Category::daily:
104 InternalExportValues<Category::daily, DAYS_PER_YEAR, VCardT>(report, rawdata.daily);
106 case Category::weekly:
107 InternalExportValues<Category::weekly, WEEKS_PER_YEAR, VCardT>(report,
110 case Category::monthly:
111 InternalExportValues<Category::monthly, MONTHS_PER_YEAR, VCardT>(report,
114 case Category::annual:
115 InternalExportValues<Category::annual, 1, VCardT>(report, rawdata.year.data());
120 NextType::template buildSurveyReport<S, VCardT>(report,
127 template<
class VCardT>
128 void buildDigest(SurveyResults& report,
int digestLevel,
int dataLevel)
const
130 if ((dataLevel & Category::DataLevel::area || dataLevel & Category::DataLevel::setOfAreas)
131 && digestLevel & Category::digestAllYears)
133 assert(report.data.columnIndex < report.maxVariables &&
"Column index out of bounds");
135 report.captions[0][report.data.columnIndex] = report.variableCaption;
136 report.captions[1][report.data.columnIndex] = report.variableUnit;
137 report.captions[2][report.data.columnIndex] =
"values";
140 report.precision[report.data.columnIndex] = PrecisionToPrintfFormat<
141 VCardT::decimal>::Value();
143 report.values[report.data.columnIndex][report.data.rowIndex] = rawdata.allYears;
145 report.digestNonApplicableStatus[report.data.rowIndex][report.data.columnIndex]
146 = *report.isCurrentVarNA;
148 ++(report.data.columnIndex);
151 NextType::template buildDigest<VCardT>(report, digestLevel, dataLevel);
154 template<
template<
class,
int>
class DecoratorT>
155 Antares::Memory::Stored<double>::ConstReturnType hourlyValuesForSpatialAggregate()
const
157 if (Yuni::Static::Type::StrictlyEqual<DecoratorT<Empty, 0>, Raw<Empty, 0>>::Yes)
159 return rawdata.hourly;
161 return NextType::template hourlyValuesForSpatialAggregate<DecoratorT>();
168 template<
int PrecisionT, u
int Size,
class VCardT>
169 void InternalExportValues(SurveyResults& report,
const double* array)
const
172 assert(report.data.columnIndex < report.maxVariables &&
"Column index out of bounds");
175 report.captions[0][report.data.columnIndex] = report.variableCaption;
176 report.captions[1][report.data.columnIndex] = report.variableUnit;
177 report.captions[2][report.data.columnIndex] =
"values";
180 VCardT::decimal>::Value();
182 report.nonApplicableStatus[report.data.columnIndex] = *report.isCurrentVarNA;
185 if (PrecisionT == Category::annual)
187 rawdata.allYears = 0.;
188 for (uint i = 0; i != rawdata.nbYearsCapacity; ++i)
190 rawdata.allYears += array[i];
192 *(report.values[report.data.columnIndex]) = rawdata.allYears;
196 (void)::memcpy(report.values[report.data.columnIndex], array,
sizeof(
double) * Size);
200 ++report.data.columnIndex;
203 template<u
int Size,
class VCardT>
204 void InternalExportValuesMC(
int precision, SurveyResults& report,
const double* array)
const
206 if (not(precision & Category::annual))
210 assert(report.data.columnIndex < report.maxVariables &&
"Column index out of bounds");
213 report.captions[0][report.data.columnIndex] = report.variableCaption;
214 report.captions[1][report.data.columnIndex] = report.variableUnit;
215 report.captions[2][report.data.columnIndex] =
"values";
218 VCardT::decimal>::Value();
220 report.nonApplicableStatus[report.data.columnIndex] = *report.isCurrentVarNA;
222 (void)::memcpy(report.data.matrix[report.data.columnIndex],
224 report.data.nbYears *
sizeof(
double));
227 ++report.data.columnIndex;
NextT NextType
Type of the net item in the list.
Definition: raw.h:39
static const char * Name()
Name of the filter.
Definition: raw.h:56
@ count
The count if item in the list.
Definition: raw.h:44