#include <polardata.h>
Inheritance diagram for EMAN::UnevenMatrix:
Public Member Functions | |
UnevenMatrix () | |
virtual | ~UnevenMatrix () |
int | get_xsize (int y) |
get the x dim size for a given y | |
int | get_xmin (int y) |
get the minimal x dim value for a given y | |
int | get_xmax (int y) |
get the maximal x dim value for a given y, note: x1 is one out of the max | |
int | get_size () |
get the total size of the data block | |
Protected Member Functions | |
void | alloc_data () |
allocation memory for data array | |
Protected Attributes | |
float * | data |
store all data in one dimension float array for cache efficiency, we calculate the offset for x, y dimension | |
map< int, Xdim > | desc_data |
describe for each y, the x dimension's size and range | |
int | tot_size |
the total size of the data |
Definition at line 53 of file polardata.h.
|
Definition at line 56 of file polardata.h. References data. 00056 : data(0) { 00057 printf("Welcome to UnevenMatrix\n"); 00058 }
|
|
Definition at line 59 of file polardata.h. References data. 00059 { 00060 if(data) { 00061 delete data; 00062 data = 0; 00063 } 00064 printf("Destructor of UnevenMatrix...\n"); 00065 }
|
|
allocation memory for data array
Definition at line 59 of file polardata.cpp. References data, desc_data, get_xsize(), InvalidValueException, LOGERR, tot_size, and y. 00060 { 00061 if( desc_data.size() == 0 ) { 00062 LOGERR("No data space need to be allocated for UnevenMatrix, check you desc_data..."); 00063 throw InvalidValueException((float)desc_data.size(), "desc_data size == 0"); 00064 } 00065 00066 int size = 0; //total number of float need to be stored in data block 00067 map< int, Xdim >::const_iterator iter; 00068 int y = 0; 00069 for( iter = desc_data.begin(); iter != desc_data.end(); ++iter ) { 00070 y = (*iter).first; 00071 size += get_xsize(y); 00072 } 00073 00074 this->tot_size = size; 00075 try { 00076 this->data = new float[size]; 00077 } 00078 catch( bad_alloc exception ) { 00079 LOGERR("memory allocation for UnevenMatrix failed"); 00080 } 00081 catch(...) { 00082 LOGERR("Unknown error in memory allocation for UnevenMatrix"); 00083 } 00084 }
|
|
get the total size of the data block
Definition at line 96 of file polardata.h. 00096 {
00097 return tot_size;
00098 }
|
|
get the maximal x dim value for a given y, note: x1 is one out of the max
Definition at line 90 of file polardata.h. 00090 { 00091 return desc_data[y].x1 - 1; 00092 }
|
|
get the minimal x dim value for a given y
Definition at line 83 of file polardata.h. 00083 { 00084 return desc_data[y].x0; 00085 }
|
|
get the x dim size for a given y
Definition at line 70 of file polardata.h. References InvalidValueException. Referenced by alloc_data(). 00070 { 00071 int xsize = desc_data[y].x1 - desc_data[y].x0; 00072 if( xsize <= 0 ) { 00073 throw InvalidValueException(xsize, "xsize <= 0"); 00074 } 00075 else { 00076 return xsize; 00077 } 00078 }
|
|
store all data in one dimension float array for cache efficiency, we calculate the offset for x, y dimension
Definition at line 127 of file polardata.h. Referenced by alloc_data(). |
|
describe for each y, the x dimension's size and range
Definition at line 130 of file polardata.h. Referenced by alloc_data(). |
|
the total size of the data
Definition at line 133 of file polardata.h. Referenced by alloc_data(). |