1 #ifndef __NBSLevels_hpp__
2 #define __NBSLevels_hpp__
11 template<
typename executionSpace>
59 Kokkos::IndexType<int32>,
60 Kokkos::Schedule<Kokkos::Static>,
70 else if(maxOvermin<=3)
72 else if(maxOvermin<=7)
74 else if(maxOvermin<15)
76 else if(maxOvermin<31)
78 else if(maxOvermin<63)
80 else if(maxOvermin <127)
85 "size ratio is not valid for multi-grid NBS "<< maxOvermin<<
endl;
95 real lvl_minD = lvl_maxD/2.0;
100 if(lvl == 0 ) lvl_minD = 0.01*
minSize_;
197 initLevels(domain, sizeRatio, position, diam);
215 template<
typename PairsContainer>
234 auto oldCap = pairs.capacity();
236 pairs.increaseCapacityBy(len);
238 INFORMATION<<
"The contact pair container capacity increased from "<<
239 oldCap <<
" to "<<pairs.capacity()<<
" in NBSLevels."<<
endINFO;
250 template<
typename PairsContainer>
255 int32 notInsertedCount = 0;
261 notInsertedCount+=
nbsLevels_[lvl].findPairsCount(pairs);
272 return notInsertedCount;
289 auto pointPosition = nbsLevel0.pointPosition();
291 auto next = nbsLevel0.next();
292 auto head0 = nbsLevel0.head();
305 Kokkos::parallel_for(
310 int8 lvl = particleLevel[i];
311 auto ind = nbsLevel0.pointIndex(pointPosition[i]);
315 old =Kokkos::atomic_exchange(&head0(ind.x(), ind.y(), ind.z()),i);
317 old =Kokkos::atomic_exchange(&head1(ind.x(), ind.y(), ind.z()),i);
319 old =Kokkos::atomic_exchange(&head2(ind.x(), ind.y(), ind.z()),i);
321 old =Kokkos::atomic_exchange(&head3(ind.x(), ind.y(), ind.z()),i);
323 old =Kokkos::atomic_exchange(&head4(ind.x(), ind.y(), ind.z()),i);
325 old =Kokkos::atomic_exchange(&head5(ind.x(), ind.y(), ind.z()),i);
327 old =Kokkos::atomic_exchange(&head6(ind.x(), ind.y(), ind.z()),i);
335 template<
typename IncludeFunction>
348 auto pointPosition = nbsLevel0.pointPosition();
350 auto next = nbsLevel0.next();
351 auto head0 = nbsLevel0.head();
362 Kokkos::parallel_for(
366 if(!incld(i))
return;
368 int8 lvl = particleLevel[i];
369 auto ind = nbsLevel0.pointIndex(pointPosition[i]);
374 old =Kokkos::atomic_exchange(&head0(ind.x(), ind.y(), ind.z()),i);
376 old =Kokkos::atomic_exchange(&head1(ind.x(), ind.y(), ind.z()),i);
378 old =Kokkos::atomic_exchange(&head2(ind.x(), ind.y(), ind.z()),i);
380 old =Kokkos::atomic_exchange(&head3(ind.x(), ind.y(), ind.z()),i);
382 old =Kokkos::atomic_exchange(&head4(ind.x(), ind.y(), ind.z()),i);
384 old =Kokkos::atomic_exchange(&head5(ind.x(), ind.y(), ind.z()),i);
386 old =Kokkos::atomic_exchange(&head6(ind.x(), ind.y(), ind.z()),i);
407 auto const sizeRatio = 0.999*
nbsLevels_[0].sizeRatio();
413 Kokkos::parallel_for(
414 "NBSLevels::findParticleLevel",
418 for(
int8 lvl = 0; lvl<maxLvl; lvl++)
420 if( sizeRatio*diameter[i]<= maxSizes[lvl] )
422 particleLevel[i] = lvl;
426 particleLevel[i] =
static_cast<int8>(-1);