|
| Array2D () |
| Default constructor, which does not allocate any memory.
|
|
| Array2D (const int &nx, const int &ny) |
| Constructor that allocates the memory.
|
|
| Array2D (const int &nx, const int &ny, const T &t) |
| Constructor that allocates and initializes the data to a constant t.
|
|
| Array2D (const Array2D &obj) |
| Copy constructor.
|
|
| ~Array2D () |
| Destructor that frees up the memory.
|
|
void | Clear () |
| Function to clear the memory.
|
|
int | XSize () const |
| Returns size in the x-direction.
|
|
int | YSize () const |
| Returns size in the y-direction.
|
|
void | Resize (const int &nx, const int &ny) |
| Resizes the array.
|
|
void | Resize (const int &nx, const int &ny, 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.
|
|
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 cont 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, int iy) |
| C-like () operator to access values in the 2D data array.
|
|
const T & | operator() (int ix, int iy) const |
|
void | insertRow (Array1D< T > &insarr, int ix) |
| Insert array insarr as a row into position ix.
|
|
void | insertRow (Array2D< T > &insarr, int ix) |
| Insert a 2d-array insarr into a row position ix.
|
|
void | eraseRow (int ix) |
| Erase the row ix.
|
|
void | insertCol (Array1D< T > &insarr, int iy) |
|
void | insertCol (Array2D< T > &insarr, int iy) |
| Insert a 2d-array insarr into a column position iy.
|
|
void | eraseCol (int iy) |
| Erase the column iy.
|
|
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.
|
|
Array1D< T > & | operator[] (int ix) |
|
vector< int > | shape () |
|
void | getRow (int row) |
|
void | DumpBinary (char *filename) |
|
void | ReadBinary (char *filename) |
|
void | DumpBinary4py (char *filename) |
|
void | ReadBinary4py (char *filename, int n1, int n2) |
|
void | setArray (vector< T > inarray) |
|
void | setnpdblArray (double *inarray, int n1, int n2) |
|
void | getnpdblArray (double *outarray) |
|
void | setnpintArray (long *inarray, int n1, int n2) |
|
void | getnpintArray (long *outarray) |
|
T & | at (int ix, int iy) |
|
vector< T > | flatten () |
|
string | type () |
|
void | assign (const int x, const int y, const T val) |
|
template<typename T>
class Array2D< T >
Stores data of any type T in a 2D 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
- Jan 2005
- Note
- Inspired by Helgi Adalsteinsson's Array class implementation
- Todo
- Define copy constructor