NBSLevel.hpp
Go to the documentation of this file.
1 #ifndef __NBSLevel_hpp__
2 #define __NBSLevel_hpp__
3 
4 
5 #include "NBSLevel0.hpp"
6 
7 
8 namespace pFlow
9 {
10 
12 int32x3 mapIndexLevels(const int32x3& ind, int32 lowerLevel, int32 upperLevel);
13 
14 template<typename executionSpace>
15 class
17 :
19 {
20 public:
21 
23 
25 
26  using IdType = typename NBSLevel0Type::IdType;
27 
29 
30  using Cells = typename NBSLevel0Type::Cells;
31 
32  using CellType = typename Cells::CellType;
33 
35 
37 
39 
41 
43 
44  template<typename exeSpace>
45  friend class NBSLevels;
46 
47 protected:
48 
49  int32 level_ = 0;
50 
51 
52 public:
53 
54  TypeInfoNV("NBSLevel0");
55 
58 
60  int32 lvl,
61  const box& domain,
62  real cellSize,
63  real sizeRatio,
64  const ViewType1D<realx3, memory_space>& position,
66  :
68  domain,
69  cellSize,
70  sizeRatio,
71  position,
72  diam,
73  lvl==0),
74  level_(lvl)
75  {}
76 
78  NBSLevel(const NBSLevel&) = default;
79 
81  NBSLevel& operator = (const NBSLevel&) = default;
82 
84  ~NBSLevel() = default;
85 
87  auto level()const
88  {
89  return level_;
90  }
91 
92  template<typename PairsContainer>
94  int32 findPairsCountCross(PairsContainer& pairs, NBSLevel& upperLevel)
95  {
96 
98  mdrPolicy(
99  {0,0,0},
100  {this->nx(),this->ny(),this->nz()} );
101 
102  int32 notInsertedPairs;
103 
104  Kokkos::parallel_reduce (
105  "NBSLevel::findPairsCountCross",
106  mdrPolicy,
107  CLASS_LAMBDA_HD(int32 i, int32 j, int32 k, int32& getFullUpdate){
108  #include "NBSCrossLoop.hpp"
109  }, notInsertedPairs);
110 
111  return notInsertedPairs;
112  }
113 
114 
115 };
116 
118 int32x3 mapIndexLevels( const int32x3& ind, int32 lowerLevel, int32 upperLevel)
119 {
120  int32 a = pow(2, static_cast<int32>(upperLevel-lowerLevel));
121  return ind/a;
122 }
123 
124 
125 }
126 
127 #endif
pFlow::NBSLevel::NBSLevel
INLINE_FUNCTION_HD NBSLevel()
Definition: NBSLevel.hpp:57
pFlow::real
float real
Definition: builtinTypes.hpp:46
pFlow::NBSLevels
Definition: NBSLevels.hpp:12
pFlow::NBSLevel0
Definition: NBSLevel0.hpp:32
pFlow::NBSLevel0::NextType
typename MapperType::NextType NextType
Definition: NBSLevel0.hpp:56
NBSLevel0.hpp
TypeInfoNV
#define TypeInfoNV(tName)
Definition: typeInfo.hpp:52
pFlow::int32x3
triple< int32 > int32x3
Definition: types.hpp:41
pFlow::NBSLevel0::cellIterator
typename MapperType::cellIterator cellIterator
Definition: NBSLevel0.hpp:40
pFlow::mapperNBS::NextType
ViewType1D< int32, memory_space > NextType
Definition: mapperNBS.hpp:54
pFlow
Definition: demComponent.hpp:28
pFlow::NBSLevel::NBSLevel
NBSLevel(int32 lvl, const box &domain, real cellSize, real sizeRatio, const ViewType1D< realx3, memory_space > &position, const ViewType1D< real, memory_space > &diam)
Definition: NBSLevel.hpp:59
pFlow::mapperNBS::IdType
int32 IdType
Definition: mapperNBS.hpp:40
CLASS_LAMBDA_HD
#define CLASS_LAMBDA_HD
Definition: pFlowMacros.hpp:56
pFlow::NBSLevel::mdrPolicyFindPairs
typename NBSLevel0Type::mdrPolicyFindPairs mdrPolicyFindPairs
Definition: NBSLevel.hpp:38
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
pFlow::pow
Vector< T, Allocator > pow(const Vector< T, Allocator > &v, T e)
Definition: VectorMath.hpp:109
pFlow::mapperNBS::IndexType
int32 IndexType
Definition: mapperNBS.hpp:42
pFlow::NBSLevel::cellIterator
typename NBSLevel0Type::cellIterator cellIterator
Definition: NBSLevel.hpp:24
pFlow::NBSLevel::level
INLINE_FUNCTION_HD auto level() const
Definition: NBSLevel.hpp:87
pFlow::NBSLevel0::memory_space
typename MapperType::memory_space memory_space
Definition: NBSLevel0.hpp:52
INLINE_FUNCTION_H
#define INLINE_FUNCTION_H
Definition: pFlowMacros.hpp:53
pFlow::NBSLevel0::execution_space
typename MapperType::execution_space execution_space
Definition: NBSLevel0.hpp:50
pFlow::mapIndexLevels
INLINE_FUNCTION_HD int32x3 mapIndexLevels(const int32x3 &ind, int32 lowerLevel, int32 upperLevel)
Definition: NBSLevel.hpp:118
pFlow::mapperNBS::CellType
typename Cells::CellType CellType
Definition: mapperNBS.hpp:46
pFlow::NBSLevel::findPairsCountCross
INLINE_FUNCTION_H int32 findPairsCountCross(PairsContainer &pairs, NBSLevel &upperLevel)
Definition: NBSLevel.hpp:94
pFlow::mapperNBS::HeadType
ViewType3D< int32, memory_space > HeadType
Definition: mapperNBS.hpp:52
pFlow::NBSLevel0::HeadType
typename MapperType::HeadType HeadType
Definition: NBSLevel0.hpp:54
pFlow::mapperNBS::execution_space
executionSpace execution_space
Definition: mapperNBS.hpp:48
pFlow::box
Definition: box.hpp:32
pFlow::NBSLevel0::IndexType
typename MapperType::IndexType IndexType
Definition: NBSLevel0.hpp:44
pFlow::NBSLevel
Definition: NBSLevel.hpp:15
pFlow::ViewType1D
Kokkos::View< T *, properties... > ViewType1D
Definition: KokkosTypes.hpp:62
pFlow::NBSLevel0::Cells
typename MapperType::Cells Cells
Definition: NBSLevel0.hpp:46
pFlow::cells
Definition: cells.hpp:32
INLINE_FUNCTION_HD
#define INLINE_FUNCTION_HD
Definition: pFlowMacros.hpp:51
pFlow::triple< indexType >
NBSCrossLoop.hpp
pFlow::mapperNBS::memory_space
typename execution_space::memory_space memory_space
Definition: mapperNBS.hpp:50
pFlow::NBSLevel0::IdType
typename MapperType::IdType IdType
Definition: NBSLevel0.hpp:42
pFlow::NBSLevel0::mdrPolicyFindPairs
Kokkos::MDRangePolicy< Kokkos::Rank< 3 >, Kokkos::Schedule< Kokkos::Dynamic >, execution_space > mdrPolicyFindPairs
Definition: NBSLevel0.hpp:73