Commit 318630e4ff0575b242a25fe8654c747192468130

Authored by Menouard AZIB
1 parent 347ee32b

Refactoring of plotFunction to take into account param_nb_points xml node

src/ParamOutputImpl/Plot/InstantPlot/PlotFunction.cc
... ... @@ -98,7 +98,7 @@ namespace plot
98 98 {
99 99 std::string id = std::to_string(lSeries.getId()) + "_" + lSeries.getParamId() + "_" + std::to_string(lIndex.getDim1Index());
100 100 plot::ParameterData data = (*_pParameterValues)[lSeries.getParamId()];
101   - PlotFunction::compute(lIndex, data, id);
  101 + PlotFunction::compute(lIndex, data, id, lSeries.getParamId());
102 102 }
103 103 }
104 104 }
... ... @@ -183,9 +183,27 @@ namespace plot
183 183 *maxToFill = maxValue;
184 184 }
185 185  
186   - void PlotFunction::compute(AMDA::Common::ParameterIndexComponent pParamIndex, plot::ParameterData data, std::string id)
  186 + void PlotFunction::compute(AMDA::Common::ParameterIndexComponent pParamIndex, plot::ParameterData data, std::string id, std::string param_id)
187 187 {
188 188 double samplingValue = 60.0;
  189 + double nb_points = 1;
  190 +
  191 + auto it = find(paramsNbPoints.begin(), paramsNbPoints.end(), param_id);
  192 + // If parameter was found
  193 + if (it != paramsNbPoints.end())
  194 + {
  195 + int index = it - paramsNbPoints.begin();
  196 + samplingValue = stod(paramsNbPoints[index + 1]);
  197 + nb_points = stod(paramsNbPoints[index + 2]);
  198 + }
  199 + else
  200 + {
  201 + std::stringstream lError;
  202 + lError << "PlotFunction::compute"
  203 + << ": param with id '" << param_id << "' is not found in param_nb_points xml node.";
  204 + BOOST_THROW_EXCEPTION(PanelPlotOutputException() << AMDA::ex_msg(lError.str()));
  205 + }
  206 +
189 207 double *values = data.getValues(pParamIndex, 0);
190 208 int startIndex;
191 209 int nbValues = 0;
... ...
src/ParamOutputImpl/Plot/InstantPlot/PlotFunction.hh
... ... @@ -56,11 +56,6 @@ namespace plot
56 56 return PlotFunction_NODENAME;
57 57 }
58 58  
59   - void setOriginalParamId(std::string originalParamId_)
60   - {
61   - originalParamId = originalParamId_;
62   - };
63   -
64 59 void setAbscisse(Abscisse abscisse_)
65 60 {
66 61 abscisse = abscisse_;
... ... @@ -149,8 +144,8 @@ namespace plot
149 144 void createYAxis();
150 145 void createXAxis();
151 146 void getMinMax(std::map<std::string, std::vector<double>>, double *minToFill, double *maxToFill);
  147 + void compute(AMDA::Common::ParameterIndexComponent pParamIndex, plot::ParameterData data, std::string id, std::string param_id);
152 148  
153   - void compute(AMDA::Common::ParameterIndexComponent pParamIndex, plot::ParameterData data, std::string id);
154 149 std::map<std::string, std::vector<double>> xValuesMap;
155 150 std::map<std::string, std::vector<double>> yValuesMap;
156 151 Function function;
... ... @@ -159,14 +154,6 @@ namespace plot
159 154 Axis::Scale abscisseScale;
160 155 Axis::Scale ordonneeScale;
161 156 std::shared_ptr<TimeAxisDecorator> _xdecoratorPtr;
162   -
163   - /**
164   - * @brief original param Id.
165   - */
166   - std::string originalParamId;
167   - std::list<std::string> listParamsId;
168   - // std::vector<double> xValues;
169   - // std::vector<double> yValues;
170 157 };
171 158 }
172 159 #endif
... ...