.. oe:namespace:: OESystem



.. meta::
   :keywords: OEGridBase, GridBase


.. _OESystem_OEGridBase:

.. oe:class:: OEGridBase

   .. oe:api::


      class OEGridBase : public OEGridAbstractBase

   This class represents `OEGridBase`.

   The following methods are publicly inherited from :ref:`OEGridAbstractBase <OESystem_OEGridAbstractBase>`:

   ================================================================== ================================================================== ===================================================================
   :oe:meth:`Clear<OESystem::OEGridAbstractBase::Clear>`              :oe:meth:`GetTitle<OESystem::OEGridAbstractBase::GetTitle>`        :oe:meth:`GetZMid<OESystem::OEGridAbstractBase::GetZMid>`          
   :oe:meth:`GetDataType<OESystem::OEGridAbstractBase::GetDataType>`  :oe:meth:`GetXDim<OESystem::OEGridAbstractBase::GetXDim>`          :oe:meth:`IsDataType<OESystem::OEGridAbstractBase::IsDataType>`    
   :oe:meth:`GetDim<OESystem::OEGridAbstractBase::GetDim>`            :oe:meth:`GetXMid<OESystem::OEGridAbstractBase::GetXMid>`          :oe:meth:`IsSpacingSet<OESystem::OEGridAbstractBase::IsSpacingSet>`
   :oe:meth:`GetMid<OESystem::OEGridAbstractBase::GetMid>`            :oe:meth:`GetYDim<OESystem::OEGridAbstractBase::GetYDim>`          :oe:meth:`SetTitle<OESystem::OEGridAbstractBase::SetTitle>`        
   :oe:meth:`GetSize<OESystem::OEGridAbstractBase::GetSize>`          :oe:meth:`GetYMid<OESystem::OEGridAbstractBase::GetYMid>`                                                                             
   :oe:meth:`GetSpacing<OESystem::OEGridAbstractBase::GetSpacing>`    :oe:meth:`GetZDim<OESystem::OEGridAbstractBase::GetZDim>`                                                                             
   ================================================================== ================================================================== ===================================================================

   The following methods are publicly inherited from :ref:`OEBase <OESystem_OEBase>`:

   ======================================================== ========================================================= =========================================================
   :oe:meth:`operator=<OESystem::OEBase::operator=>`        :oe:meth:`GetData<OESystem::OEBase::GetData>`             :oe:meth:`IsDataType<OESystem::OEBase::IsDataType>`      
   :oe:meth:`operator+=<OESystem::OEBase::operator+=>`      :oe:meth:`GetDataIter<OESystem::OEBase::GetDataIter>`     :oe:meth:`SetBaseData<OESystem::OEBase::SetBaseData>`    
   :oe:meth:`AddBaseData<OESystem::OEBase::AddBaseData>`    :oe:meth:`GetDataType<OESystem::OEBase::GetDataType>`     :oe:meth:`SetBoolData<OESystem::OEBase::SetBoolData>`    
   :oe:meth:`AddData<OESystem::OEBase::AddData>`            :oe:meth:`GetDoubleData<OESystem::OEBase::GetDoubleData>` :oe:meth:`SetData<OESystem::OEBase::SetData>`            
   :oe:meth:`Clear<OESystem::OEBase::Clear>`                :oe:meth:`GetFloatData<OESystem::OEBase::GetFloatData>`   :oe:meth:`SetDoubleData<OESystem::OEBase::SetDoubleData>`
   :oe:meth:`CreateCopy<OESystem::OEBase::CreateCopy>`      :oe:meth:`GetIntData<OESystem::OEBase::GetIntData>`       :oe:meth:`SetFloatData<OESystem::OEBase::SetFloatData>`  
   :oe:meth:`DeleteData<OESystem::OEBase::DeleteData>`      :oe:meth:`GetStringData<OESystem::OEBase::GetStringData>` :oe:meth:`SetIntData<OESystem::OEBase::SetIntData>`      
   :oe:meth:`GetBoolData<OESystem::OEBase::GetBoolData>`    :oe:meth:`HasData<OESystem::OEBase::HasData>`             :oe:meth:`SetStringData<OESystem::OEBase::SetStringData>`
   ======================================================== ========================================================= =========================================================


   The following classes derive from this class:
    * :ref:`OEFixedGrid <OESystem_OEFixedGrid>`
    * :ref:`OEFixedMultiGrid <OESystem_OEFixedMultiGrid>`
    * :ref:`OEGrid <OESystem_OEGrid>`
    * :ref:`OEMultiGrid <OESystem_OEMultiGrid>`
    * :ref:`OEScalarGrid <OESystem_OEScalarGrid>`

   .. oe:method:: operator=
      :language: c++

      .. oe:api::

         OEGridBase & operator=(const OEGridBase & rhs)

      Assignment operator.

   

   .. oe:method:: Clear

      .. oe:language:: c++ java csharp

         .. oe:api::

            void Clear()

      .. oe:language:: python

         .. oe:api:: python

            Clear() -> None

      Reallocates memory for the grid, effectively clearing all the grid values. 
      Calls through to :oe:meth:`OESystem::OEBase::Clear`.

   .. oe:method:: CreateCopy

      .. oe:language:: c++ java csharp

         .. oe:api::

            OEBase* CreateCopy() const

      .. oe:language:: python

         .. oe:api:: python

            CreateCopy() -> OEBase

      Makes a copy of the grid instance.

   .. oe:method:: ElementToGridIdx

      .. oe:language:: c++ java csharp

         .. oe:api::

            bool ElementToGridIdx(unsigned int el, unsigned int& ix,
                                  unsigned int& iy, unsigned int& iz) const

      .. oe:language:: python

         .. oe:api:: python

            ElementToGridIdx(el: int) -> (ix: int, iy: int, iz: int)

      The element 'el' is the one dimensional index into the grid points. 
      This function converts 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.

   .. oe:method:: ElementToSpatialCoord

      .. oe:language:: c++ java csharp

         .. oe:api::

            bool ElementToSpatialCoord(unsigned int el, float& x, float& y,
                                       float& z) const

      .. oe:language:: python

         .. oe:api:: python

            ElementToSpatialCoord(el: int) -> (x: float, y: float, z: float)

      The element 'el' is the one dimensional index into the grid points. 
      This function converts 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.

   .. oe:method:: GetDataType

      .. oe:language:: c++ java csharp

         .. oe:api::

            const void* GetDataType() const

      .. oe:language:: python

         .. oe:api:: python

            GetDataType() -> void

   .. oe:method:: GetDim

      .. oe:api::

         bool GetDim(unsigned int &xdim, unsigned int &ydim, unsigned int &zdim) const

      Retrieves the grid dimensions (*i.e.* the wideness of the grid for a specific axis) 
      into 'xdim', 'ydim', 'zdim' arguments. 

   .. oe:method:: GetMid

      .. oe:api::

         bool GetMid(float &x, float &y, float &z) const

      Retrieves the grid midpoint (*i.e.* the center of the grid) into 'midx', 'midy' and 
      'midz' arguments. The midpoint defines where the grid is located in Cartesian space. 
      Returns ``false`` if the midpoint is not completely defined 
      (! :oe:meth:`IsXMidSet()<OESystem::OEGridBase::IsXMidSet>` || 
      ! :oe:meth:`IsYMidSet()<OESystem::OEGridBase::IsYMidSet>` || 
      ! :oe:meth:`IsZMidSet()<OESystem::OEGridBase::IsZMidSet>`)

   .. oe:method:: GetSize

      .. oe:language:: c++ java csharp

         .. oe:api::

            unsigned int GetSize() const

      .. oe:language:: python

         .. oe:api:: python

            GetSize() -> int

      Returns the number of grid points inside this grid.

   .. oe:method:: GetSpacing

      .. oe:language:: c++ java csharp

         .. oe:api::

            float GetSpacing() const

      .. oe:language:: python

         .. oe:api:: python

            GetSpacing() -> float

      Returns the length between grid points.

   .. oe:method:: GetTitle

      .. oe:language:: c++ java csharp

         .. oe:api::

            std::string GetTitle() const

      .. oe:language:: python

         .. oe:api:: python

            GetTitle() -> str

      Returns the title of this grid. The title defaults to an empty string.

   .. oe:method:: GetX

      .. oe:language:: c++ java csharp

         .. oe:api::

            float GetX(unsigned int ix) const

      .. oe:language:: python

         .. oe:api:: python

            GetX(ix: int) -> float

      Returns the x-component of the Cartesian coordinate for the grid points with the x-index of 'ix'.

   .. oe:method:: GetXDim

      .. oe:language:: c++ java csharp

         .. oe:api::

            unsigned int GetXDim() const

      .. oe:language:: python

         .. oe:api:: python

            GetXDim() -> int

      Returns how many grid points there are for the x-dimension of this grid.

   .. oe:method:: GetXIdx

      .. oe:language:: c++ java csharp

         .. oe:api::

            unsigned int GetXIdx(float x) const

      .. oe:language:: python

         .. oe:api:: python

            GetXIdx(x: float) -> int

      Returns the grid index in the x-dimension for the grid point identified 
      by 'x', that corresponds to the x-component of the Cartesian coordinates. 

      .. oe:language:: c++ java csharp

         .. oe:api::

            unsigned int GetXIdx(unsigned int el) const

      .. oe:language:: python

         .. oe:api:: python

            GetXIdx(el: int) -> int

      Returns the grid index in the x-dimension for the grid point identified 
      by 'el', that corresponds to a specific point in the grid.

   .. oe:method:: GetXInc

      .. oe:language:: c++ java csharp

         .. oe:api::

            unsigned int GetXInc() const

      .. oe:language:: python

         .. oe:api:: python

            GetXInc() -> int

      Returns the increment to be added or subtracted to the grid point index to 
      access the neighbor grid points along the x-axis.

   .. oe:method:: GetXMax

      .. oe:language:: c++ java csharp

         .. oe:api::

            float GetXMax() const

      .. oe:language:: python

         .. oe:api:: python

            GetXMax() -> float

      Returns the maximum extent of this grid along the x-axis.

   .. oe:method:: GetXMid

      .. oe:language:: c++ java csharp

         .. oe:api::

            float GetXMid() const

      .. oe:language:: python

         .. oe:api:: python

            GetXMid() -> float

      Returns the center of this grid along the x-axis.

   .. oe:method:: GetXMin

      .. oe:language:: c++ java csharp

         .. oe:api::

            float GetXMin() const

      .. oe:language:: python

         .. oe:api:: python

            GetXMin() -> float

      Returns the minimum extent of this grid along the x-axis.

   .. oe:method:: GetY

      .. oe:language:: c++ java csharp

         .. oe:api::

            float GetY(unsigned int iy) const

      .. oe:language:: python

         .. oe:api:: python

            GetY(iy: int) -> float

      Returns the y-component of the Cartesian coordinate for the grid points with the y-index of 'iy'.

   .. oe:method:: GetYDim

      .. oe:language:: c++ java csharp

         .. oe:api::

            unsigned int GetYDim() const

      .. oe:language:: python

         .. oe:api:: python

            GetYDim() -> int

      Returns how many grid points there are for the y-dimension of this grid.

   .. oe:method:: GetYIdx

      .. oe:language:: c++ java csharp

         .. oe:api::

            unsigned int GetYIdx(float y) const

      .. oe:language:: python

         .. oe:api:: python

            GetYIdx(y: float) -> int

      Returns the grid index in the y-dimension for the grid point identified 
      by 'y', that corresponds to the y-component of the Cartesian coordinates. 

      .. oe:language:: c++ java csharp

         .. oe:api::

            unsigned int GetYIdx(unsigned int el) const

      .. oe:language:: python

         .. oe:api:: python

            GetYIdx(el: int) -> int

      Returns the grid index in the y-dimension for the grid point identified 
      by 'el', that corresponds to a specific point in the grid.
     
   .. oe:method:: GetYInc

      .. oe:language:: c++ java csharp

         .. oe:api::

            unsigned int GetYInc() const

      .. oe:language:: python

         .. oe:api:: python

            GetYInc() -> int

      Returns the increment to be added or subtracted to the grid point index to 
      access the neighbor grid points along the y-axis.

   .. oe:method:: GetYMax

      .. oe:language:: c++ java csharp

         .. oe:api::

            float GetYMax() const

      .. oe:language:: python

         .. oe:api:: python

            GetYMax() -> float

      Returns the maximum extent of this grid along the y-axis.


   .. oe:method:: GetYMid

      .. oe:language:: c++ java csharp

         .. oe:api::

            float GetYMid() const

      .. oe:language:: python

         .. oe:api:: python

            GetYMid() -> float

      Returns the center of this grid along the y-axis.

   .. oe:method:: GetYMin

      .. oe:language:: c++ java csharp

         .. oe:api::

            float GetYMin() const

      .. oe:language:: python

         .. oe:api:: python

            GetYMin() -> float

      Returns the minimum extent of this grid along the y-axis.

   .. oe:method:: GetZ

      .. oe:language:: c++ java csharp

         .. oe:api::

            float GetZ(unsigned int iz) const

      .. oe:language:: python

         .. oe:api:: python

            GetZ(iz: int) -> float

      Returns the z-component of the Cartesian coordinate for the grid points with the z-index of 'iz'.

   .. oe:method:: GetZDim

      .. oe:language:: c++ java csharp

         .. oe:api::

            unsigned int GetZDim() const

      .. oe:language:: python

         .. oe:api:: python

            GetZDim() -> int

      Returns how many grid points there are for the z-dimension of this grid.

   .. oe:method:: GetZIdx

      .. oe:language:: c++ java csharp

         .. oe:api::

            unsigned int GetZIdx(float z) const

      .. oe:language:: python

         .. oe:api:: python

            GetZIdx(z: float) -> int

      Returns the grid index in the z-dimension for the grid point identified 
      by 'z', that corresponds to the z-component of the Cartesian coordinates. 

      .. oe:language:: c++ java csharp

         .. oe:api::

            unsigned int GetZIdx(unsigned int el) const

      .. oe:language:: python

         .. oe:api:: python

            GetZIdx(el: int) -> int

      Returns the grid index in the z-dimension for the grid point identified 
      by 'el', that corresponds to a specific point in the grid.

   .. oe:method:: GetZInc

      .. oe:language:: c++ java csharp

         .. oe:api::

            unsigned int GetZInc() const

      .. oe:language:: python

         .. oe:api:: python

            GetZInc() -> int

      Returns the increment to be added or subtracted to the grid point index to 
      access the neighbor grid points along the z-axis.

   .. oe:method:: GetZMax

      .. oe:language:: c++ java csharp

         .. oe:api::

            float GetZMax() const

      .. oe:language:: python

         .. oe:api:: python

            GetZMax() -> float

      Returns the maximum extent of this grid along the z-axis.

   .. oe:method:: GetZMid

      .. oe:language:: c++ java csharp

         .. oe:api::

            float GetZMid() const

      .. oe:language:: python

         .. oe:api:: python

            GetZMid() -> float

      Returns the center of this grid along the z-axis.

   .. oe:method:: GetZMin

      .. oe:language:: c++ java csharp

         .. oe:api::

            float GetZMin() const

      .. oe:language:: python

         .. oe:api:: python

            GetZMin() -> float

      Returns the minimum extent of this grid along the z-axis.

   .. oe:method:: GridIdxToElement

      .. oe:language:: c++ java csharp

         .. oe:api::

            bool GridIdxToElement(unsigned int ix, unsigned int iy,
                                  unsigned int iz, unsigned int& el) const

      .. oe:language:: python

         .. oe:api:: python

            GridIdxToElement(ix: int, iy: int, iz: int) -> int


      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.

      .. seealso::
    
         * :oe:meth:`OESystem::OEGridBase::ElementToGridIdx`
  
   .. oe:method:: GridIdxToSpatialCoord

      .. oe:language:: c++ java csharp

         .. oe:api::

            bool GridIdxToSpatialCoord(unsigned int ix, unsigned int iy,
                                       unsigned int iz, float& x, float& y,
                                       float& z) const

      .. oe:language:: python

         .. oe:api:: python

            GridIdxToSpatialCoord(ix: int, iy: int, iz: int) -> (x: float, y: float, z: float)

      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.

      .. seealso::
    
         * :oe:meth:`OESystem::OEGridBase::SpatialCoordToGridIdx`


   .. oe:method:: IsDataType

      .. oe:language:: c++ java csharp

         .. oe:api::

            bool IsDataType(const void* type) const

      .. oe:language:: python

         .. oe:api:: python

            IsDataType(type: void) -> bool

      Returns whether type is the same as the instance this method is called on.

   .. oe:method:: IsInGrid

      .. oe:language:: c++ java csharp

         .. oe:api::

            bool IsInGrid(float x, float y, float z) const
            bool IsInGrid(unsigned int ix, unsigned int iy, unsigned int iz) const

      .. oe:language:: python

         .. oe:api:: python

            IsInGrid(x: float, y: float, z: float) -> bool
            IsInGrid(ix: int, iy: int, iz: int) -> bool

      Returns whether the given coordinates are located within the grid bounds.

   .. oe:method:: IsSpacingSet

      .. oe:language:: c++ java csharp

         .. oe:api::

            bool IsSpacingSet() const

      .. oe:language:: python

         .. oe:api:: python

            IsSpacingSet() -> bool

      Returns whether the spacing for this grid has been specified.

   .. oe:method:: IsTitleSet

      .. oe:language:: c++ java csharp

         .. oe:api::

            bool IsTitleSet() const

      .. oe:language:: python

         .. oe:api:: python

            IsTitleSet() -> bool

      Returns whether there is a title associated with this grid.

   .. oe:method:: IsXMidSet

      .. oe:language:: c++ java csharp

         .. oe:api::

            bool IsXMidSet() const

      .. oe:language:: python

         .. oe:api:: python

            IsXMidSet() -> bool

      Returns whether the midpoint for this grid has been specified for the x-dimension.

   .. oe:method:: IsYMidSet

      .. oe:language:: c++ java csharp

         .. oe:api::

            bool IsYMidSet() const

      .. oe:language:: python

         .. oe:api:: python

            IsYMidSet() -> bool

      Returns whether the midpoint for this grid has been specified for the y-dimension.

   .. oe:method:: IsZMidSet

      .. oe:language:: c++ java csharp

         .. oe:api::

            bool IsZMidSet() const

      .. oe:language:: python

         .. oe:api:: python

            IsZMidSet() -> bool

      Returns whether the midpoint for this grid has been specified for the z-dimension.

   .. oe:method:: SetTitle

      .. oe:language:: c++ java csharp

         .. oe:api::

            bool SetTitle(const std::string& title)

      .. oe:language:: python

         .. oe:api:: python

            SetTitle(title: str) -> bool

      Sets the title associated with this grid.

   .. oe:method:: SpatialCoordToElement

      .. oe:language:: c++ java csharp

         .. oe:api::

            bool SpatialCoordToElement(float x, float y, float z,
                                       unsigned int& el) const

      .. oe:language:: python

         .. oe:api:: python

            SpatialCoordToElement(x: float, y: float, z: float) -> int

      Converts the Cartesian coordinates (x,y,z) into the grid point index 'el'. 
      Returns ``false`` if (x,y,z) are outside the grid bounds.

      .. seealso::
 
         * :oe:meth:`OESystem::OEGridBase::ElementToSpatialCoord`
         

   .. oe:method:: SpatialCoordToGridIdx

      .. oe:language:: c++ java csharp

         .. oe:api::

            bool SpatialCoordToGridIdx(float x, float y, float z,
                                       unsigned int& ix, unsigned int& iy,
                                       unsigned int& iz) const

      .. oe:language:: python

         .. oe:api:: python

            SpatialCoordToGridIdx(x: float, y: float, z: float) -> (ix: int, iy: int, iz: int)

      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.

      .. seealso::
 
         * :oe:meth:`OESystem::OEGridBase::GridIdxToSpatialCoord`
