class OEScalarGrid
An OEScalarGrid represents a cubic grid with regular intervals
in cartesian space.
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)
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).
OEScalarGrid &operator=(const OEScalarGrid &rhs) OEScalarGrid &operator=(const OEFixedGrid< float > &rhs)
rhs.
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
ix, iy, iz) of the grid point or the cartesian
coordinates (x,y,z) to the closest grid point.
float &operator[](unsigned int el) const float &operator[](unsigned int el) const
el.
void Clear()
OEBase::Clear.
virtual OEBase *CreateCopy() const
bool ElementToGridIdx(unsigned int el, unsigned int &ix, unsigned int &iy,
unsigned int &iz) const
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.
bool ElementToSpatialCoord(unsigned int el, float &x, float &y, float &z) const
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.
virtual bool IsDataType(const void *type) const
type is the same type as this grid.
virtual const void *GetDataType() const
unsigned int GetType() const
virtual bool GetDim(unsigned int &xdim, unsigned int &ydim,
unsigned int &zdim) const
xdim, ydim,
zdim. The grid dimension is how wide the grid is for the
associated axis. The current implementation always returns true.
virtual bool GetMid(float &x, float &y, float &z) const
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()).
virtual unsigned int GetSize() const
virtual float GetSpacing() const
virtual std::string GetTitle() const
float GetX(unsigned int ix) const
ix.
virtual unsigned int GetXDim() const
unsigned int GetXIdx(float x) const unsigned int GetXIdx(unsigned int el) const
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.
unsigned int GetXInc() const
float GetXMax() const
virtual float GetXMid() const
float GetXMin() const
float GetY(unsigned int iy) const
iy.
virtual unsigned int GetYDim() const
unsigned int GetYIdx(float y) const unsigned int GetYIdx(unsigned int el) const
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.
unsigned int GetYInc() const
float GetYMax() const
virtual float GetYMid() const
float GetYMin() const
float GetZ(unsigned int iz) const
iz.
virtual unsigned int GetZDim() const
unsigned int GetZIdx(float z) const unsigned int GetZIdx(unsigned int el) const
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.
unsigned int GetZInc() const
float GetZMax() const
virtual float GetZMid() const
float GetZMin() const
bool GridIdxToElement(unsigned int ix, unsigned int iy, unsigned int iz,
unsigned int &el) const
ix, iy,
iz) into the one dimensional grid point index el. Returns
false if (ix, iy, iz) are outside the grid
bounds.
bool GridIdxToSpatialCoord(unsigned int ix, unsigned int iy, unsigned int iz,
float &x, float &y, float &z) const
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.
virtual bool IsDataType(const void *type) const
type is the same as the instance this method is
called on.
bool IsInGrid(unsigned int ix, unsigned int iy, unsigned int iz) const bool IsInGrid(float x, float y, float z) const
virtual bool IsSpacingSet() const
virtual bool IsTitleSet() const
virtual bool IsXMidSet() const
virtual bool IsYMidSet() const
virtual bool IsZMidSet() const
bool SetAll(int xdim, int ydim, int zdim, float midx, float midy, float midz,
float spacing, std::string title, GridType *dataptr)
virtual bool SetDim(unsigned int ixdim, unsigned int iydim, unsigned int izdim)
virtual bool SetMid(float x, float y, float z)
virtual bool SetSpacing(float spacing)
virtual bool SetTitle(const std::string &title)
bool SetType(unsigned int t)
virtual bool SetXDim(unsigned int ixdim)
virtual bool SetXMid(float x)
virtual bool SetYDim(unsigned int iydim)
virtual bool SetYMid(float y)
virtual bool SetZDim(unsigned int izdim)
virtual bool SetZMid(float z)
bool SpatialCoordToElement(float x, float y, float z, unsigned int &el) const
x,y,z) into
the grid point index el. Returns false if (x, y,
z) are outside the grid bounds.
bool SpatialCoordToGridIdx(float x, float y, float z, unsigned int &ix,
unsigned int &iy, unsigned int &iz) const
x,y,z) into
the three dimensional indices (ix, iy,
iz). Returns false if (x, y, z) are
outside the grid bounds.