##// END OF EJS Templates
Merge pull request 278 from SCIQLOP-Initialisation develop...
leroux -
r734:967d82d8946b merge
parent child
Show More
@@ -94,13 +94,13 Unit readXAxisUnit(QTextStream &stream)
94 * @param stream the stream to read
94 * @param stream the stream to read
95 * @return the pair of vectors x-axis data/values data that has been read in the stream
95 * @return the pair of vectors x-axis data/values data that has been read in the stream
96 */
96 */
97 QPair<QVector<double>, QVector<QVector<double> > >
97 std::pair<std::vector<double>, std::vector<double> >
98 readResults(QTextStream &stream, AmdaResultParser::ValueType valueType)
98 readResults(QTextStream &stream, AmdaResultParser::ValueType valueType)
99 {
99 {
100 auto expectedNbValues = nbValues(valueType);
100 auto expectedNbValues = nbValues(valueType);
101
101
102 auto xData = QVector<double>{};
102 auto xData = std::vector<double>{};
103 auto valuesData = QVector<QVector<double> >(expectedNbValues);
103 auto valuesData = std::vector<double>{};
104
104
105 QString line{};
105 QString line{};
106
106
@@ -131,7 +131,7 readResults(QTextStream &stream, AmdaResultParser::ValueType valueType)
131 .arg(line, column);
131 .arg(line, column);
132 value = std::numeric_limits<double>::quiet_NaN();
132 value = std::numeric_limits<double>::quiet_NaN();
133 }
133 }
134 valuesData[valueIndex].append(value);
134 valuesData.push_back(value);
135 }
135 }
136 }
136 }
137 else {
137 else {
@@ -147,7 +147,7 readResults(QTextStream &stream, AmdaResultParser::ValueType valueType)
147 }
147 }
148 }
148 }
149
149
150 return qMakePair(std::move(xData), std::move(valuesData));
150 return std::make_pair(std::move(xData), std::move(valuesData));
151 }
151 }
152
152
153 } // namespace
153 } // namespace
@@ -192,19 +192,11 std::shared_ptr<IDataSeries> AmdaResultParser::readTxt(const QString &filePath,
192 // Creates data series
192 // Creates data series
193 switch (valueType) {
193 switch (valueType) {
194 case ValueType::SCALAR:
194 case ValueType::SCALAR:
195 Q_ASSERT(results.second.size() == 1);
195 return std::make_shared<ScalarSeries>(std::move(results.first),
196 return std::make_shared<ScalarSeries>(
196 std::move(results.second), xAxisUnit, Unit{});
197 std::move(results.first.toStdVector()),
197 case ValueType::VECTOR:
198 std::move(results.second.takeFirst().toStdVector()), xAxisUnit, Unit{});
198 return std::make_shared<VectorSeries>(std::move(results.first),
199 case ValueType::VECTOR: {
199 std::move(results.second), xAxisUnit, Unit{});
200 Q_ASSERT(results.second.size() == 3);
201 auto xValues = results.second.takeFirst().toStdVector();
202 auto yValues = results.second.takeFirst().toStdVector();
203 auto zValues = results.second.takeFirst().toStdVector();
204 return std::make_shared<VectorSeries>(std::move(results.first.toStdVector()),
205 std::move(xValues), std::move(yValues),
206 std::move(zValues), xAxisUnit, Unit{});
207 }
208 case ValueType::UNKNOWN:
200 case ValueType::UNKNOWN:
209 // Invalid case
201 // Invalid case
210 break;
202 break;
General Comments 0
You need to be logged in to leave comments. Login now