Commit d2884238 authored by Ludovic Courtès's avatar Ludovic Courtès

core: data: Remove the one-argument 'set' method.

parent 997ff3ef
...@@ -71,8 +71,7 @@ class data ...@@ -71,8 +71,7 @@ class data
//! match the total dimension: dimX + dimY. //! match the total dimension: dimX + dimY.
virtual vec value(const vec& in) const = 0; virtual vec value(const vec& in) const = 0;
//! \brief Put the sample inside the data //! \brief Put the sample inside the data at index I.
virtual void set(const vec& x) = 0;
virtual void set(int i, const vec& x) = 0; virtual void set(int i, const vec& x) = 0;
...@@ -162,12 +161,6 @@ class data_params : public data ...@@ -162,12 +161,6 @@ class data_params : public data
return _data[i]; return _data[i];
} }
//! \todo This should crash at execution.
virtual void set(const vec& x)
{
this->set(x);
}
virtual void set(int i, const vec& x) virtual void set(int i, const vec& x)
{ {
this->set(i, x); this->set(i, x);
......
...@@ -133,24 +133,6 @@ vec vertical_segment::get(int i) const ...@@ -133,24 +133,6 @@ vec vertical_segment::get(int i) const
return res ; return res ;
} }
//! \todo Check the vertical segment size and if the data
//! is not already present.
void vertical_segment::set(const vec& x)
{
// Check if the input data 'x' has the size of a vertical segment (i.e. dimX+3*dimY),
// if it only has the size of a single value, then create the segment.
if(x.size() == _parameters.dimX() + 3*_parameters.dimY()) {
_data.push_back(x);
} else if(x.size() == _parameters.dimX() + _parameters.dimY()) {
_data.push_back(vs(x));
} else {
std::cerr << "<<ERROR>> Passing an incorrect element to vertical_segment::set" << std::endl;
throw;
}
}
void vertical_segment::set(int i, const vec& x) void vertical_segment::set(int i, const vec& x)
{ {
// Check if the input data 'x' has the size of a vertical segment (i.e. dimX+3*dimY), // Check if the input data 'x' has the size of a vertical segment (i.e. dimX+3*dimY),
......
...@@ -96,8 +96,7 @@ class vertical_segment : public data ...@@ -96,8 +96,7 @@ class vertical_segment : public data
NOT_IMPLEMENTED(); NOT_IMPLEMENTED();
} }
//! \brief Put the sample inside the data //! \brief Put the sample inside the data at index I.
virtual void set(const vec& x);
virtual void set(int i, const vec& x); virtual void set(int i, const vec& x);
//! \brief Specific accessor to a vertical segment, this gives the //! \brief Specific accessor to a vertical segment, this gives the
......
...@@ -310,10 +310,6 @@ class BrdfGrid : public vertical_segment { ...@@ -310,10 +310,6 @@ class BrdfGrid : public vertical_segment {
return get(i) ; return get(i) ;
} }
void set(const vec& x)
{
NOT_IMPLEMENTED();
}
void set(int id, const vec& x) void set(int id, const vec& x)
{ {
vertical_segment::set(id, x); vertical_segment::set(id, x);
......
...@@ -149,10 +149,6 @@ class MatlabInterpolant : public data ...@@ -149,10 +149,6 @@ class MatlabInterpolant : public data
return get(i) ; return get(i) ;
} }
virtual void set(const vec& x)
{
NOT_IMPLEMENTED();
}
virtual void set(int i, const vec& x) virtual void set(int i, const vec& x)
{ {
_data->set(i, x); _data->set(i, x);
......
...@@ -134,11 +134,6 @@ class rbf_interpolant : public data ...@@ -134,11 +134,6 @@ class rbf_interpolant : public data
return get(i) ; return get(i) ;
} }
//! \todo Test this function
virtual void set(const vec& x)
{
NOT_IMPLEMENTED();
}
virtual void set(int i, const vec& x) virtual void set(int i, const vec& x)
{ {
NOT_IMPLEMENTED(); NOT_IMPLEMENTED();
......
...@@ -147,25 +147,6 @@ public: // methods ...@@ -147,25 +147,6 @@ public: // methods
return res ; return res ;
} }
//! \todo Test this function
void set(const vec& x)
{
assert(x.size() == 6);
const int phid_ind = phi_diff_index(x[2]);
const int thed_ind = theta_diff_index(x[1]);
const int theh_ind = theta_half_index(x[0]);
const int i = (theh_ind*BRDF_SAMPLING_RES_THETA_D + thed_ind)*(BRDF_SAMPLING_RES_PHI_D/2) + phid_ind;
#ifdef DEBUG
std::cout << "set -> " << i << " (" << theh_ind << ", " << thed_ind << ", " << phid_ind << ")" << std::endl;
std::cout << " " << x[0] << ", " << x[1] << ", " << x[2] << std::endl;
std::cout << std::endl;
#endif
brdf[i] = x[3] / RED_SCALE;
brdf[i + BRDF_SAMPLING_RES_THETA_H*BRDF_SAMPLING_RES_THETA_D*BRDF_SAMPLING_RES_PHI_D/2] = x[4] / GREEN_SCALE;
brdf[i + BRDF_SAMPLING_RES_THETA_H*BRDF_SAMPLING_RES_THETA_D*BRDF_SAMPLING_RES_PHI_D] = x[5] / BLUE_SCALE;
}
void set(int i, const vec& x) { void set(int i, const vec& x) {
assert(x.size() == parametrization().dimY()); assert(x.size() == parametrization().dimY());
int iR = i; int iR = i;
......
...@@ -149,31 +149,6 @@ class BrdfSlice : public data { ...@@ -149,31 +149,6 @@ class BrdfSlice : public data {
return res ; return res ;
} }
//! \todo Test this function
void set(const vec& x)
{
// Copy vector is required
vec _x = x;
// Reverse the first part of the vector
if(_reverse) {
_x.segment(0, parametrization().dimX()).reverseInPlace();
}
assert(_x.size() == parametrization().dimX()+parametrization().dimY());
assert(_x[0] <= _max[0] && _x[0] >= _min[0]);
assert(_x[1] <= _max[1] && _x[1] >= _min[1]);
const int i = floor((_x[0]-_min[0]) * _width / (_max[0] - _min[0]));
const int j = floor((_x[1]-_min[1]) * _height / (_max[1] - _min[1]));
const int k = 0;
//const int k = floor(x[2] * _slice / (M_PI));
const int id = i + j*_width + k*_width*_height;
_data[3*id + 0] = _x[parametrization().dimX()+0];
_data[3*id + 1] = _x[parametrization().dimX()+1];
_data[3*id + 2] = _x[parametrization().dimX()+2];
}
void set(int id, const vec& x) void set(int id, const vec& x)
{ {
assert(x.size() == parametrization().dimX() + parametrization().dimY()); assert(x.size() == parametrization().dimX() + parametrization().dimY());
......
...@@ -264,24 +264,6 @@ public: ...@@ -264,24 +264,6 @@ public:
return RGB; return RGB;
} }
// Set data
virtual void set(const vec& x) {
assert(x.size() == parametrization().dimX()+parametrization().dimY());
const double PI2 = M_PI*0.5;
if(x[0]>PI2 || x[2]>PI2) {
return;
}
int iti, ipi, itv, ipv;
vecToIndex(x, iti, ipi, itv, ipv);
const int index = ((iti*npi + ipi)*ntv + itv)*npv + ipv;
Bd[index + 0*nPerPlane] = x[parametrization().dimX() + 0];
Bd[index + 1*nPerPlane] = x[parametrization().dimX() + 1];
Bd[index + 2*nPerPlane] = x[parametrization().dimX() + 2];
}
virtual void set(int i, const vec& x) { virtual void set(int i, const vec& x) {
assert(x.size() == parametrization().dimY()); assert(x.size() == parametrization().dimY());
for(int isp=0; isp<planes; ++isp) { for(int isp=0; isp<planes; ++isp) {
......
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