FieldIndexingXYZ.h 2.71 KB
Newer Older
Martin Bauer's avatar
Martin Bauer committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
//======================================================================================================================
//
//  This file is part of waLBerla. waLBerla is free software: you can
//  redistribute it and/or modify it under the terms of the GNU General Public
//  License as published by the Free Software Foundation, either version 3 of
//  the License, or (at your option) any later version.
//
//  waLBerla is distributed in the hope that it will be useful, but WITHOUT
//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
//  for more details.
//
//  You should have received a copy of the GNU General Public License along
//  with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
//
//! \file FieldIndexingXYZ.h
//! \ingroup cuda
//! \author Martin Bauer <martin.bauer@fau.de>
//
//======================================================================================================================

#pragma once

#include "FieldAccessorXYZ.h"
#include <cuda_runtime.h>


namespace walberla { namespace cell {  class CellInterval;  } }


namespace walberla {
namespace cuda {

// Forward Declarations
template< typename T> class GPUField;


   template<typename T>
   class FieldIndexingXYZ
   {
   public:

      //** Kernel call        ******************************************************************************************
      /*! \name Kernel call  */
      //@{
46 47
      dim3 blockDim() const                        { return blockDim_; }
      dim3 gridDim () const                        { return gridDim_;  }
Martin Bauer's avatar
Martin Bauer committed
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66

      const FieldAccessorXYZ<T> & gpuAccess() const { return gpuAccess_; }
      //@}
      //****************************************************************************************************************


      //** Creation        *********************************************************************************************
      /*! \name Creation  */
      //@{

      static FieldIndexingXYZ<T> interval ( const GPUField<T> & f, const cell::CellInterval & ci  );


      static FieldIndexingXYZ<T> xyz ( const GPUField<T> & f );
      static FieldIndexingXYZ<T> withGhostLayerXYZ       ( const GPUField<T> & f, uint_t numGhostLayers );
      //@}
      //****************************************************************************************************************

   protected:
67
      FieldIndexingXYZ<T> ( const GPUField<T> & field, dim3 _blockDim, dim3 _gridDim, const FieldAccessorXYZ<T> _gpuAccess );
Martin Bauer's avatar
Martin Bauer committed
68 69

      const GPUField<T> &  field_;
70 71
      dim3 blockDim_;
      dim3 gridDim_;
Martin Bauer's avatar
Martin Bauer committed
72 73 74 75 76 77 78 79
      FieldAccessorXYZ<T> gpuAccess_;
   };


} // namespace cuda
} // namespace walberla


80
#include "FieldIndexingXYZ.impl.h"