Array.h

Note

The documentation on this page was automatically extracted from the DOLFIN C++ code and may need to be edited or expanded.

class Array

This class provides a simple wrapper for a pointer to an array. A purpose of this class is to enable the simple and safe exchange of data between C++ and Python.

explicit Array(std::size_t N)

Create array of size N. Array has ownership.

Array(std::size_t N, T *x)

Construct array from a pointer. Array does not take ownership.

std::string str(bool verbose) const

Return informal string representation (pretty-print). Note that the Array class is not a subclass of Variable (for efficiency) which means that one needs to call str() directly instead of using the info() function on Array objects.

std::size_t size() const

Return size of array

const T &operator[](std::size_t i) const

Access value of given entry (const version)

T &operator[](std::size_t i)

Access value of given entry (non-const version)

const T *data() const

Return pointer to data (const version)

T *data()

Return pointer to data (non-const version)

Array(const Array& other) /* leave body undefined */

Disable copy construction, to avoid unanticipated sharing or copying of data. This means that an Array must always be passed as reference, or as a (possibly shared) pointer.