Files
phasicFlow/src/Interaction/contactSearch/methods/NBSLevel.H

92 lines
1.3 KiB
C++
Raw Normal View History

2022-10-27 14:19:53 +03:30
#ifndef __NBSLevel_H__
#define __NBSLevel_H__
#include "cells.H"
#include "contactSearchFunctions.H"
template<typename executionSpace>
class
NBSLevel
{
public:
using execution_space= executionSpace;
using memory_space = typename execution_space::memory_space;
using rangePolicy = Kokkos::RangePolicy<
Kokkos::IndexType<int32>,
Kokkos::Schedule<Kokkos::Static>,
execution_space>
protected:
2022-10-27 20:10:12 +03:30
int32x3 numCells_{1,1,1};
2022-10-27 14:19:53 +03:30
ViewType3D<int32, memory_space> head_;
2022-10-27 20:10:12 +03:30
int8 level_ = 0;
2022-10-27 14:19:53 +03:30
public:
2022-10-27 20:10:12 +03:30
NBSLevel()
{}
NBSLevel(int8 lvl, int32x3 numCells)
2022-10-27 14:19:53 +03:30
:
2022-10-27 20:10:12 +03:30
numCells_(gridExtent),
head_("NBSLevel::head", numCells_.x(), numCells_.y(), numCells_.z()),
2022-10-27 14:19:53 +03:30
level_(lvl)
{}
INLINE_FUNCION_HD
auto& head(int32 i, int32 j, int32 k)
{
return head_(i,j,k);
}
INLINE_FUNCION_HD
auto& head()
{
return head_;
}
INLINE_FUNCION_HD
auto level()const
{
return level_;
}
INLINE_FUNCION_HD
2022-10-27 20:10:12 +03:30
const auto& numCells()const
2022-10-27 14:19:53 +03:30
{
return gridExtent_;
}
2022-10-27 20:10:12 +03:30
void nullify()
{
fill(
head_,
range(0,numCells_.x()),
range(0,numCells_.y()),
range(0,numCells_.z()),
static_cast<int32>(-1)
);
}
2022-10-27 14:19:53 +03:30
};
2022-10-27 20:10:12 +03:30
INLINE_FUNCION_HD
int32x3 mapIndexLevels( int32x3 ind, int32 lowerLevel, int32 upperLevel)
{
int32 a = pow(2, static_cast<int32>(upperLevel-lowerLevel));
return ind/a;
}
2022-10-27 14:19:53 +03:30
2022-10-27 20:10:12 +03:30
}
2022-10-27 14:19:53 +03:30
#endif