Commit 07e8f807 authored by Ludovic Courtès's avatar Ludovic Courtès

data: Introduce constructor that takes 'min' and 'max' and use it.

parent db3dace9
......@@ -16,6 +16,7 @@
#include <limits>
#include <fstream>
#include <cmath>
#include <cassert>
#include "common.h"
#include "args.h"
......@@ -35,6 +36,13 @@ class data
data(const parameters &p): _parameters(p) {}
data(const parameters& p, const vec& min, const vec& max)
: _parameters(p), _min(min), _max(max)
{
assert(min.size() == p.dimX());
assert(max.size() == p.dimX());
}
/* TODO: Eventually mark the following constructors as deprecated. */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
......
......@@ -29,6 +29,14 @@ vertical_segment::vertical_segment(const parameters& params,
{
}
vertical_segment::vertical_segment(const parameters& params,
std::vector<vec>&& input_data,
const vec& min, const vec& max)
: data(params, min, max), _data(input_data),
_is_absolute(true), _dt(0.1)
{
}
vertical_segment::vertical_segment(const parameters& params, unsigned int size):
data(params), _is_absolute(true), _dt(0.1)
{
......
......@@ -83,6 +83,10 @@ class vertical_segment : public data
vertical_segment(const parameters& params,
std::vector<vec>&& data);
vertical_segment(const parameters& params,
std::vector<vec>&& data,
const vec& min, const vec& max);
vertical_segment(const parameters& params, unsigned int size);
//! \brief Default constructor that does nothing at all.
......
......@@ -79,9 +79,8 @@ bool rational_fitter_parallel::fit_data(const ptr<data>& dat, ptr<function>& fit
}
ptr<vertical_segment> vs(new vertical_segment(dat->parametrization(),
std::move(content)));
vs->setMin(dat->min());
vs->setMax(dat->max());
std::move(content),
dat->min(), dat->max()));
d = vs;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment