.. oe:namespace:: OESystem



.. meta::
   :keywords: OEGrid, Grid


.. _OESystem_OEGrid:

.. oe:class:: OEGrid

   .. oe:api::


      template<class GridType>
      class OEGrid : public OEFixedGrid<GridType>

   This class represents `OEGrid`.

   The following methods are publicly inherited from :ref:`OEFixedGrid <OESystem_OEFixedGrid>`:

   ========================================================= ========================================================== =========================================================
   :oe:meth:`operator()<OESystem::OEFixedGrid::operator()>`  :oe:meth:`GetDataType<OESystem::OEFixedGrid::GetDataType>` :oe:meth:`SetValues<OESystem::OEFixedGrid::SetValues>`   
   :oe:meth:`operator[]<OESystem::OEFixedGrid::operator[]>`  :oe:meth:`GetValues<OESystem::OEFixedGrid::GetValues>`                                                              
   :oe:meth:`CreateCopy<OESystem::OEFixedGrid::CreateCopy>`  :oe:meth:`IsDataType<OESystem::OEFixedGrid::IsDataType>`                                                            
   ========================================================= ========================================================== =========================================================

   The following methods are publicly inherited from :ref:`OEGridBase <OESystem_OEGridBase>`:

   ============================================================================= ============================================================================ =============================================================================
   :oe:meth:`Clear<OESystem::OEGridBase::Clear>`                                 :oe:meth:`GetXMid<OESystem::OEGridBase::GetXMid>`                            :oe:meth:`GetZMin<OESystem::OEGridBase::GetZMin>`                            
   :oe:meth:`CreateCopy<OESystem::OEGridBase::CreateCopy>`                       :oe:meth:`GetXMin<OESystem::OEGridBase::GetXMin>`                            :oe:meth:`GridIdxToElement<OESystem::OEGridBase::GridIdxToElement>`          
   :oe:meth:`ElementToGridIdx<OESystem::OEGridBase::ElementToGridIdx>`           :oe:meth:`GetY<OESystem::OEGridBase::GetY>`                                  :oe:meth:`GridIdxToSpatialCoord<OESystem::OEGridBase::GridIdxToSpatialCoord>`
   :oe:meth:`ElementToSpatialCoord<OESystem::OEGridBase::ElementToSpatialCoord>` :oe:meth:`GetYDim<OESystem::OEGridBase::GetYDim>`                            :oe:meth:`IsDataType<OESystem::OEGridBase::IsDataType>`                      
   :oe:meth:`GetDataType<OESystem::OEGridBase::GetDataType>`                     :oe:meth:`GetYIdx<OESystem::OEGridBase::GetYIdx>`                            :oe:meth:`IsInGrid<OESystem::OEGridBase::IsInGrid>`                          
   :oe:meth:`GetDim<OESystem::OEGridBase::GetDim>`                               :oe:meth:`GetYInc<OESystem::OEGridBase::GetYInc>`                            :oe:meth:`IsSpacingSet<OESystem::OEGridBase::IsSpacingSet>`                  
   :oe:meth:`GetMid<OESystem::OEGridBase::GetMid>`                               :oe:meth:`GetYMax<OESystem::OEGridBase::GetYMax>`                            :oe:meth:`IsTitleSet<OESystem::OEGridBase::IsTitleSet>`                      
   :oe:meth:`GetSize<OESystem::OEGridBase::GetSize>`                             :oe:meth:`GetYMid<OESystem::OEGridBase::GetYMid>`                            :oe:meth:`IsXMidSet<OESystem::OEGridBase::IsXMidSet>`                        
   :oe:meth:`GetSpacing<OESystem::OEGridBase::GetSpacing>`                       :oe:meth:`GetYMin<OESystem::OEGridBase::GetYMin>`                            :oe:meth:`IsYMidSet<OESystem::OEGridBase::IsYMidSet>`                        
   :oe:meth:`GetTitle<OESystem::OEGridBase::GetTitle>`                           :oe:meth:`GetZ<OESystem::OEGridBase::GetZ>`                                  :oe:meth:`IsZMidSet<OESystem::OEGridBase::IsZMidSet>`                        
   :oe:meth:`GetX<OESystem::OEGridBase::GetX>`                                   :oe:meth:`GetZDim<OESystem::OEGridBase::GetZDim>`                            :oe:meth:`SetTitle<OESystem::OEGridBase::SetTitle>`                          
   :oe:meth:`GetXDim<OESystem::OEGridBase::GetXDim>`                             :oe:meth:`GetZIdx<OESystem::OEGridBase::GetZIdx>`                            :oe:meth:`SpatialCoordToElement<OESystem::OEGridBase::SpatialCoordToElement>`
   :oe:meth:`GetXIdx<OESystem::OEGridBase::GetXIdx>`                             :oe:meth:`GetZInc<OESystem::OEGridBase::GetZInc>`                            :oe:meth:`SpatialCoordToGridIdx<OESystem::OEGridBase::SpatialCoordToGridIdx>`
   :oe:meth:`GetXInc<OESystem::OEGridBase::GetXInc>`                             :oe:meth:`GetZMax<OESystem::OEGridBase::GetZMax>`                                                                                                         
   :oe:meth:`GetXMax<OESystem::OEGridBase::GetXMax>`                             :oe:meth:`GetZMid<OESystem::OEGridBase::GetZMid>`                                                                                                         
   ============================================================================= ============================================================================ =============================================================================

   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:`OEScalarGrid <OESystem_OEScalarGrid>`
   
   .. oe:method:: Constructors

      .. oe:api::

         OEGrid()

      Creates a one point :ref:`OEScalarGrid <OESystem_OEScalarGrid>` grid object.

      .. oe:api::

         OEGrid(const OEGrid<GridType>& rhs)
         OEGrid(const OEFixedGrid<GridType>& rhs)

      Creates a :ref:`OEGrid <OESystem_OEGrid>` object and copies the entire contents of the 'rhs' grid.

      .. oe:api::

         OEGrid(const float minmax[6], float spacing, const char* title = "")
         OEGrid(const double minmax[6], double spacing, const char* title = "")


      Creates a :ref:`OEGrid <OESystem_OEGrid>` object from a minimum bounding box ('minmax').
      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 :oe:meth:`OESystem::OEGridBase::GetTitle` method.

      .. oe:api::

         OEGrid(int xdim, int ydim, int zdim, float midx, float midy,
                float midz, float spacing, std::string title = "",
                GridType* dataptr = 0)

      Creates and initializes a :ref:`OEGrid <OESystem_OEGrid>` object. The
      grid data can be copied from the optional parameter
      'dataptr'. The pointer should be an array of size
      ``xdim*ydim*zdim*sizeof(float)``.


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

      .. oe:api::

         OEGrid<GridType>& operator=(const OEGrid<GridType>& rhs)
         OEGrid<GridType>& operator=(const OEFixedGrid<GridType>& rhs)

      Copies the contents of 'rhs' grid.

      Assignment operator.


   .. oe:method:: Clear

      .. oe:api::

         void Clear()

      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() -> OEGrid

   .. oe:method:: GetDataType

      .. oe:api::

         const void *GetDataType() const

   .. oe:method:: IsDataType

      .. oe:api::

         bool IsDataType(const void *type) const

   .. oe:method:: SetAll

      .. oe:api::

         bool SetAll(unsigned int xdim, unsigned int ydim, unsigned 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.

   .. oe:method:: SetDim

      .. oe:api::

         bool SetDim(unsigned int ixdim, unsigned int iydim, unsigned int izdim)

      Sets the number of grid points for each dimension.

   .. oe:method:: SetMid

      .. oe:api::

         bool SetMid(float x, float y, float z)

      Sets the mid-point (center) of the grid.

   .. oe:method:: SetSpacing

      .. oe:api::

         bool SetSpacing(float spacing)

      Sets the length between grid points.

   .. oe:method:: SetXDim

      .. oe:api::

         bool SetXDim(unsigned int ixdim)

      Sets the number of grid points in the x-dimension.

   .. oe:method:: SetXMid

      .. oe:api::

         bool SetXMid(float x)

      Sets the mid-point (center) in the x-dimension.

   .. oe:method:: SetYDim

      .. oe:api::

         bool SetYDim(unsigned int iydim)

      Sets the number of grid points in the y-dimension.

   .. oe:method:: SetYMid

      .. oe:api::

         bool SetYMid(float y)

      Sets the mid-point (center) in the y-dimension.

   .. oe:method:: SetZDim

      .. oe:api::

         bool SetZDim(unsigned int izdim)

      Sets the number of grid points in the z-dimension.

   .. oe:method:: SetZMid

      .. oe:api::

         bool SetZMid(float z)


      Sets the mid-point (center) in the z-dimension.
