##// END OF EJS Templates
Adds unit test of spectrogram with holes at the beginning and the end
Adds unit test of spectrogram with holes at the beginning and the end

File last commit:

r1004:15899f42a907
r1028:7598132c69c6
Show More
VectorSeries.cpp
83 lines | 2.7 KiB | text/x-c | CppLexer
/ core / src / Data / VectorSeries.cpp
Alexandre Leroux
Creates vector series...
r561 #include "Data/VectorSeries.h"
Alexandre Leroux
Updates VectorSeries() to create a single QVector for ArrayData with three vectors in entry
r646 namespace {
/**
* Flatten the three components of a vector to a single QVector that can be passed to an ArrayData
*
* Example:
* xValues = {1, 2, 3}
* yValues = {4, 5, 6}
* zValues = {7, 8, 9}
*
* result = {1, 4, 7, 2, 5, 8, 3, 6, 9}
*
* @param xValues the x-component values of the vector
* @param yValues the y-component values of the vector
* @param zValues the z-component values of the vector
* @return the single QVector
* @remarks the three components are consumed
* @sa ArrayData
*/
Alexandre Leroux
Uses std::vector instead of QVector in ArrayData (1)...
r694 std::vector<double> flatten(std::vector<double> xValues, std::vector<double> yValues,
std::vector<double> zValues)
Alexandre Leroux
Updates VectorSeries() to create a single QVector for ArrayData with three vectors in entry
r646 {
if (xValues.size() != yValues.size() || xValues.size() != zValues.size()) {
/// @todo ALX : log
return {};
}
Alexandre Leroux
Uses std::vector instead of QVector in ArrayData (1)...
r694 auto result = std::vector<double>();
Alexandre Leroux
Updates VectorSeries() to create a single QVector for ArrayData with three vectors in entry
r646 result.reserve(xValues.size() * 3);
Alexandre Leroux
Removes compilation warnings (with Meson)
r1004 for (auto i = 0u; i < xValues.size(); ++i) {
Perf improvement on vector points interleaving....
r705 result.push_back(xValues[i]);
result.push_back(yValues[i]);
result.push_back(zValues[i]);
Alexandre Leroux
Updates cache strategy
r771 }
Alexandre Leroux
Updates VectorSeries() to create a single QVector for ArrayData with three vectors in entry
r646
return result;
}
} // namespace
Alexandre Leroux
Uses std::vector instead of QVector in ArrayData (1)...
r694 VectorSeries::VectorSeries(std::vector<double> xAxisData, std::vector<double> xValuesData,
std::vector<double> yValuesData, std::vector<double> zValuesData,
Alexandre Leroux
Creates vector series...
r561 const Unit &xAxisUnit, const Unit &valuesUnit)
Alexandre Leroux
Updates VectorSeries() to create a single QVector for ArrayData with three vectors in entry
r646 : VectorSeries{std::move(xAxisData), flatten(std::move(xValuesData), std::move(yValuesData),
std::move(zValuesData)),
xAxisUnit, valuesUnit}
{
}
Alexandre Leroux
Uses std::vector instead of QVector in ArrayData (1)...
r694 VectorSeries::VectorSeries(std::vector<double> xAxisData, std::vector<double> valuesData,
Alexandre Leroux
Updates VectorSeries() to create a single QVector for ArrayData with three vectors in entry
r646 const Unit &xAxisUnit, const Unit &valuesUnit)
Alexandre Leroux
Creates vector series...
r561 : DataSeries{std::make_shared<ArrayData<1> >(std::move(xAxisData)), xAxisUnit,
Alexandre Leroux
Updates VectorSeries() to create a single QVector for ArrayData with three vectors in entry
r646 std::make_shared<ArrayData<2> >(std::move(valuesData), 3), valuesUnit}
Alexandre Leroux
Creates vector series...
r561 {
}
std::unique_ptr<IDataSeries> VectorSeries::clone() const
{
return std::make_unique<VectorSeries>(*this);
}
std::shared_ptr<IDataSeries> VectorSeries::subDataSeries(const SqpRange &range)
{
Alexandre Leroux
Uses std::vector instead of QVector in ArrayData (1)...
r694 auto subXAxisData = std::vector<double>();
Alexandre Leroux
Fixes slowness when opening variable
r768 auto subValuesData = std::vector<double>();
Alexandre Leroux
Creates vector series...
r561
this->lockRead();
{
Alexandre Leroux
(Refactoring) Renames IDataSeries::subData()
r605 auto bounds = xAxisRange(range.m_TStart, range.m_TEnd);
Alexandre Leroux
Creates vector series...
r561 for (auto it = bounds.first; it != bounds.second; ++it) {
Alexandre Leroux
Uses std::vector instead of QVector in ArrayData (1)...
r694 subXAxisData.push_back(it->x());
Alexandre Leroux
Fixes slowness when opening variable
r768 subValuesData.push_back(it->value(0));
subValuesData.push_back(it->value(1));
subValuesData.push_back(it->value(2));
Alexandre Leroux
Creates vector series...
r561 }
}
this->unlock();
Alexandre Leroux
Fixes slowness when opening variable
r768 return std::make_shared<VectorSeries>(std::move(subXAxisData), std::move(subValuesData),
Alexandre Leroux
Uses std::vector instead of QVector in ArrayData (1)...
r694 this->xAxisUnit(), this->valuesUnit());
Alexandre Leroux
Creates vector series...
r561 }