cellMapping.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 __cellMapping_hpp__
22 #define __cellMapping_hpp__
23 
24 #include "cellsWallLevel0.hpp"
25 #include "dictionary.hpp"
26 
27 
28 namespace pFlow
29 {
30 
31 template<
32  typename executionSpace
33  >
35 {
36 public:
37 
39 
41 
43 
45 
46  using CellType = typename Cells::CellType;
47 
49 
51 
53 
54 
55 protected:
56 
57  // - update frequency
59 
61 
63 
65  bool performedSearch_ = false;
66 
68 
69 private:
70 
72  {
74  {
75  currentIter_++;
76  return true;
77 
78  }else
79  {
80  currentIter_++;
81  return false;
82  }
83  }
84 
85 public:
86 
87  TypeInfoNV("cellMapping");
88 
90  const dictionary& dict,
91  int32 numLevels,
92  const Vector<Cells>& ppCells,
93  int32 numPoints,
94  int32 numElements,
95  const ViewType1D<realx3,memory_space>& points,
96  const ViewType1D<int32x3,memory_space>& vertices
97  )
98  :
100  max(
101  dict.getValOrSet<int32>(
102  "updateFrequency",
103  1),
104  1)),
105  cellExtent_(
106  max(
107  dict.getValOrSet<real>(
108  "cellExtent",
109  0.5),
110  0.5)),
112  ppCells[0],
113  cellExtent_,
114  numPoints,
115  numElements,
116  points,
117  vertices
118  )
119  {}
120 
121 
122  bool enterBoadSearch()const
123  {
124  return currentIter_%updateFrequency_==0;
125  }
126 
127  bool performedSearch()const
128  {
129  return performedSearch_;
130  }
131 
132  template<typename PairsContainer, typename particleMapType>
133  bool broadSearch(PairsContainer& pairs, particleMapType& particleMap, bool force=false)
134  {
135  if(force) currentIter_ = 0;
136  performedSearch_= false;
137  if(!performSearch())return true;
138 
139  cellsWallLevle_.broadSearch(pairs, particleMap);
140 
141  performedSearch_ = true;
142  return true;
143  }
144 
145 }; // cellMapping
146 
147 } // pFlow
148 
149 
150 #endif
pFlow::cellsWallLevel0::IndexType
int32 IndexType
Definition: cellsWallLevel0.hpp:45
pFlow::cellMapping::performedSearch_
bool performedSearch_
a broad search has been occured during last pass?
Definition: cellMapping.hpp:65
pFlow::cellMapping::updateFrequency_
int32 updateFrequency_
Definition: cellMapping.hpp:58
pFlow::real
float real
Definition: builtinTypes.hpp:46
pFlow::cellsWallLevel0::broadSearch
bool broadSearch(PairsContainer &pairs, particleMapType &particleMap)
Definition: cellsWallLevel0.hpp:159
pFlow::cellMapping::cellsWallLevle_
cellsWallLevel0Type cellsWallLevle_
Definition: cellMapping.hpp:67
pFlow::cellMapping::CellType
typename Cells::CellType CellType
Definition: cellMapping.hpp:46
pFlow::cellsWallLevel0::IdType
int32 IdType
Definition: cellsWallLevel0.hpp:43
cellsWallLevel0.hpp
pFlow::cellMapping::cellMapping
cellMapping(const dictionary &dict, int32 numLevels, const Vector< Cells > &ppCells, int32 numPoints, int32 numElements, const ViewType1D< realx3, memory_space > &points, const ViewType1D< int32x3, memory_space > &vertices)
Definition: cellMapping.hpp:89
pFlow::cellMapping::TypeInfoNV
TypeInfoNV("cellMapping")
pFlow
Definition: demComponent.hpp:28
pFlow::cellMapping::performSearch
bool performSearch()
Definition: cellMapping.hpp:71
pFlow::cellMapping::broadSearch
bool broadSearch(PairsContainer &pairs, particleMapType &particleMap, bool force=false)
Definition: cellMapping.hpp:133
pFlow::cellMapping::enterBoadSearch
bool enterBoadSearch() const
Definition: cellMapping.hpp:122
pFlow::cellsWallLevel0::execution_space
executionSpace execution_space
Definition: cellsWallLevel0.hpp:51
pFlow::cellMapping::IdType
typename cellsWallLevel0Type::IdType IdType
Definition: cellMapping.hpp:40
pFlow::cellMapping
Definition: cellMapping.hpp:34
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
pFlow::cellsWallLevel0::memory_space
typename execution_space::memory_space memory_space
Definition: cellsWallLevel0.hpp:53
pFlow::cellMapping::cellExtent_
real cellExtent_
Definition: cellMapping.hpp:60
dictionary.hpp
pFlow::cellMapping::currentIter_
int32 currentIter_
Definition: cellMapping.hpp:62
pFlow::max
T max(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:164
pFlow::cellMapping::IndexType
typename cellsWallLevel0Type::IndexType IndexType
Definition: cellMapping.hpp:42
pFlow::cellsWallLevel0::Cells
cells< IndexType > Cells
Definition: cellsWallLevel0.hpp:47
pFlow::cellMapping::execution_space
typename cellsWallLevel0Type::execution_space execution_space
Definition: cellMapping.hpp:48
pFlow::cellMapping::Cells
typename cellsWallLevel0Type::Cells Cells
Definition: cellMapping.hpp:44
pFlow::cellMapping::memory_space
typename cellsWallLevel0Type::memory_space memory_space
Definition: cellMapping.hpp:50
pFlow::ViewType1D
Kokkos::View< T *, properties... > ViewType1D
Definition: KokkosTypes.hpp:62
pFlow::cellsWallLevel0
Definition: cellsWallLevel0.hpp:37
pFlow::iBox
Definition: iBox.hpp:33
pFlow::cellMapping::performedSearch
bool performedSearch() const
Definition: cellMapping.hpp:127
pFlow::Vector
Definition: Vector.hpp:46
pFlow::dictionary
Definition: dictionary.hpp:38