24 #ifndef __DOLFIN_ARRAY_H
25 #define __DOLFIN_ARRAY_H
31 #include <dolfin/common/constants.h>
32 #include <dolfin/log/log.h>
41 template <
typename T>
class Array
47 explicit Array(std::size_t N) : _size(N), _x(new T[N]), _owner(true) {}
50 Array(std::size_t N, T* x) : _size(N), _x(x), _owner(false) {}
63 std::string
str(
bool verbose)
const
69 s <<
str(
false) << std::endl << std::endl;
71 for (std::size_t i = 0; i <
size(); i++)
72 s << i <<
": " << (*
this)[i] << std::endl;
75 s <<
"<Array<T> of size " <<
size() <<
">";
86 { dolfin_assert(i < _size);
return _x[i]; }
90 { dolfin_assert(i < _size);
return _x[i]; }
110 const std::size_t _size;