multiGridMapping.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 __multiGridMapping_hpp__
22 #define __multiGridMapping_hpp__
23 
24 #include "cellsWallLevels.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 
44  using Cells = typename CellsWallLevelType::Cells;
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("multiGridMapping");
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.getVal<int32>("updateFrequency"),
102  1)),
103  cellExtent_(
104  max(
105  dict.getVal<real>("cellExtent"),
106  0.5)),
108  numLevels,
109  ppCells,
110  cellExtent_,
111  numPoints,
112  numElements,
113  points,
114  vertices
115  )
116  {
117 
118  REPORT(3)<<"Multi-grid wall mapping with "<<
119  yellowText(numLevels)<<" levels has been created."<<endREPORT;
120  }
121 
122 
123  bool enterBoadSearch()const
124  {
125  return currentIter_%updateFrequency_==0;
126  }
127 
128  bool performedSearch()const
129  {
130  return performedSearch_;
131  }
132 
133  template<typename PairsContainer, typename particleMapType>
134  bool broadSearch(PairsContainer& pairs, particleMapType& particleMap, bool force=false)
135  {
136  if(force) currentIter_ = 0;
137  performedSearch_= false;
138  if(!performSearch())return true;
139 
140 
141  cellsWallLevle_.broadSearch(pairs, particleMap);
142 
143 
144  performedSearch_ = true;
145  return true;
146  }
147 
148 }; // multiGridMapping
149 
150 } // pFlow
151 
152 
153 #endif
pFlow::cellsWallLevels::Cells
typename cellsWallLevel0Type::Cells Cells
Definition: cellsWallLevels.hpp:42
pFlow::multiGridMapping::performSearch
bool performSearch()
Definition: multiGridMapping.hpp:71
endREPORT
#define endREPORT
Definition: streams.hpp:41
pFlow::multiGridMapping::multiGridMapping
multiGridMapping(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: multiGridMapping.hpp:89
pFlow::real
float real
Definition: builtinTypes.hpp:46
pFlow::multiGridMapping::execution_space
typename CellsWallLevelType::execution_space execution_space
Definition: multiGridMapping.hpp:48
REPORT
#define REPORT(n)
Definition: streams.hpp:40
pFlow::multiGridMapping::CellType
typename Cells::CellType CellType
Definition: multiGridMapping.hpp:46
pFlow::multiGridMapping::updateFrequency_
int32 updateFrequency_
Definition: multiGridMapping.hpp:58
pFlow::multiGridMapping::performedSearch_
bool performedSearch_
a broad search has been occured during last pass?
Definition: multiGridMapping.hpp:65
pFlow::multiGridMapping::IndexType
typename CellsWallLevelType::IndexType IndexType
Definition: multiGridMapping.hpp:42
pFlow::multiGridMapping::TypeInfoNV
TypeInfoNV("multiGridMapping")
pFlow::cellsWallLevels
Definition: cellsWallLevels.hpp:32
pFlow::multiGridMapping::cellsWallLevle_
CellsWallLevelType cellsWallLevle_
Definition: multiGridMapping.hpp:67
pFlow
Definition: demComponent.hpp:28
pFlow::multiGridMapping::performedSearch
bool performedSearch() const
Definition: multiGridMapping.hpp:128
cellsWallLevels.hpp
pFlow::cellsWallLevels::IndexType
typename cellsWallLevel0Type::IndexType IndexType
Definition: cellsWallLevels.hpp:40
pFlow::cellsWallLevels::IdType
typename cellsWallLevel0Type::IdType IdType
Definition: cellsWallLevels.hpp:38
pFlow::multiGridMapping::currentIter_
int32 currentIter_
Definition: multiGridMapping.hpp:62
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
pFlow::multiGridMapping::cellExtent_
real cellExtent_
Definition: multiGridMapping.hpp:60
dictionary.hpp
pFlow::multiGridMapping::IdType
typename CellsWallLevelType::IdType IdType
Definition: multiGridMapping.hpp:40
pFlow::multiGridMapping::Cells
typename CellsWallLevelType::Cells Cells
Definition: multiGridMapping.hpp:44
pFlow::max
T max(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:164
pFlow::multiGridMapping::memory_space
typename CellsWallLevelType::memory_space memory_space
Definition: multiGridMapping.hpp:50
pFlow::cellsWallLevels::broadSearch
bool broadSearch(PairsContainer &pairs, particleMapType &particleMap)
Definition: cellsWallLevels.hpp:96
pFlow::cellsWallLevels::memory_space
typename cellsWallLevel0Type::memory_space memory_space
Definition: cellsWallLevels.hpp:48
pFlow::multiGridMapping::enterBoadSearch
bool enterBoadSearch() const
Definition: multiGridMapping.hpp:123
pFlow::multiGridMapping
Definition: multiGridMapping.hpp:34
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::multiGridMapping::broadSearch
bool broadSearch(PairsContainer &pairs, particleMapType &particleMap, bool force=false)
Definition: multiGridMapping.hpp:134
pFlow::iBox
Definition: iBox.hpp:33
yellowText
#define yellowText(text)
Definition: streams.hpp:30
pFlow::Vector
Definition: Vector.hpp:46
pFlow::dictionary
Definition: dictionary.hpp:38