www.cemf.ir
ppwBndryContactSearch.cpp
Go to the documentation of this file.
1 
4 #include "phasicFlowKokkos.hpp"
5 #include "streams.hpp"
6 
8 {
9  if( nextCapacity_ < n)
10  {
11  nextCapacity_ = n;
13  }
14 }
15 
17 {
18  fill(head_, static_cast<uint32>(-1));
19 }
20 
22 {
23  fill(next_, 0u, n, static_cast<uint32>(-1));
24 }
25 
28 {
29  if(points.empty())return;
30  uint32 n = points.size();
31  checkAllocateNext(n);
32  nullifyNext(n);
33  nullifyHead();
34 
36  points,
37  searchCells_,
38  head_,
39  next_
40  );
41 }
42 
44 (
45  const box &domain,
46  real cellSize,
47  real sizeRatio
48 )
49 :
50  searchCells_(domain, cellSize),
51  head_("periodic:head",searchCells_.nx(), searchCells_.ny(), searchCells_.nz()),
52  sizeRatio_(sizeRatio)
53 {
54 
55 }
56 
58 (
59  csPairContainerType &ppPairs,
62  const deviceScatteredFieldAccess<realx3> &mirrorPoints,
63  const deviceScatteredFieldAccess<real>& mirrorDiams,
64  const realx3& transferVec
65 )
66 {
67 
68  buildList(points);
69 
70  uint32 nNotInserted = 1;
71 
72  // loop until the container size fits the numebr of contact pairs
73  while (nNotInserted > 0)
74  {
75 
77  (
78  ppPairs,
79  points,
80  diams,
81  mirrorPoints,
82  mirrorDiams,
83  transferVec,
84  head_,
85  next_,
86  searchCells_,
87  sizeRatio_
88  );
89 
90 
91  if(nNotInserted)
92  {
93  // - resize the container
94  // note that getFull now shows the number of failed insertions.
95  uint32 len = max(nNotInserted,100u) ;
96 
97  auto oldCap = ppPairs.capacity();
98 
99  ppPairs.increaseCapacityBy(len);
100 
101  INFORMATION<< "Particle-particle contact pair container capacity increased from "<<
102  oldCap << " to "<<ppPairs.capacity()<<" in peiodicBoundaryContactSearch."<<END_INFO;
103 
104  }
105 
106  }
107 
108  return true;
109 }
pFlow::unsortedPairs::capacity
INLINE_FUNCTION_HD uint32 capacity() const
Definition: unsortedPairs.hpp:168
pFlow::scatteredFieldAccess
Definition: scatteredFieldAccess.hpp:32
pFlow::real
float real
Definition: builtinTypes.hpp:45
pFlow::fill
void fill(Vector< T, Allocator > &vec, const T &val)
Definition: VectorAlgorithm.hpp:44
pFlow::scatteredFieldAccess::size
INLINE_FUNCTION_HD uint32 size() const
Definition: scatteredFieldAccess.hpp:134
pFlow::ppwBndryContactSearch::broadSearchPP
bool broadSearchPP(csPairContainerType &ppPairs, const deviceScatteredFieldAccess< realx3 > &points, const deviceScatteredFieldAccess< real > &diams, const deviceScatteredFieldAccess< realx3 > &mirrorPoints, const deviceScatteredFieldAccess< real > &mirrorDiams, const realx3 &transferVec)
Definition: ppwBndryContactSearch.cpp:58
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
pFlow::reallocNoInit
INLINE_FUNCTION_H void reallocNoInit(ViewType1D< Type, Properties... > &view, uint32 len)
Definition: KokkosUtilities.hpp:64
pFlow::max
T max(const internalField< T, MemorySpace > &iField)
Definition: internalFieldAlgorithms.hpp:79
pFlow::ppwBndryContactSearch::nextCapacity_
uint32 nextCapacity_
Definition: ppwBndryContactSearch.hpp:48
pFlow::ppwBndryContactSearch::ppwBndryContactSearch
ppwBndryContactSearch(const box &domain, real cellSize, real sizeRatio=1.0)
Definition: ppwBndryContactSearch.cpp:44
pFlow::unsortedPairs
Definition: unsortedPairs.hpp:32
pFlow::ppwBndryContactSearch::next_
NextType next_
Definition: ppwBndryContactSearch.hpp:44
phasicFlowKokkos.hpp
ppwBndryContactSearchKernels.hpp
pFlow::unsortedPairs::increaseCapacityBy
INLINE_FUNCTION_H void increaseCapacityBy(uint32 len)
increase the capacity of the container by at-least len the content will be erased.
Definition: unsortedPairs.hpp:193
ppwBndryContactSearch.hpp
pFlow::ppwBndryContactSearch::buildList
void buildList(const deviceScatteredFieldAccess< realx3 > &points)
Definition: ppwBndryContactSearch.cpp:26
pFlow::pweBndryContactSearchKernels::broadSearchPP
uint32 broadSearchPP(csPairContainerType &ppPairs, const deviceScatteredFieldAccess< realx3 > &points, const deviceScatteredFieldAccess< real > &diams, const deviceScatteredFieldAccess< realx3 > &mirrorPoints, const deviceScatteredFieldAccess< real > &mirrorDiams, const realx3 &transferVec, const deviceViewType3D< uint32 > &head, const deviceViewType1D< uint32 > &next, const cells &searchCells, real sizeRatio)
Definition: ppwBndryContactSearchKernels.cpp:39
streams.hpp
pFlow::ppwBndryContactSearch::nullifyHead
void nullifyHead()
Definition: ppwBndryContactSearch.cpp:16
pFlow::pweBndryContactSearchKernels::buildNextHead
void buildNextHead(const deviceScatteredFieldAccess< realx3 > &points, const cells &searchCells, deviceViewType3D< uint32 > &head, deviceViewType1D< uint32 > &next)
Definition: ppwBndryContactSearchKernels.cpp:10
n
uint32 n
Definition: NBSLoop.hpp:24
pFlow::ppwBndryContactSearch::checkAllocateNext
void checkAllocateNext(uint32 n)
Definition: ppwBndryContactSearch.cpp:7
pFlow::box
Definition: box.hpp:32
pFlow::scatteredFieldAccess::empty
INLINE_FUNCTION_HD bool empty() const
Definition: scatteredFieldAccess.hpp:140
pFlow::domain
Definition: domain.hpp:31
pFlow::triple< real >
END_INFO
#define END_INFO
Definition: streams.hpp:37
pFlow::ppwBndryContactSearch::nullifyNext
void nullifyNext(uint32 n)
Definition: ppwBndryContactSearch.cpp:21
INFORMATION
#define INFORMATION
Definition: streams.hpp:36