CSol
|
Grid class for one, two or three dimensional data. More...
#include <csol_grid.h>
Public Member Functions | |
Grid () | |
Grid (const Grid &r) | |
~Grid () | |
T & | at (uintptr_t idx) |
Returns value at Grid memory index. More... | |
void | clear () |
Clear data. More... | |
Grid< T > & | composite (Grid< T > &r) |
Composite operator. More... | |
bool | contains_nullValue () |
Null value check. More... | |
int | countUniqueValues () |
Count unique values operator. More... | |
cl::Buffer | createOpenCLBuffer (cl::Context &context) |
OpenCL: Create OpenCL buffer from Grid. More... | |
double | Get_ex () |
Get end coordinate in x direction. More... | |
double | Get_ey () |
Get end coordinate in y direction. More... | |
double | Get_ez () |
Get end coordinate in z direction. More... | |
double | Get_h () |
Get average spacing over all dimesions. More... | |
double | Get_hx () |
Get spacing in x dimension. More... | |
double | Get_hy () |
Get spacing in y dimension. More... | |
double | Get_hz () |
Get spacing in z dimension. More... | |
uintptr_t | get_index (int i, int j) |
Returns a two-dimensional index into Grid memory for location [i, j]. More... | |
long long | Get_n () |
Get total number of cells. More... | |
T | Get_nullValue () |
Gets the null value for the grid. More... | |
int | Get_nx () |
Get number of cells in x dimension. More... | |
int | Get_ny () |
Get number of cells in y dimension. More... | |
int | Get_nz () |
Get number of cells in z dimension. More... | |
double | Get_ox () |
Get start coordinate in x direction. More... | |
double | Get_oy () |
Get start coordinate in y direction. More... | |
double | Get_oz () |
Get start coordinate in z direction. More... | |
bool | has_nullValue () |
Check if null value is set. More... | |
bool | hasEqualDimensionsSpacing (const Grid &r) |
Check for same dimensions and spacing. More... | |
bool | Init (int snx, int sny, int snz, double shx, double shy, double shz, double sox, double soy, double soz) |
Grid initialisation. More... | |
bool | Init (Grid &r) |
Grid initialisation. More... | |
bool | Init1D (int snx, double shx, double sox=0.0) |
One-dimensional grid initialisation. More... | |
bool | Init2D (int snx, int sny, double shx, double shy, double sox=0.0, double soy=0.0) |
Two-dimensional grid initialisation. More... | |
bool | Init3D (int snx, int sny, int snz, double shx, double shy, double shz, double sox=0.0, double soy=0.0, double soz=0.0) |
Three-dimensional grid initialisation. More... | |
double | integral () |
Integration operator. More... | |
double | integralHeaviside () |
Heaviside integration operator. More... | |
double | integralPerimeter () |
Perimeter integration operator. More... | |
bool | is_1D () const |
Check if Grid is one-dimensional. More... | |
bool | is_2D () const |
Check if Grid is two-dimensional. More... | |
bool | is_3D () const |
Check if Grid is three-dimensional. More... | |
bool | isInitialised () |
Check for initialisation. More... | |
T | max () |
Maximum operator. More... | |
Grid< T > & | max (const Grid< T > &r) |
Maximum operator. More... | |
double | mean () |
Mean operator. More... | |
T | min () |
Minimum operator. More... | |
Grid< T > & | min (const Grid< T > &r) |
Minimum operator. More... | |
void | negate () |
Negation operator. More... | |
bool | operator!= (const Grid< T > &r) |
Checks whether grids have same size, spacing and boundary conditions. More... | |
T & | operator() (int i) |
Returns value from one-dimensional Grid. More... | |
T & | operator() (int i, int j) |
Returns value from two-dimensional Grid. More... | |
T & | operator() (int i, int j, int k) |
Returns value from three-dimensional Grid. More... | |
Grid< T > & | operator*= (Grid< T > &r) |
Multiplication operator. More... | |
Grid< T > & | operator*= (const REAL r) |
Addition operator with constant. More... | |
Grid< T > & | operator+= (Grid< T > &r) |
Addition operator. More... | |
Grid< T > & | operator+= (const REAL r) |
Addition operator with constant. More... | |
Grid< T > & | operator-= (Grid< T > &r) |
Subtraction operator. More... | |
Grid< T > & | operator-= (const REAL r) |
Addition operator with constant. More... | |
Grid< T > & | operator/= (Grid< T > &r) |
Division operator. More... | |
Grid< T > & | operator/= (const REAL r) |
Addition operator with constant. More... | |
Grid< T > & | operator= (const T r) |
Set grid to constant value. More... | |
Grid< T > & | operator= (const Grid< T > &r) |
Copy grid. More... | |
T * | pointer () |
Handle to Grid memory pointer. More... | |
bool | Read (QDataStream &dataStream, int &frame, double &time, QString &errMsg, bool skipRead=false) |
Read Grid from binary filestream. More... | |
void | readFrom2DBufferRegion (cl::CommandQueue &queue, cl::Buffer &buffer, unsigned int bRowLength, unsigned int bOrigin_x=0, unsigned int bOrigin_y=0) |
OpenCL: Reads an OpenCL buffer to a two-dimensional Grid. More... | |
void | readFrom3DBufferRegion (cl::CommandQueue &queue, const cl::Buffer &buffer, unsigned int bLength_x, unsigned int bLength_y, unsigned int bOrigin_x=0, unsigned int bOrigin_y=0, unsigned int bOrigin_z=0) |
OpenCL: Reads an OpenCL buffer to a three-dimensional Grid. More... | |
void | readFromBuffer (cl::CommandQueue &queue, const cl::Buffer &buffer) |
OpenCL: Reads an OpenCL buffer into Grid. More... | |
void | replace_nullValue (T r) |
Null value replacement. More... | |
void | Reset () |
Reset Grid to zero value. More... | |
void | Reset_nullValue () |
Resets the null value for the grid. More... | |
double | rms () |
Root mean square operator. More... | |
bool | sample_2D_Bicubic (Grid< T > &s, T fillValue) |
Bicubic sample operator. More... | |
template<typename S > | |
bool | sample_2D_Bicubic (DataExecution::ObjectArray &arr, T fillValue) |
Bicubic sample operator for an array of Grids. More... | |
bool | sample_2D_Bilinear (Grid< T > &s, T fillValue) |
Bilinear sample operator. More... | |
template<typename S > | |
bool | sample_2D_Bilinear (DataExecution::ObjectArray &arr, T fillValue) |
Bilinear sample operator for an array of Grids. More... | |
bool | sample_2D_Nearest (Grid< T > &s, T fillValue) |
Nearest-neighbour sample operator. More... | |
template<typename S > | |
bool | sample_2D_Nearest (DataExecution::ObjectArray &arr, T fillValue) |
Nearest-neighbour sample operator for an array of Grids. More... | |
void | Set_interpolationHint (int interpolationHint_) |
Interpolation hint. More... | |
void | Set_nullValue (T null_) |
Sets the null value for the grid. More... | |
void | Set_ox (double sox) |
Set origin in x direction. More... | |
void | Set_oy (double soy) |
Set origin in y direction. More... | |
void | Set_oz (double soz) |
Set origin in z direction. More... | |
double | stdev () |
Stdev operator. More... | |
T | sum () |
Sum operator. More... | |
Grid< T > & | transform2d (Grid2dTransform &t) |
Apply two-dimensional transform. More... | |
bool | valueAtBicubic (double wx, double wy, T &v) |
Returns bicubic interpolated value from two-dimensional grid at position in world coordinates. More... | |
bool | valueAtBilinear (double wx, T &v) |
Returns bilinear interpolated value from one-dimensional grid at position in world coordinates. More... | |
bool | valueAtBilinear (double wx, double wy, T &v) |
Returns bilinear interpolated value from two-dimensional grid at position in world coordinates. More... | |
bool | valueAtBilinear (double wx, double wy, double wz, T &v) |
Returns bilinear interpolated value from three-dimensional grid at position in world coordinates. More... | |
bool | valueAtNearest (double wx, T &v) |
Returns nearest-neighbour value from one-dimensional grid at position in world coordinates. More... | |
bool | valueAtNearest (double wx, double wy, T &v) |
Returns nearest-neighbour value from two-dimensional grid at position in world coordinates. More... | |
bool | valueAtNearest (double wx, double wy, double wz, T &v) |
Returns nearest-neighbour value from three-dimensional grid at position in world coordinates. More... | |
double | variance () |
Variance operator. More... | |
bool | Write (QDataStream &dataStream, int frame, double time) |
Write Grid to binary filestream. More... | |
void | writeTo2DBufferRegion (cl::CommandQueue &queue, cl::Buffer &buffer, unsigned int bRowLength, unsigned int bOrigin_x=0, unsigned int bOrigin_y=0) |
OpenCL: Writes a two-dimensional Grid to a region of an OpenCL buffer. More... | |
void | writeTo3DBufferRegion (cl::CommandQueue &queue, cl::Buffer &buffer, unsigned int bLength_x, unsigned int bLength_y, unsigned int bOrigin_x=0, unsigned int bOrigin_y=0, unsigned int bOrigin_z=0) |
OpenCL: Writes a three-dimensional Grid to a region of an OpenCL buffer. More... | |
void | writeToBuffer (cl::CommandQueue &queue, cl::Buffer &buffer) |
OpenCL: Writes Grid to an OpenCL buffer. More... | |
Protected Attributes | |
double | ex |
End coordinate in x dimension. More... | |
double | ey |
End coordinate in y dimension. More... | |
double | ez |
End coordinate in z dimension. More... | |
double | h |
Average spacing in each dimension. More... | |
double | hx |
Spacing in x dimension. More... | |
double | hy |
Spacing in y dimension. More... | |
double | hz |
Spacing in z dimension. More... | |
int | interpolationHint |
Hint whether to use fastest or best algorithm when interpolating values. More... | |
long long | n |
Total number of grid cells. More... | |
T | nullValue |
Null value used to mark non-data points. More... | |
int | nx |
Number of cells in x dimension. More... | |
int | ny |
Number of cells in y dimension. More... | |
int | nz |
Number of cells in z dimension. More... | |
double | ox |
Start coordinate in x dimension. More... | |
double | oy |
Start coordinate in y dimension. More... | |
double | oz |
Start coordinate in z dimension. More... | |
T * | v |
Pointer to data values. More... | |
T | zeroValue |
Zero value used to reset grid. More... | |
This is the base data class for CSol Cartesian grid-based operations The grid holds a handle to a memory array as well as dimensions, cell sizes and an offset value from the origin (0, 0, 0) grid cell. A separate boundary condition is stored for each grid boundary. Grids also store a zero value and an optional null value. The existance of a null value is determined by null being different to the zero value for the grid. This null value is usually set to the negative maximum representable range, e.g for REAL grids it is -FLT_MAX. Null values, if they exist, are propagated in arithmetic grid operations.
|
inline |
|
inline |
|
inline |
idx | memory index. |
|
inline |
|
inline |
This scans the grid for any null values.
|
inline |
|
inline |
context | the OpenCL context to use. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
i | x cell index. |
j | y cell index. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
The existance of a null value is determined by null being different to the zero value for the grid.
|
inline |
|
inline |
Initialises Grid, creating memory buffer and internal grid variables.
snx | the number of cells in the x dimension. |
sny | the number of cells in the y dimension. |
snz | the number of cells in the z dimension. |
shx | the spacing in the x direction. |
shy | the spacing in the y direction. |
shz | the spacing in the z direction. |
sox | the origin in the x direction. |
soy | the origin in the y direction. |
soz | the origin in the z direction. |
|
inline |
|
inline |
Initialises Grid, creating memory buffer and internal grid variables.
snx | the number of cells in the x dimension. |
shx | the spacing in the x direction. |
sox | the origin in the x direction. |
|
inline |
Initialises Grid, creating memory buffer and internal grid variables.
snx | the number of cells in the x dimension. |
sny | the number of cells in the y dimension. |
shx | the spacing in the x direction. |
shy | the spacing in the y direction. |
sox | the origin in the x direction. |
soy | the origin in the y direction. |
|
inline |
Initialises Grid, creating memory buffer and internal grid variables.
snx | the number of cells in the x dimension. |
sny | the number of cells in the y dimension. |
snz | the number of cells in the z dimension. |
shx | the spacing in the x direction. |
shy | the spacing in the y direction. |
shz | the spacing in the z direction. |
sox | the origin in the x direction. |
soy | the origin in the y direction. |
soz | the origin in the z direction. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Replaces each Grid cell value with -Grid cell value.
|
inline |
|
inline |
i | x cell index. |
|
inline |
i | x cell index. |
j | y cell index. |
|
inline |
i | x cell index. |
j | y cell index. |
k | z cell index. |
|
inline |
Subtracts the value r from each Grid cell.
r | value. |
|
inline |
r | value. |
|
inline |
|
inline |
dataStream | stream to read binary data from. |
frame | optional frame number. |
time | optional frame time value. |
errMsg | error message on unsuccessfully read. |
|
inline |
Reads an OpenCL buffer to the Grid to with an optional offset into the OpenCL buffer. The row length (x-dimension) of the OpenCL buffer must be passed as an argument.
queue | the OpenCL queue to use. |
buffer | the OpenCL buffer to read from. |
bRowLength | the OpenCL buffer row length. |
bOrigin_x | the x starting position to copy from within the OpenCL buffer (default 0). |
bOrigin_y | the y starting position to copy from within the OpenCL buffer (default 0). |
|
inline |
Reads an OpenCL buffer to the Grid to with an optional offset into the OpenCL buffer. The row length (x-dimension) of the OpenCL buffer must be passed as an argument.
queue | the OpenCL queue to use. |
buffer | the OpenCL buffer to read from. |
bLength_x | the OpenCL buffer x length. |
bLength_y | the OpenCL buffer y length. |
bOrigin_x | the x starting position to copy from within the OpenCL buffer (default 0). |
bOrigin_y | the y starting position to copy from within the OpenCL buffer (default 0). |
bOrigin_z | the z starting position to copy from within the OpenCL buffer (default 0). |
|
inline |
queue | the OpenCL queue to use. |
buffer | the OpenCL buffer to read from. |
|
inline |
This scans the grid for any null values, replacing them with a given value.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
This can be set to InterpolationHint::Fastest (use bilinear) or InterpolationHint::Best (use bicubic, if available).
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
t | two-dimensional trasform. |
|
inline |
[in] | wx | x-position in world coordinates. |
[in] | wy | y-position in world coordinates. |
[out] | v | value at position, if position is valid (v is unchanged otherwise). |
|
inline |
[in] | wx | x-position in world coordinates. |
[out] | v | value at position, if position is valid (v is unchanged otherwise). |
|
inline |
[in] | wx | x-position in world coordinates. |
[in] | wy | y-position in world coordinates. |
[out] | v | value at position, if position is valid (v is unchanged otherwise). |
|
inline |
[in] | wx | x-position in world coordinates. |
[in] | wy | y-position in world coordinates. |
[in] | wz | z-position in world coordinates. |
[out] | v | value at position, if position is valid (v is unchanged otherwise). |
|
inline |
[in] | wx | x-position in world coordinates. |
[out] | v | value at position, if position is valid (v is unchanged otherwise). |
|
inline |
[in] | wx | x-position in world coordinates. |
[in] | wy | y-position in world coordinates. |
[out] | v | value at position, if position is valid (v is unchanged otherwise). |
|
inline |
[in] | wx | x-position in world coordinates. |
[in] | wy | y-position in world coordinates. |
[in] | wz | z-position in world coordinates. |
[out] | v | value at position, if position is valid (v is unchanged otherwise). |
|
inline |
|
inline |
dataStream | stream to write binary data to. |
frame | optional frame number. |
time | optional frame time value. |
|
inline |
Writes the Grid to an OpenCL buffer with an optional offset into the OpenCL buffer. The row length (x-dimension) of the OpenCL buffer must be passed as an argument.
queue | the OpenCL queue to use. |
buffer | the OpenCL buffer to write to. |
bRowLength | the OpenCL buffer row length. |
bOrigin_x | the x starting position to copy to within the OpenCL buffer (default 0). |
bOrigin_y | the y starting position to copy to within the OpenCL buffer (default 0). |
|
inline |
Writes the Grid to an OpenCL buffer with an optional offset into the OpenCL buffer. The row length (x-dimension) of the OpenCL buffer must be passed as an argument.
queue | the OpenCL queue to use. |
buffer | the OpenCL buffer to write to. |
bLength_x | the OpenCL buffer x length. |
bLength_y | the OpenCL buffer y length. |
bOrigin_x | the x starting position to copy to within the OpenCL buffer (default 0). |
bOrigin_y | the y starting position to copy to within the OpenCL buffer (default 0). |
bOrigin_z | the z starting position to copy from within the OpenCL buffer (default 0). |
|
inline |
queue | the OpenCL queue to use. |
buffer | the OpenCL buffer to write to. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |