|
| | Array1D () |
| | Default constructor, which does not allocate any memory.
|
| |
| | Array1D (const int &nx) |
| | Constructor that allocates the memory.
|
| |
| | Array1D (const int &nx, const T &t) |
| | Constructor that allocates and initializes the data to a value t.
|
| |
| Array1D & | operator= (const Array1D &obj) |
| | Assignment operator copies the data structure by value.
|
| |
| | Array1D (const Array1D &obj) |
| | Copy constructor.
|
| |
| | ~Array1D () |
| | Destructor that frees up the memory.
|
| |
| void | Clear () |
| | Function to clear the memory.
|
| |
| int | XSize () const |
| | Returns size in the x-direction.
|
| |
| int | Length () const |
| | Returns length (i.e. size in the x-direction)
|
| |
| void | Resize (const int &nx) |
| | Resizes the array.
|
| |
| void | Resize (const int &nx, const T &t) |
| | Resizes the array and sets ALL entries to the specified value.
|
| |
| void | SetValue (const T &t) |
| | Set all values in the array to the given value.
|
| |
| void | PushBack (const T &t) |
| | Add element to the end of the vector.
|
| |
| T * | GetArrayPointer () |
| | Return a pointer to the first element of the data in the vector so we can use it access the data in array format (e.g. for passing it to a Fortran program).
|
| |
| const T * | GetConstArrayPointer () const |
| | Return a const point to the first element of the data in the vector so we can use it access the data in array format (e.g. for passing it to a Fortran program).
|
| |
| T & | operator() (int ix) |
| |
| const T & | operator() (int ix) const |
| |
| void | insert (Array1D< T > &insarr, int ix) |
| | Insert a given array to the position ix.
|
| |
| void | insert (const T &insval, int ix) |
| | Insert a given value to the position ix.
|
| |
| void | erase (int ix) |
| | Erase the value from the position ix.
|
| |
| void | DumpBinary (FILE *f_out) const |
| | Dump contents of the array to a file in binary format.
|
| |
| void | ReadBinary (FILE *f_in) |
| | Read contents of the array from a file in binary format.
|
| |
| T & | operator[] (int i) |
| |
| vector< int > | shape () |
| |
| void | assign (const int x, const T val) |
| |
| void | DumpBinary (char *filename) |
| | Dump contents of the array to a file in binary format.
|
| |
| void | ReadBinary (char *filename) |
| |
| void | DumpBinary4py (char *filename) |
| |
| void | ReadBinary4py (char *filename, int n) |
| |
| void | setArray (vector< T > inarray) |
| |
| vector< T > | flatten () |
| |
| string | type () |
| |
template<typename T>
class Array1D< T >
Stores data of any type T in a 1D array.
This class also provides a Fortran-like access operator () as well as a function to access the data in the array through a pointer that can be passed to F77 or C routines.
- Author
- Bert Debusschere bjdeb.nosp@m.us@s.nosp@m.andia.nosp@m..gov
- Date
- Apr 2005 - Nov 2007
- Note
- Inspired by Helgi Adalsteinsson's Array class implementation
- Todo
- double check copy constructor