Subsections

   
4.1 OEScalarGrid

class OEScalarGrid

An OEScalarGrid represents a cubic grid with regular intervals in cartesian space.

4.1.1 Constructors

 
OEScalarGrid()
OEScalarGrid(const OEScalarGrid &rhs)
OEScalarGrid(const OEFixedGrid< float > &rhs)
OEScalarGrid(const float minmax[6], float spacing, const char *title="")
OEScalarGrid(const double minmax[6], double spacing, const char *title="")
OEScalarGrid(int xdim, int ydim, int zdim, float midx, float midy, float midz,
             float spacing, std::string title="", float *dataptr=0)
The default constructor will create a one point grid. The copy constructors will copy the entire contents of the rhs.

The constructors which take the minmax argument can be used to create a grid from a minimum bounding box. The size of each length between grid points is determined by the spacing parameter. The title parameter is provided as a convenience for setting the title upon construction. It can later be retrieved with the GetTitle method.

The final constructor allows the grid to be fully specified upon instantiation. The grid data can be copied from the optional parameter dataptr. The pointer should be an array of size xdim*ydim*zdim*sizeof(float).

4.1.2 operator=

 
OEScalarGrid &operator=(const OEScalarGrid &rhs)
OEScalarGrid &operator=(const OEFixedGrid< float > &rhs)
The assignment operators will copy the contents of rhs.

4.1.3 operator()

 
float &operator()(unsigned int ix, unsigned int iy, unsigned int iz)
const float &operator()(unsigned int ix, unsigned int iy,
                        unsigned int iz) const
float &operator()(float x, float y, float z)
const float &operator()(float x, float y, float z) const
Grid data access by specifying the three dimensional grid indices (ix, iy, iz) of the grid point or the cartesian coordinates (x,y,z) to the closest grid point.

4.1.4 operator[]

 
float &operator[](unsigned int el)
const float &operator[](unsigned int el) const
Grid data access by the one dimensional grid point index el.

4.1.5 Clear

 
void Clear()
Reallocates memory for the grid, effectively clearing all the grid values. Calls through to OEBase::Clear.

4.1.6 CreateCopy

 
virtual OEBase *CreateCopy() const
Makes a copy of the grid instance.

4.1.7 ElementToGridIdx

 
bool ElementToGridIdx(unsigned int el, unsigned int &ix, unsigned int &iy,
                      unsigned int &iz) const
The element el is the one dimensional index into the grid points. This function will convert this one dimensional index into the three dimensional indices (ix, iy, iz) for the associated grid point. Returns false if el is outside the array bounds.

4.1.8 ElementToSpatialCoord

 
bool ElementToSpatialCoord(unsigned int el, float &x, float &y, float &z) const
The element el is the one dimensional index into the grid points. This function will convert this one dimensional index into the cartesian coordinates (x,y,z) of the associated grid point. Returns false if el is outside the array bounds.

4.1.9 IsDataType

 
virtual bool IsDataType(const void *type) const
Returns whether type is the same type as this grid.

4.1.10 GetDataType

 
virtual const void *GetDataType() const
Returns the data type of this grid.

4.1.11 GetType

 
unsigned int GetType() const
Returns the data type tag for this grid.

4.1.12 GetDim

 
virtual bool GetDim(unsigned int &xdim, unsigned int &ydim,
                    unsigned int &zdim) const
Outputs the grid dimensions into xdim, ydim, zdim. The grid dimension is how wide the grid is for the associated axis. The current implementation always returns true.

4.1.13 GetMid

 
virtual bool GetMid(float &x, float &y, float &z) const
Outputs the grid midpoint, the center of the grid, into x, y, z. The midpoint defines where the grid is located in cartesian space. Returns false if the midpoint is not completely defined (!IsXMidSet() || !IsYMidSet() || !IsZMidSet()).

4.1.14 GetSize

 
virtual unsigned int GetSize() const
Returns the number of grid points inside this grid.

4.1.15 GetSpacing

 
virtual float GetSpacing() const
Returns the length between grid points.

4.1.16 GetTitle

 
virtual std::string GetTitle() const
Returns the title of this grid. The title defaults to an empty string.

4.1.17 GetX

 
float GetX(unsigned int ix) const
Returns the x-component of the cartesian coordinate for the grid points with the x-index of ix.

4.1.18 GetXDim

 
virtual unsigned int GetXDim() const
Returns how many grid points there are for the x-dimension of this grid.

4.1.19 GetXIdx

 
unsigned int GetXIdx(float x) const
unsigned int GetXIdx(unsigned int el) const
Returns the grid index in the x-dimension for the grid point identified by the argument. The first version takes a float, x, that corresponds to the x-component of the cartesian coordinates. The second version takes a unsigned int el that corresponds to a specific point in the grid.

4.1.20 GetXInc

 
unsigned int GetXInc() const
Returns the increment to be added or subtracted to the grid point index to access the neighbor grid points along the x-axis.

4.1.21 GetXMax

 
float GetXMax() const
Returns the maximum extent of this grid along the x-axis.

4.1.22 GetXMid

 
virtual float GetXMid() const
Returns the center of this grid along the x-axis.

4.1.23 GetXMin

 
float GetXMin() const
Returns the minimum extent of this grid along the x-axis.

4.1.24 GetY

 
float GetY(unsigned int iy) const
Returns the y-component of the cartesian coordinate for the grid points with the y-index of iy.

4.1.25 GetYDim

 
virtual unsigned int GetYDim() const
Returns how many grid points there are for the x-dimension of this grid.

4.1.26 GetYIdx

 
unsigned int GetYIdx(float y) const
unsigned int GetYIdx(unsigned int el) const
Returns the grid index in the y-dimension for the grid point identified by the argument. The first version takes a float, y, that corresponds to the y-component of the cartesian coordinates. The second version takes a unsigned int el that corresponds to a specific point in the grid.

4.1.27 GetYInc

 
unsigned int GetYInc() const
Returns the increment to be added or subtracted to the grid point index to access the neighbor grid points along the y-axis.

4.1.28 GetYMax

 
float GetYMax() const
Returns the maximum extent of this grid along the y-axis.

4.1.29 GetYMid

 
virtual float GetYMid() const
Returns the center of this grid along the y-axis.

4.1.30 GetYMin

 
float GetYMin() const
Returns the minimum extent of this grid along the y-axis.

4.1.31 GetZ

 
float GetZ(unsigned int iz) const
Returns the z-component of the cartesian coordinate for the grid points with the z-index of iz.

4.1.32 GetZDim

 
virtual unsigned int GetZDim() const
Returns how many grid points there are for the z-dimension of this grid.

4.1.33 GetZIdx

 
unsigned int GetZIdx(float z) const
unsigned int GetZIdx(unsigned int el) const
Returns the grid index in the z-dimension for the grid point identified by the argument. The first version takes a float, z, that corresponds to the z-component of the cartesian coordinates. The second version takes a unsigned int el that corresponds to a specific point in the grid.

4.1.34 GetZInc

 
unsigned int GetZInc() const
Returns the increment to be added or subtracted to the grid point index to access the neighbor grid points along the z-axis.

4.1.35 GetZMax

 
float GetZMax() const
Returns the maximum extent of this grid along the z-axis.

4.1.36 GetZMid

 
virtual float GetZMid() const
Returns the center of this grid along the z-axis.

4.1.37 GetZMin

 
float GetZMin() const
Returns the minimum extent of this grid along the z-axis.

4.1.38 GridIdxToElement

 
bool GridIdxToElement(unsigned int ix, unsigned int iy, unsigned int iz,
                      unsigned int &el) const
Converts the three dimensional grid indices (ix, iy, iz) into the one dimensional grid point index el. Returns false if (ix, iy, iz) are outside the grid bounds.

4.1.39 GridIdxToSpatialCoord

 
bool GridIdxToSpatialCoord(unsigned int ix, unsigned int iy, unsigned int iz,
                           float &x, float &y, float &z) const
Converts the three dimensional grid indices (ix, iy, iz) into the cartesian coordinates (x,y,z) of the associated grid point. Returns false if (ix, iy, iz) are outside the grid bounds.

4.1.40 IsDataType

 
virtual bool IsDataType(const void *type) const
Returns whether type is the same as the instance this method is called on.

4.1.41 IsInGrid

 
bool IsInGrid(unsigned int ix, unsigned int iy, unsigned int iz) const
bool IsInGrid(float x, float y, float z) const
Returns whether the given coordinates are located within the grid bounds.

4.1.42 IsSpacingSet

 
virtual bool IsSpacingSet() const
Returns whether the spacing for this grid has been specified.

4.1.43 IsTitleSet

 
virtual bool IsTitleSet() const
Returns whether there is a title associated with this grid.

4.1.44 IsXMidSet

 
virtual bool IsXMidSet() const
Returns whether the midpoint for this grid has been specified for the x-dimension.

4.1.45 IsYMidSet

 
virtual bool IsYMidSet() const
Returns whether the midpoint for this grid has been specified for the y-dimension.

4.1.46 IsZMidSet

 
virtual bool IsZMidSet() const
Returns whether the midpoint for this grid has been specified for the z-dimension.

4.1.47 SetAll

 
bool SetAll(int xdim, int ydim, int zdim, float midx, float midy, float midz,
            float spacing, std::string title, GridType *dataptr)
Convenience method for setting all the properties of this grid at once.

4.1.48 SetDim

 
virtual bool SetDim(unsigned int ixdim, unsigned int iydim, unsigned int izdim)
Sets the number of grid points for each dimension.

4.1.49 SetMid

 
virtual bool SetMid(float x, float y, float z)
Set the mid-point (center) of the grid.

4.1.50 SetSpacing

 
virtual bool SetSpacing(float spacing)
Set the length between grid points.

4.1.51 SetTitle

 
virtual bool SetTitle(const std::string &title)
Set the title associated with this grid.

4.1.52 SetType

 
bool SetType(unsigned int t)
Set the tag associated with this grid.

4.1.53 SetXDim

 
virtual bool SetXDim(unsigned int ixdim)
Sets the number of grid points in the x-dimension.

4.1.54 SetXMid

 
virtual bool SetXMid(float x)
Set the mid-point (center) in the x-dimension.

4.1.55 SetYDim

 
virtual bool SetYDim(unsigned int iydim)
Sets the number of grid points in the y-dimension.

4.1.56 SetYMid

 
virtual bool SetYMid(float y)
Set the mid-point (center) in the y-dimension.

4.1.57 SetZDim

 
virtual bool SetZDim(unsigned int izdim)
Sets the number of grid points in the z-dimension.

4.1.58 SetZMid

 
virtual bool SetZMid(float z)
Set the mid-point (center) in the z-dimension.

4.1.59 SpatialCoordToElement

 
bool SpatialCoordToElement(float x, float y, float z, unsigned int &el) const
Converts the cartesian coordinates (x,y,z) into the grid point index el. Returns false if (x, y, z) are outside the grid bounds.

4.1.60 SpatialCoordToGridIdx

 
bool SpatialCoordToGridIdx(float x, float y, float z, unsigned int &ix,
                           unsigned int &iy, unsigned int &iz) const
Converts the cartesian coordinates (x,y,z) into the three dimensional indices (ix, iy, iz). Returns false if (x, y, z) are outside the grid bounds.