pointRectCell.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 __pointRectCell_hpp__
22 #define __pointRectCell_hpp__
23 
24 #include "mapperNBS.hpp"
25 #include "rectMeshFields.hpp"
26 #include "pointStructure.hpp"
27 
28 namespace pFlow
29 {
30 
31 
33 {
34 public:
35 
37 
39 
40 protected:
41 
43 
45 
46 
48 
50 
52 
54 
55 public:
56 
58  const dictionary& dictMesh,
59  const pointStructure& pStruct,
60  repository& rep)
61  :
63  mesh_
64  (
65  processedRepository_.emplaceObject<rectangleMesh>
66  (
68  (
69  "rectMesh",
70  "",
71  objectFile::READ_NEVER,
72  objectFile::WRITE_NEVER
73  ),
74  dictMesh
75  )
76  ),
78  pointPosition_(pStruct_.pointPosition().hostVectorAll()),
79  map_(
80  mesh_.domain(),
81  mesh_.nx(),
82  mesh_.ny(),
83  mesh_.nz(),
86  {
87 
88  mapPOints();
89  }
90 
91  const auto& mesh()const
92  {
93  return mesh_;
94  }
95 
97  {
98  return processedRepository_;
99  }
100 
101  void mapPOints()
102  {
103  range activeRange = pStruct_.activeRange();
104  auto activeMask = pStruct_.activePointsMaskH();
105 
106 
107  map_.buildCheckInDomain(activeRange, activeMask);
108 
109  auto iterator = map_.getCellIterator();
110 
111 
112  for(int32 i=0; i<map_.nx(); i++)
113  {
114  for(int32 j=0; j<map_.ny(); j++)
115  {
116  for(int32 k=0; k<map_.nz(); k++)
117  {
118 
119  int32 res = 0;
120  int32 n = iterator.start(i,j,k);
121  while( n>-1)
122  {
123  res+=1;
124  n = iterator.getNext(n);
125  }
126  nPointInCell_(i,j,k) = res;
127 
128  }
129  }
130  }
131 
132  }
133 
134  auto getCellIterator()const
135  {
136  return map_.getCellIterator();
137  }
138 
140  {
141  return nPointInCell_(i,j,k);
142  }
143 
144  //auto
145 };
146 
147 }
148 
149 #endif // __pointRectCell_hpp__
pFlow::pointRectCell::pStruct_
const pointStructure & pStruct_
Definition: pointRectCell.hpp:47
pFlow::cells::nz
INLINE_FUNCTION_HD indexType nz() const
Definition: cells.hpp:139
mapperNBS.hpp
pFlow::pointRectCell::mapPOints
void mapPOints()
Definition: pointRectCell.hpp:101
pFlow::pointStructure::activePointsMaskH
activePointsHost activePointsMaskH() const
Definition: pointStructure.hpp:241
pFlow::rectMeshField< int32, HostSpace >
pFlow::pointStructure::activeRange
INLINE_FUNCTION_H range activeRange() const
Definition: pointStructure.hpp:281
pFlow::pointRectCell::getCellIterator
auto getCellIterator() const
Definition: pointRectCell.hpp:134
pFlow::cells::nx
INLINE_FUNCTION_HD indexType nx() const
Definition: cells.hpp:127
pFlow::rectangleMesh
Definition: rectangleMesh.hpp:31
pFlow::pointRectCell::processedRepository
auto & processedRepository()
Definition: pointRectCell.hpp:96
pFlow::mapperNBS< DefaultHostExecutionSpace >
pFlow
Definition: demComponent.hpp:28
pFlow::pointRectCell::mesh_
rectangleMesh & mesh_
Definition: pointRectCell.hpp:44
pFlow::mapperNBS::buildCheckInDomain
INLINE_FUNCTION_H void buildCheckInDomain(range activeRange)
Definition: mapperNBS.hpp:329
pFlow::pointStructure
Definition: pointStructure.hpp:44
n
int32 n
Definition: NBSCrossLoop.hpp:24
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
pFlow::pointRectCell::processedRepository_
repository & processedRepository_
Definition: pointRectCell.hpp:42
pFlow::pointRectCell
Definition: pointRectCell.hpp:32
pFlow::pointRectCell::map_
mapType map_
Definition: pointRectCell.hpp:51
pFlow::pointRectCell::nPointInCell
int32 nPointInCell(int32 i, int32 j, int32 k) const
Definition: pointRectCell.hpp:139
rectMeshFields.hpp
pFlow::objectFile
Definition: objectFile.hpp:33
pStruct
auto & pStruct
Definition: setPointStructure.hpp:24
pFlow::pointRectCell::mesh
const auto & mesh() const
Definition: pointRectCell.hpp:91
pFlow::cells::ny
INLINE_FUNCTION_HD indexType ny() const
Definition: cells.hpp:133
pFlow::ViewType1D
Kokkos::View< T *, properties... > ViewType1D
Definition: KokkosTypes.hpp:62
pFlow::pointRectCell::nPointInCell_
int32RectMeshField_H nPointInCell_
Definition: pointRectCell.hpp:53
pFlow::repository
Definition: repository.hpp:34
pFlow::pointRectCell::memory_space
typename mapType::memory_space memory_space
Definition: pointRectCell.hpp:38
pFlow::mapperNBS< DefaultHostExecutionSpace >::memory_space
typename execution_space::memory_space memory_space
Definition: mapperNBS.hpp:50
pointStructure.hpp
pFlow::range
kPair< int, int > range
Definition: KokkosTypes.hpp:54
pFlow::mapperNBS::getCellIterator
cellIterator getCellIterator() const
Definition: mapperNBS.hpp:219
pFlow::dictionary
Definition: dictionary.hpp:38
pFlow::pointRectCell::pointPosition_
ViewType1D< realx3, memory_space > pointPosition_
Definition: pointRectCell.hpp:49
pFlow::pointRectCell::pointRectCell
pointRectCell(const dictionary &dictMesh, const pointStructure &pStruct, repository &rep)
Definition: pointRectCell.hpp:57