# PhasicFlow: src/Interaction/contactSearch/methods/NBSLevel.hpp Source File

NBSLevel.hpp
Go to the documentation of this file.
#ifndef __NBSLevel_hpp__
#define __NBSLevel_hpp__
#include "NBSLevel0.hpp"
namespace pFlow
{
INLINE_FUNCTION_HD
int32x3 mapIndexLevels(const int32x3& ind, int32 lowerLevel, int32 upperLevel);
template<typename executionSpace>
class
NBSLevel
:
public NBSLevel0<executionSpace>
{
public:
using NBSLevel0Type = NBSLevel0<executionSpace>;
using cellIterator = typename NBSLevel0Type::cellIterator;
using IdType = typename NBSLevel0Type::IdType;
using IndexType = typename NBSLevel0Type::IndexType;
using Cells = typename NBSLevel0Type::Cells;
using CellType = typename Cells::CellType;
using execution_space = typename NBSLevel0Type::execution_space;
using memory_space = typename NBSLevel0Type::memory_space;
using mdrPolicyFindPairs = typename NBSLevel0Type::mdrPolicyFindPairs;
using HeadType = typename NBSLevel0Type::HeadType;
using NextType = typename NBSLevel0Type::NextType;
template<typename exeSpace>
friend class NBSLevels;
protected:
int32 level_ = 0;
public:
TypeInfoNV("NBSLevel0");
INLINE_FUNCTION_HD
NBSLevel(){}
NBSLevel(
int32 lvl,
const box& domain,
real cellSize,
real sizeRatio,
const ViewType1D<realx3, memory_space>& position,
const ViewType1D<real, memory_space>& diam)
:
NBSLevel0Type(
domain,
cellSize,
sizeRatio,
position,
diam,
lvl==0),
level_(lvl)
{}
INLINE_FUNCTION_HD
NBSLevel(const NBSLevel&) = default;
INLINE_FUNCTION_HD
NBSLevel& operator = (const NBSLevel&) = default;
INLINE_FUNCTION_HD
~NBSLevel() = default;
INLINE_FUNCTION_HD
auto level()const
{
return level_;
}
template<typename PairsContainer>
INLINE_FUNCTION_H
int32 findPairsCountCross(PairsContainer& pairs, NBSLevel& upperLevel)
{
mdrPolicyFindPairs
mdrPolicy(
{0,0,0},
{this->nx(),this->ny(),this->nz()} );
int32 notInsertedPairs;
Kokkos::parallel_reduce (
"NBSLevel::findPairsCountCross",
mdrPolicy,
CLASS_LAMBDA_HD(int32 i, int32 j, int32 k, int32& getFullUpdate){
#include "NBSCrossLoop.hpp"
}, notInsertedPairs);
return notInsertedPairs;
}
};
INLINE_FUNCTION_HD
int32x3 mapIndexLevels( const int32x3& ind, int32 lowerLevel, int32 upperLevel)
{
int32 a = pow(2, static_cast< int32 >(upperLevel-lowerLevel));
return ind/a;
}
}
#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