mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-06-12 16:26:23 +00:00
contact search NBS refactored
This commit is contained in:
@ -21,7 +21,7 @@ Licence:
|
||||
|
||||
#include "positionRandom.H"
|
||||
#include "uniformRandomReal.H"
|
||||
#include "NBS.H"
|
||||
#include "NBSLevel0.H"
|
||||
#include "unsortedPairs.H"
|
||||
#include "box.H"
|
||||
|
||||
@ -30,7 +30,7 @@ Licence:
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
using SearchType = NBS<DefaultExecutionSpace, int32> ;
|
||||
using SearchType = NBSLevel0<DefaultExecutionSpace> ;
|
||||
using ContainerType = unsortedPairs<DefaultExecutionSpace, int32>;
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ bool pFlow::positionRandom::positionOnePass(int32 pass, int32 startNum)
|
||||
|
||||
fillPoints(startNum, positionHD, flagHD);
|
||||
|
||||
search.broadSearch(pairs, range(0, startNum), true);
|
||||
search.broadSearch(pairs, range(0, startNum));
|
||||
|
||||
|
||||
int32 numCollisions = findCollisions(pairs, flagHD);
|
||||
|
@ -35,6 +35,7 @@ rectMeshField_H<T> sumOp( const pointField_H<T> field, const pointRectCell& poin
|
||||
{
|
||||
// create field
|
||||
const auto& mesh = pointToCell.mesh();
|
||||
auto iterator = pointToCell.getCellIterator();
|
||||
|
||||
rectMeshField_H<T> results(mesh, T(0));
|
||||
|
||||
@ -44,12 +45,12 @@ rectMeshField_H<T> sumOp( const pointField_H<T> field, const pointRectCell& poin
|
||||
{
|
||||
for(int32 k=0; k<mesh.nz(); k++)
|
||||
{
|
||||
auto n = pointToCell.Head(i,j,k);
|
||||
auto n = iterator.start(i,j,k);
|
||||
T res (0);
|
||||
while(n>-1)
|
||||
{
|
||||
res += field[n];
|
||||
n = pointToCell.Next(n);
|
||||
n = iterator.getNext(n);
|
||||
}
|
||||
|
||||
results(i,j,k) = res;
|
||||
@ -65,6 +66,7 @@ rectMeshField_H<T> sumMaksOp( const pointField_H<T> field, const pointRectCell&
|
||||
{
|
||||
// create field
|
||||
const auto& mesh = pointToCell.mesh();
|
||||
auto iterator = pointToCell.getCellIterator();
|
||||
|
||||
rectMeshField_H<T> results(mesh, T(0));
|
||||
|
||||
@ -75,7 +77,7 @@ rectMeshField_H<T> sumMaksOp( const pointField_H<T> field, const pointRectCell&
|
||||
for(int32 k=0; k<mesh.nz(); k++)
|
||||
{
|
||||
//auto [loop, n] = pointToCell.startLoop(i,j,k);
|
||||
auto n = pointToCell.Head(i,j,k);
|
||||
auto n = iterator.start(i,j,k);
|
||||
T res (0);
|
||||
|
||||
while(n>-1)
|
||||
@ -86,7 +88,7 @@ rectMeshField_H<T> sumMaksOp( const pointField_H<T> field, const pointRectCell&
|
||||
res += field[n];
|
||||
}
|
||||
|
||||
n = pointToCell.Next(n);
|
||||
n = iterator.getNext(n);
|
||||
}
|
||||
|
||||
results(i,j,k) = res;
|
||||
|
@ -21,7 +21,7 @@ Licence:
|
||||
#ifndef __pointRectCell_H__
|
||||
#define __pointRectCell_H__
|
||||
|
||||
#include "NBS.H"
|
||||
#include "mapperNBS.H"
|
||||
#include "rectMeshFields.H"
|
||||
#include "pointStructure.H"
|
||||
|
||||
@ -33,7 +33,7 @@ class pointRectCell
|
||||
{
|
||||
public:
|
||||
|
||||
using mapType = NBS<DefaultHostExecutionSpace, int32>;
|
||||
using mapType = mapperNBS<DefaultHostExecutionSpace>;
|
||||
|
||||
using memory_space = typename mapType::memory_space;
|
||||
|
||||
@ -48,9 +48,6 @@ protected:
|
||||
|
||||
ViewType1D<realx3, memory_space> pointPosition_;
|
||||
|
||||
ViewType1D<real, memory_space> diameter_;
|
||||
|
||||
|
||||
mapType map_;
|
||||
|
||||
int32RectMeshField_H nPointInCell_;
|
||||
@ -79,14 +76,12 @@ public:
|
||||
),
|
||||
pStruct_(pStruct),
|
||||
pointPosition_(pStruct_.pointPosition().hostVectorAll()),
|
||||
diameter_("diameter", pStruct_.capacity()),
|
||||
map_(
|
||||
mesh_.domain(),
|
||||
mesh_.nx(),
|
||||
mesh_.ny(),
|
||||
mesh_.nz(),
|
||||
pointPosition_,
|
||||
diameter_),
|
||||
pointPosition_),
|
||||
nPointInCell_(mesh_, 0)
|
||||
{
|
||||
|
||||
@ -111,9 +106,9 @@ public:
|
||||
|
||||
map_.buildCheckInDomain(activeRange, activeMask);
|
||||
|
||||
auto iterator = map_.getCellIterator();
|
||||
|
||||
const auto& Next = map_.Next();
|
||||
const auto& Head = map_.Head();
|
||||
|
||||
for(int32 i=0; i<map_.nx(); i++)
|
||||
{
|
||||
for(int32 j=0; j<map_.ny(); j++)
|
||||
@ -122,11 +117,11 @@ public:
|
||||
{
|
||||
|
||||
int32 res = 0;
|
||||
int32 n = Head(i,j,k);
|
||||
int32 n = iterator.start(i,j,k);
|
||||
while( n>-1)
|
||||
{
|
||||
res+=1;
|
||||
n = Next[n];
|
||||
n = iterator.getNext(n);
|
||||
}
|
||||
nPointInCell_(i,j,k) = res;
|
||||
|
||||
@ -136,20 +131,16 @@ public:
|
||||
|
||||
}
|
||||
|
||||
auto getCellIterator()const
|
||||
{
|
||||
return map_.getCellIterator();
|
||||
}
|
||||
|
||||
int32 nPointInCell(int32 i, int32 j, int32 k)const
|
||||
{
|
||||
return nPointInCell_(i,j,k);
|
||||
}
|
||||
|
||||
auto inline Head(int32 i, int32 j, int32 k)const
|
||||
{
|
||||
return map_.Head()(i,j,k);
|
||||
}
|
||||
|
||||
auto inline Next(int32 n)const
|
||||
{
|
||||
return map_.Next()(n);
|
||||
}
|
||||
//auto
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user