www.cemf.ir
AB2Kernels.hpp
Go to the documentation of this file.
1 
2 
3 #ifndef __AB2Kernels_hpp__
4 #define __AB2Kernels_hpp__
5 
6 #include "KokkosTypes.hpp"
7 #include "types.hpp"
8 
10 {
11 inline
13  const word& name,
14  real dt,
15  rangeU32 activeRng,
16  const deviceViewType1D<realx3>& y,
17  const deviceViewType1D<realx3>& dy,
18  const deviceViewType1D<realx3>& dy1
19 )
20 {
21  Kokkos::parallel_for(
22  name,
23  deviceRPolicyStatic (activeRng.start(), activeRng.end()),
24  LAMBDA_HD(uint32 i){
25  y[i] += dt*(static_cast<real>(1.5) * dy[i] - static_cast<real>(0.5) * dy1[i]);
26  dy1[i] = dy[i];
27  });
28  Kokkos::fence();
29 
30  return true;
31 }
32 
33 inline
34 bool intScattered
35 (
36  const word& name,
37  real dt,
38  const pFlagTypeDevice& activePoints,
39  const deviceViewType1D<realx3>& y,
40  const deviceViewType1D<realx3>& dy,
41  const deviceViewType1D<realx3>& dy1
42 )
43 {
44 
45  Kokkos::parallel_for(
46  name,
47  deviceRPolicyStatic (activePoints.activeRange().start(), activePoints.activeRange().end()),
48  LAMBDA_HD(uint32 i){
49  if( activePoints(i))
50  {
51  y[i] += dt*(static_cast<real>(1.5) * dy[i] - static_cast<real>(0.5) * dy1[i]);
52  dy1[i] = dy[i];
53  }
54  });
55  Kokkos::fence();
56 
57 
58  return true;
59 }
60 
61 }
62 
63 #endif
pFlow::real
float real
Definition: builtinTypes.hpp:45
types.hpp
pFlow::Range::end
INLINE_FUNCTION_HD T & end()
End.
Definition: Range.hpp:101
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::Range::start
INLINE_FUNCTION_HD T & start()
Start.
Definition: Range.hpp:94
KokkosTypes.hpp
pFlow::AB2Kernels
Definition: AB2Kernels.hpp:9
pFlow::deviceViewType1D
Kokkos::View< T * > deviceViewType1D
1D array (vector) with default device (memory space and execution space)
Definition: KokkosTypes.hpp:121
pFlow::AB2Kernels::intAllActive
bool intAllActive(const word &name, real dt, rangeU32 activeRng, const deviceViewType1D< realx3 > &y, const deviceViewType1D< realx3 > &dy, const deviceViewType1D< realx3 > &dy1)
Definition: AB2Kernels.hpp:12
pFlow::pointFlag::activeRange
const INLINE_FUNCTION_HD auto & activeRange() const
Definition: pointFlag.hpp:179
pFlow::Range< uint32 >
pFlow::AB2Kernels::intScattered
bool intScattered(const word &name, real dt, const pFlagTypeDevice &activePoints, const deviceViewType1D< realx3 > &y, const deviceViewType1D< realx3 > &dy, const deviceViewType1D< realx3 > &dy1)
Definition: AB2Kernels.hpp:35
LAMBDA_HD
#define LAMBDA_HD
Definition: pFlowMacros.hpp:58
pFlow::deviceRPolicyStatic
Kokkos::RangePolicy< Kokkos::DefaultExecutionSpace, Kokkos::Schedule< Kokkos::Static >, Kokkos::IndexType< pFlow::uint32 > > deviceRPolicyStatic
Definition: KokkosTypes.hpp:66
pFlow::pointFlag< DefaultExecutionSpace >