rsvs3D  0.0.0
Codes for the c++ implementation of the 3D RSVS
vectorarray_incl.cpp
Go to the documentation of this file.
1 
10 #ifndef VECTORARRAY_INCL_H_INCLUDED
11 #define VECTORARRAY_INCL_H_INCLUDED
12 #include <fstream>
13 
14 #include "vectorarray.hpp" // include guarded does nothing (needed for the linter)
15 
16 template <class T> void ArrayVec<T>::assign(int nR, int nC, T newelem)
17 {
18  std::vector<T> tempElems;
19  tempElems.assign(nC, newelem);
20  elems.assign(nR, tempElems);
21 
22  dim.clear();
23  dim.push_back(nR);
24  dim.push_back(nC);
25 }
26 template <class T> void ArrayVec<T>::write(std::ostream &streamout, const char *sep) const
27 {
28  int nR = 0, nC = 0;
29  this->size(nR, nC);
30  for (int i = 0; i < nR; ++i)
31  {
32  for (int j = 0; j < nC; ++j)
33  {
34  streamout << this->elems[i][j] << sep;
35  }
36  streamout << std::endl;
37  }
38 }
39 
40 template <class T> void DisplayArray(const T &in)
41 {
42  for (int i; i < in.size(); ++i)
43  {
44  std::cout << i << " : ";
45  DisplayVector(in[i]);
46  std::cout << std::endl;
47  }
48 }
49 
50 #endif // VECTORARRAY_INCL_H_INCLUDED
Template class for vector of vectors (matrix).
Definition: vectorarray.hpp:51
Provides a 2D std::vector based container.