mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-06-22 16:28:30 +00:00
changes to cellsWallLevel0 to narrow down the contact list for particle-wall
This commit is contained in:
@ -32,7 +32,8 @@ pFlow::NBS::NBS
|
||||
uint32 nWallPoints,
|
||||
uint32 nWallElements,
|
||||
const ViewType1D<realx3,memory_space>& wallPoints,
|
||||
const ViewType1D<uint32x3,memory_space>& wallVertices
|
||||
const ViewType1D<uint32x3,memory_space>& wallVertices,
|
||||
const ViewType1D<realx3,memory_space>& wallNormals
|
||||
)
|
||||
:
|
||||
particleWallContactSearchs<NBS>(
|
||||
@ -61,7 +62,8 @@ pFlow::NBS::NBS
|
||||
nWallPoints,
|
||||
nWallElements,
|
||||
wallPoints,
|
||||
wallVertices
|
||||
wallVertices,
|
||||
wallNormals
|
||||
)
|
||||
{
|
||||
}
|
||||
|
@ -80,7 +80,10 @@ protected:
|
||||
if(!cellsWallLevel0_.broadSearch(
|
||||
pwPairs,
|
||||
NBSLevel0_.getSearchCells(),
|
||||
NBSLevel0_.getCellIterator()))
|
||||
NBSLevel0_.getCellIterator(),
|
||||
pointPos,
|
||||
diameter,
|
||||
sizeRatio_))
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"Error in broadSearch for NBS (particle-wall)"<<endl;
|
||||
@ -105,7 +108,8 @@ public:
|
||||
uint32 nWallPoints,
|
||||
uint32 nWallElements,
|
||||
const ViewType1D<realx3,memory_space>& wallPoints,
|
||||
const ViewType1D<uint32x3,memory_space>& wallVertices);
|
||||
const ViewType1D<uint32x3,memory_space>& wallVertices,
|
||||
const ViewType1D<realx3,memory_space>& wallNormals );
|
||||
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
|
@ -60,7 +60,6 @@ bool pFlow::NBSLevel0::findPairs
|
||||
|
||||
}
|
||||
|
||||
Kokkos::fence();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -26,18 +26,18 @@ pFlow::cellsWallLevel0::cellsWallLevel0
|
||||
real cellExtent,
|
||||
uint32 numPoints,
|
||||
uint32 numElements,
|
||||
const ViewType1D<realx3,
|
||||
memory_space> &points,
|
||||
const ViewType1D<uint32x3, memory_space> &vertices
|
||||
const ViewType1D<realx3, memory_space> &points,
|
||||
const ViewType1D<uint32x3, memory_space> &vertices,
|
||||
const ViewType1D<realx3, memory_space>& normals
|
||||
)
|
||||
:
|
||||
cellExtent_( max(cellExtent, 0.5 ) ),
|
||||
numElements_(numElements),
|
||||
numPoints_(numPoints),
|
||||
vertices_(vertices),
|
||||
points_(points)
|
||||
points_(points),
|
||||
normals_(normals)
|
||||
{
|
||||
|
||||
allocateArrays();
|
||||
}
|
||||
|
||||
@ -45,8 +45,9 @@ bool pFlow::cellsWallLevel0::resetElements
|
||||
(
|
||||
uint32 numElements,
|
||||
uint32 numPoints,
|
||||
ViewType1D<realx3, memory_space> &points,
|
||||
ViewType1D<uint32x3, memory_space> &vertices
|
||||
const ViewType1D<realx3, memory_space>& points,
|
||||
const ViewType1D<uint32x3, memory_space>& vertices,
|
||||
const ViewType1D<realx3, memory_space>& normals
|
||||
)
|
||||
{
|
||||
|
||||
@ -54,6 +55,7 @@ bool pFlow::cellsWallLevel0::resetElements
|
||||
numPoints_ = numPoints;
|
||||
points_ = points;
|
||||
vertices_ = vertices;
|
||||
normals_ = normals;
|
||||
|
||||
allocateArrays();
|
||||
|
||||
@ -64,7 +66,10 @@ bool pFlow::cellsWallLevel0::broadSearch
|
||||
(
|
||||
csPairContainerType &pairs,
|
||||
const cells& searchBox,
|
||||
const mapperNBS::CellIterator &particleMap
|
||||
const mapperNBS::CellIterator &particleMap,
|
||||
const deviceViewType1D<realx3>& pPoints,
|
||||
const deviceViewType1D<real>& pDiams,
|
||||
real sizeRatio
|
||||
)
|
||||
{
|
||||
|
||||
@ -72,7 +77,7 @@ bool pFlow::cellsWallLevel0::broadSearch
|
||||
|
||||
this->build(searchBox);
|
||||
|
||||
this->particleWallFindPairs(pairs, particleMap);
|
||||
this->particleWallFindPairs(pairs, particleMap, pPoints, pDiams, sizeRatio);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -104,7 +109,10 @@ bool pFlow::cellsWallLevel0::build(const cells & searchBox)
|
||||
bool pFlow::cellsWallLevel0::particleWallFindPairs
|
||||
(
|
||||
csPairContainerType &pairs,
|
||||
const mapperNBS::CellIterator &particleMap
|
||||
const mapperNBS::CellIterator &particleMap,
|
||||
const deviceViewType1D<realx3>& pPoints,
|
||||
const deviceViewType1D<real>& pDiams,
|
||||
real sizeRatio
|
||||
)
|
||||
{
|
||||
|
||||
@ -113,7 +121,7 @@ bool pFlow::cellsWallLevel0::particleWallFindPairs
|
||||
while (getFull)
|
||||
{
|
||||
|
||||
getFull = findPairsElementRangeCount(pairs, particleMap);
|
||||
getFull = findPairsElementRangeCount(pairs, particleMap, pPoints, pDiams, sizeRatio);
|
||||
|
||||
if(getFull)
|
||||
{
|
||||
@ -137,14 +145,14 @@ bool pFlow::cellsWallLevel0::particleWallFindPairs
|
||||
pFlow::int32 pFlow::cellsWallLevel0::findPairsElementRangeCount
|
||||
(
|
||||
csPairContainerType &pairs,
|
||||
const mapperNBS::CellIterator &particleMap
|
||||
const mapperNBS::CellIterator &particleMap,
|
||||
const deviceViewType1D<realx3>& pPoints,
|
||||
const deviceViewType1D<real>& pDiams,
|
||||
real sizeRatio
|
||||
)
|
||||
{
|
||||
uint32 getFull =0;
|
||||
|
||||
//const auto pwPairs = pairs;
|
||||
const auto elementBox = elementBox_;
|
||||
|
||||
|
||||
|
||||
Kokkos::parallel_reduce(
|
||||
"pFlow::cellsWallLevel0::findPairsElementRangeCount",
|
||||
@ -155,13 +163,16 @@ pFlow::int32 pFlow::cellsWallLevel0::findPairsElementRangeCount
|
||||
|
||||
const uint32 iTri = teamMember.league_rank();
|
||||
|
||||
const auto triBox = elementBox[iTri];
|
||||
|
||||
const auto triBox = elementBox_[iTri];
|
||||
const auto triPlane = infinitePlane(
|
||||
normals_[iTri],
|
||||
points_[vertices_[iTri].x()]);
|
||||
|
||||
uint32 getFull2 = 0;
|
||||
|
||||
auto bExtent = boxExtent(triBox);
|
||||
uint32 numCellBox = bExtent.x()*bExtent.y()*bExtent.z();
|
||||
|
||||
|
||||
Kokkos::parallel_reduce(
|
||||
Kokkos::TeamThreadRange( teamMember, numCellBox ),
|
||||
[&] ( const uint32 linIndex, uint32 &innerUpdate )
|
||||
@ -175,10 +186,13 @@ pFlow::int32 pFlow::cellsWallLevel0::findPairsElementRangeCount
|
||||
while( n != particleMap.NoPos)
|
||||
{
|
||||
// id is wall id the pair is (particle id, wall id)
|
||||
if( pairs.insert(
|
||||
static_cast<csIdType>(n),
|
||||
static_cast<csIdType>(iTri) ) == -1 )
|
||||
innerUpdate++;
|
||||
if( abs(triPlane.pointFromPlane(pPoints[n]))< pDiams[n]*sizeRatio*cellExtent_)
|
||||
{
|
||||
if( pairs.insert(
|
||||
static_cast<csIdType>(n),
|
||||
static_cast<csIdType>(iTri) ) == -1 )
|
||||
innerUpdate++;
|
||||
}
|
||||
n = particleMap.next(n);
|
||||
|
||||
}
|
||||
|
@ -60,6 +60,9 @@ private:
|
||||
// - ref to points in the trisurface (borrowed)
|
||||
ViewType1D<realx3, memory_space> points_;
|
||||
|
||||
// - ref to normal vectors of triangles (borrowed)
|
||||
ViewType1D<realx3, memory_space> normals_;
|
||||
|
||||
// cell range of element/triangle bounding box
|
||||
ViewType1D<iBoxType, memory_space> elementBox_;
|
||||
|
||||
@ -88,7 +91,8 @@ public:
|
||||
uint32 numPoints,
|
||||
uint32 numElements,
|
||||
const ViewType1D<realx3,memory_space>& points,
|
||||
const ViewType1D<uint32x3,memory_space>& vertices);
|
||||
const ViewType1D<uint32x3,memory_space>& vertices,
|
||||
const ViewType1D<realx3, memory_space>& normals);
|
||||
|
||||
|
||||
|
||||
@ -97,8 +101,9 @@ public:
|
||||
bool resetElements(
|
||||
uint32 numElements,
|
||||
uint32 numPoints,
|
||||
ViewType1D<realx3, memory_space>& points,
|
||||
ViewType1D<uint32x3, memory_space>& vertices);
|
||||
const ViewType1D<realx3, memory_space>& points,
|
||||
const ViewType1D<uint32x3, memory_space>& vertices,
|
||||
const ViewType1D<realx3, memory_space>& normals);
|
||||
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
@ -116,18 +121,27 @@ public:
|
||||
bool broadSearch(
|
||||
csPairContainerType& pairs,
|
||||
const cells& searchBox,
|
||||
const mapperNBS::CellIterator& particleMap);
|
||||
const mapperNBS::CellIterator& particleMap,
|
||||
const deviceViewType1D<realx3>& pPoints,
|
||||
const deviceViewType1D<real>& pDiams,
|
||||
real sizeRatio);
|
||||
|
||||
|
||||
bool build(const cells& searchBox);
|
||||
|
||||
bool particleWallFindPairs(
|
||||
csPairContainerType& pairs,
|
||||
const mapperNBS::CellIterator& particleMap);
|
||||
const mapperNBS::CellIterator& particleMap,
|
||||
const deviceViewType1D<realx3>& pPoints,
|
||||
const deviceViewType1D<real>& pDiams,
|
||||
real sizeRatio);
|
||||
|
||||
int32 findPairsElementRangeCount(
|
||||
csPairContainerType& pairs,
|
||||
const mapperNBS::CellIterator& particleMap);
|
||||
const mapperNBS::CellIterator& particleMap,
|
||||
const deviceViewType1D<realx3>& pPoints,
|
||||
const deviceViewType1D<real>& pDiams,
|
||||
real sizeRatio);
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user