#include <emarray.h>
Collaboration diagram for EMAN::EMArray< T >:

Public Member Functions | |
| EMArray (size_t xsize, size_t ysize=1, size_t zsize=1) | |
| Constructor. | |
| ~EMArray () | |
| Destructor. | |
| void | set_array_offsets (const size_t xoff_=0, const size_t yoff_=0, const size_t zoff_=0) |
| Set the array offsets. | |
| void | set_array_offsets (const vector< int > offsets) |
| Set the array offsets using an offset vector. | |
| vector< int > | get_array_offsets () |
| Get an integer array containing the array offsets. | |
| T & | operator() (const size_t ix, const size_t iy=0, const size_t iz=0) |
| Index into the array using Fortran-style indexing:. | |
| int | get_xsize () const |
| int | get_ysize () const |
| int | get_zsize () const |
Private Member Functions | |
| EMArray (const EMArray &) | |
| EMArray & | operator= (const EMArray &) |
Private Attributes | |
| const size_t | nx |
| const size_t | ny |
| const size_t | nz |
| size_t | size |
| size_t | xoff |
| size_t | yoff |
| size_t | zoff |
| T * | array |
Sometimes you need an array of something.
Data is ordered with the first element increasing the fastest.
Definition at line 53 of file emarray.h.
|
||||||||||||||||||||
|
Constructor.
Definition at line 56 of file emarray.h. 00057 : nx(xsize),ny(ysize),nz(zsize), 00058 xoff(0),yoff(0),zoff(0) { 00059 size = (size_t)nx*ny*nz; 00060 array = new T[size]; 00061 }
|
|
|||||||||
|
Destructor.
Definition at line 63 of file emarray.h. 00063 { delete [] array; }
|
|
||||||||||
|
|
|
|||||||||
|
Get an integer array containing the array offsets.
Definition at line 79 of file emarray.h. 00079 {
00080 vector<int> offsets;
00081 offsets.push_back(xoff);
00082 offsets.push_back(yoff);
00083 offsets.push_back(zoff);
00084 return offsets;
00085 }
|
|
|||||||||
|
Definition at line 101 of file emarray.h. 00101 { return nx; }
|
|
|||||||||
|
Definition at line 102 of file emarray.h. 00102 { return ny; }
|
|
|||||||||
|
Definition at line 103 of file emarray.h. 00103 { return nz; }
|
|
||||||||||||||||||||
|
Index into the array using Fortran-style indexing:. EMArray<double> arr(2,2) // 2-D 2x2 array of doubles arr(0,0) = 1.f; Definition at line 91 of file emarray.h. References OutofRangeException. 00092 {
00093 long pos = (ix-xoff) + ((iy-yoff)+(iz-zoff)*ny)*nx;
00094 #ifdef BOUNDS_CHECKING
00095 if (pos < 0 || pos >= long(size))
00096 throw OutofRangeException(0, size-1, pos, "emarray");
00097 #endif // BOUNDS_CHECKING
00098 return *(array + pos);
00099 }
|
|
||||||||||
|
|
|
||||||||||
|
Set the array offsets using an offset vector. This method exists mainly for restoring the original offsets. Definition at line 75 of file emarray.h. References set_array_offsets(). 00075 {
00076 set_array_offsets(offsets[0],offsets[1],offsets[2]);
00077 }
|
|
||||||||||||||||||||
|
Set the array offsets. By default an EMArray ranges from 0..nx-1,0..ny-1,0..nz-1. Setting the offsets to (1,1,1) changes the ranges to 1..nx,1..ny,1..nz, for example. Definition at line 68 of file emarray.h.
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
1.3.9.1