18 #ifndef __DOLFIN_ARRAYVIEW_H 19 #define __DOLFIN_ARRAYVIEW_H 22 #include <dolfin/log/log.h> 54 void set(std::size_t N, T* x)
55 { _size = N; _x = x; }
60 { _size = v.size(); _x = v.data(); }
68 {
return (_size == 0) ? true :
false; }
72 { dolfin_assert(i < _size);
return _x[i]; }
76 { dolfin_assert(i < _size);
return _x[i]; }
88 {
return &_x[_size]; }
92 {
return &_x[_size]; }
~ArrayView()
Destructor.
Definition: ArrayView.h:51
T * data()
Return pointer to data (non-const version)
Definition: ArrayView.h:99
std::size_t size() const
Return size of array.
Definition: ArrayView.h:63
ArrayView(V &v)
Definition: ArrayView.h:45
ArrayView(std::size_t N, T *x)
Construct array from a pointer. Array does not take ownership.
Definition: ArrayView.h:40
const T * end() const
Pointer to beyond end of array (const)
Definition: ArrayView.h:91
ArrayView(const ArrayView &x)
Copy constructor.
Definition: ArrayView.h:48
ArrayView()
Constructor.
Definition: ArrayView.h:37
Definition: ArrayView.h:31
T * begin()
Pointer to start of array.
Definition: ArrayView.h:79
const T * begin() const
Pointer to start of array (const)
Definition: ArrayView.h:83
const T * data() const
Return pointer to data (const version)
Definition: ArrayView.h:95
T * end()
Pointer to beyond end of array.
Definition: ArrayView.h:87
bool empty() const
Test if array view is empty.
Definition: ArrayView.h:67
const T & operator[](std::size_t i) const
Access value of given entry (const version)
Definition: ArrayView.h:71