Commit a92571dd authored by PACANOWSKI Romain's avatar PACANOWSKI Romain

Added constructors to be able to construct vertical segment data, initialized...

Added constructors to be able to construct vertical segment data, initialized to zero, from a given size and dimensions.
parent b50c8030
......@@ -21,6 +21,38 @@
//#define RELATIVE_ERROR
vertical_segment::vertical_segment(unsigned int dim_X,
unsigned int dim_Y,
unsigned int size)
: data(dim_X, dim_Y)
{
initializeToZero( size );
}
vertical_segment::vertical_segment( params::input in_param,
params::output out_param,
unsigned int size )
: data( in_param, out_param)
{
initializeToZero( size );
}
void
vertical_segment::initializeToZero( unsigned int number_of_data_elements )
{
_data.clear();
unsigned int const size_of_one_element = dimX() + dimY();
for( unsigned int i=0; i < number_of_data_elements; i++)
{
vec initial_element = vec::Zero( size_of_one_element );
_data.push_back( initial_element );
}
}
void vertical_segment::load(const std::string& filename)
{
arguments args ;
......@@ -279,8 +311,11 @@ vec vertical_segment::get(int i) const
{
const int n = dimX() + dimY();
vec res(n);
for(int k=0; k<n; ++k) { res[k] = _data[i][k]; }
for(int k=0; k<n; ++k)
{
res[k] = _data[i][k];
}
return res ;
}
......
......@@ -73,6 +73,21 @@ class vertical_segment : public data
{
public: // methods
//! \brief Default constructor that does nothing at all.
vertical_segment()
{
}
vertical_segment(unsigned int dim_X, unsigned int dim_Y, unsigned int size);
//! \brief Construct vertical segment data for a given size and where the size of each element
//! is also given. All data are initialized to zero
vertical_segment( params::input in_param,
params::output out_param,
unsigned int size );
// Load data from a file
virtual void load(const std::string& filename) ;
......@@ -113,6 +128,9 @@ class vertical_segment : public data
// Get data size
virtual int size() const ;
private: // method
void initializeToZero( unsigned int number_of_data_elements );
private: // data
// Store for each point of data, the upper
......
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