cellsWallLevels.hpp
Go to the documentation of this file.
1 /*------------------------------- phasicFlow ---------------------------------
2  O C enter of
3  O O E ngineering and
4  O O M ultiscale modeling of
5  OOOOOOO F luid flow
6 ------------------------------------------------------------------------------
7  Copyright (C): www.cemf.ir
8  email: hamid.r.norouzi AT gmail.com
9 ------------------------------------------------------------------------------
10 Licence:
11  This file is part of phasicFlow code. It is a free software for simulating
12  granular and multiphase flows. You can redistribute it and/or modify it under
13  the terms of GNU General Public License v3 or any other later versions.
14 
15  phasicFlow is distributed to help others in their research in the field of
16  granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
17  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 
19 -----------------------------------------------------------------------------*/
20 
21 #ifndef __cellsWallLevels_hpp__
22 #define __cellsWallLevels_hpp__
23 
24 #include "cellsWallLevel0.hpp"
25 
26 namespace pFlow
27 {
28 
29 template<
30  typename executionSpace
31  >
33 {
34 public:
35 
37 
39 
41 
43 
44  using CellType = typename Cells::CellType;
45 
47 
49 
51 
52 protected:
53 
55 
56 
58 
59 public:
60 
61  TypeInfoNV("cellsWallLevels");
62 
65  int32 numLevels,
66  const Vector<Cells>& cellsLevels,
67  real cellExtent,
68  int32 numPoints,
69  int32 numElements,
70  const ViewType1D<realx3,memory_space>& points,
71  const ViewType1D<int32x3,memory_space>& vertices
72  )
73  :
74  numLevles_(numLevels),
75  cellsWallLevels_("cellsWallLevels",numLevels, numLevels, RESERVE())
76  {
77 
78 
79 
80  for(int32 lvl=0; lvl<numLevles_; lvl++)
81  {
82  cellsWallLevels_[lvl] =
84  cellsLevels[lvl],
85  cellExtent,
86  numPoints,
87  numElements,
88  points,
89  vertices);
90  }
91 
92  }
93 
94 
95  template<typename PairsContainer, typename particleMapType>
96  bool broadSearch(PairsContainer& pairs, particleMapType& particleMap)
97  {
98 
99  // map walls onto the cells
100  for(int32 lvl=0; lvl<numLevles_; lvl++)
101  {
102  cellsWallLevels_[lvl].build();
103  }
104 
105  this->particleWallFindPairs(pairs, particleMap);
106 
107  return true;
108  }
109 
110  template<typename PairsContainer, typename particleMapType>
111  bool particleWallFindPairs(PairsContainer& pairs, particleMapType& particleMap)
112  {
113 
114  int32 getFull = 1;
115 
116  while (getFull)
117  {
118  getFull = 0;
119  for(int32 lvl=0; lvl<numLevles_; lvl++)
120  {
121  getFull +=
122  cellsWallLevels_[lvl].findPairsElementRangeCount(
123  pairs,
124  particleMap.getCellIterator(lvl));
125  }
126 
127  if(getFull)
128  {
129  // - resize the container
130  // note that getFull now shows the number of failed insertions.
131  uint32 len = max(getFull, 5000);
132  auto oldCap = pairs.capacity();
133  pairs.increaseCapacityBy(len);
134 
135  INFORMATION<<"Contact pair container capacity increased from "<<
136  oldCap << " to "
137  << pairs.capacity() <<" in cellsWallLevels."<<endINFO;
138 
139  Kokkos::fence();
140  }
141  }
142 
143  return true;
144  }
145 
146 
147 }; // cellsWallLevels
148 
149 } // pFlow
150 
151 
152 #endif // __cellsWallLevels_hpp__
pFlow::cellsWallLevel0::IndexType
int32 IndexType
Definition: cellsWallLevel0.hpp:45
pFlow::cellsWallLevels::Cells
typename cellsWallLevel0Type::Cells Cells
Definition: cellsWallLevels.hpp:42
pFlow::cellsWallLevels::TypeInfoNV
TypeInfoNV("cellsWallLevels")
pFlow::real
float real
Definition: builtinTypes.hpp:46
pFlow::cellsWallLevels::cellsWallLevels
FUNCTION_H cellsWallLevels(int32 numLevels, const Vector< Cells > &cellsLevels, real cellExtent, int32 numPoints, int32 numElements, const ViewType1D< realx3, memory_space > &points, const ViewType1D< int32x3, memory_space > &vertices)
Definition: cellsWallLevels.hpp:64
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:59
pFlow::cellsWallLevels::numLevles_
int32 numLevles_
Definition: cellsWallLevels.hpp:54
pFlow::cellsWallLevel0::IdType
int32 IdType
Definition: cellsWallLevel0.hpp:43
cellsWallLevel0.hpp
pFlow::cellsWallLevels::cellsWallLevels_
Vector< cellsWallLevel0Type > cellsWallLevels_
Definition: cellsWallLevels.hpp:57
pFlow::cellsWallLevels
Definition: cellsWallLevels.hpp:32
pFlow
Definition: demComponent.hpp:28
FUNCTION_H
#define FUNCTION_H
Definition: pFlowMacros.hpp:58
RESERVE
Definition: Vector.hpp:38
pFlow::cellsWallLevels::cellsWallLevel0Type
cellsWallLevel0< executionSpace > cellsWallLevel0Type
Definition: cellsWallLevels.hpp:36
pFlow::cellsWallLevel0::execution_space
executionSpace execution_space
Definition: cellsWallLevel0.hpp:51
pFlow::cellsWallLevels::IndexType
typename cellsWallLevel0Type::IndexType IndexType
Definition: cellsWallLevels.hpp:40
pFlow::cellsWallLevels::IdType
typename cellsWallLevel0Type::IdType IdType
Definition: cellsWallLevels.hpp:38
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
pFlow::cellsWallLevel0::memory_space
typename execution_space::memory_space memory_space
Definition: cellsWallLevel0.hpp:53
pFlow::max
T max(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:164
pFlow::cellsWallLevels::broadSearch
bool broadSearch(PairsContainer &pairs, particleMapType &particleMap)
Definition: cellsWallLevels.hpp:96
pFlow::cellsWallLevel0::Cells
cells< IndexType > Cells
Definition: cellsWallLevel0.hpp:47
pFlow::cellsWallLevels::memory_space
typename cellsWallLevel0Type::memory_space memory_space
Definition: cellsWallLevels.hpp:48
pFlow::cellsWallLevels::CellType
typename Cells::CellType CellType
Definition: cellsWallLevels.hpp:44
pFlow::ViewType1D
Kokkos::View< T *, properties... > ViewType1D
Definition: KokkosTypes.hpp:62
pFlow::cellsWallLevels::execution_space
typename cellsWallLevel0Type::execution_space execution_space
Definition: cellsWallLevels.hpp:46
pFlow::cellsWallLevel0
Definition: cellsWallLevel0.hpp:37
pFlow::iBox
Definition: iBox.hpp:33
pFlow::Vector
Definition: Vector.hpp:46
endINFO
#define endINFO
Definition: streams.hpp:38
pFlow::cellsWallLevels::particleWallFindPairs
bool particleWallFindPairs(PairsContainer &pairs, particleMapType &particleMap)
Definition: cellsWallLevels.hpp:111
INFORMATION
#define INFORMATION
Definition: streams.hpp:37