www.cemf.ir
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 "cellMapper.hpp"
25 #include "rectMeshFields.hpp"
26 #include "pointStructure.hpp"
27 
28 namespace pFlow
29 {
30 
31 
33 {
34 public:
35 
37 
38  //using memory_space = typename mapType::memory_space;
39 
40 protected:
41 
43 
45 
47 
49 
51 
53 
54 public:
55 
57  const dictionary& dictMesh,
58  const pointStructure& pStruct,
59  repository& rep)
60  :
62  mesh_
63  (
64  dictMesh,
65  &rep
66  ),
68  pointPosition_(pStruct_.pointPosition().hostViewAll()),
69  map_
70  (
71  mesh_,
73  pStruct_.activePointsMaskHost()
74  ),
75  nPointInCell_(mesh_,"nPointInCell", 0)
76  {
77 
78  mapPOints();
79  }
80 
81  auto& mesh()
82  {
83  return mesh_;
84  }
85 
86  const auto& mesh()const
87  {
88  return mesh_;
89  }
90 
92  {
93  return processedRepository_;
94  }
95 
96  void mapPOints()
97  {
98  auto points = pStruct_.pointPositionHost();
99  auto activeMask = pStruct_.activePointsMaskHost();
100 
101  map_.build(points, activeMask);
102 
103  auto iterator = map_.getCellIterator();
104 
105  for(int32 i=0; i<mesh_.nx(); i++)
106  {
107  for(int32 j=0; j<mesh_.ny(); j++)
108  {
109  for(int32 k=0; k<mesh_.nz(); k++)
110  {
111 
112  int32 res = 0;
113  uint32 n = iterator.start(i,j,k);
114  while( n!= cellMapper::NoPos)
115  {
116  res+=1;
117  n = iterator.getNext(n);
118  }
119  nPointInCell_(i,j,k) = res;
120 
121  }
122  }
123  }
124 
125  }
126 
127  auto getCellIterator()const
128  {
129  return map_.getCellIterator();
130  }
131 
133  {
134  return nPointInCell_(i,j,k);
135  }
136 
137  //auto
138 };
139 
140 }
141 
142 #endif // __pointRectCell_hpp__
pFlow::pointRectCell::pStruct_
const pointStructure & pStruct_
Definition: pointRectCell.hpp:46
pFlow::pointRectCell::mesh
auto & mesh()
Definition: pointRectCell.hpp:81
pFlow::rectangleMesh::ny
int32 ny() const
Definition: rectangleMesh.hpp:82
pFlow::pointRectCell::mapPOints
void mapPOints()
Definition: pointRectCell.hpp:96
pFlow::internalPoints::pointPositionHost
auto pointPositionHost() const
Definition: internalPoints.hpp:153
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
pFlow::rectMeshField< int32 >
pFlow::pointRectCell::pointPosition_
hostViewType1D< realx3 > pointPosition_
Definition: pointRectCell.hpp:48
pFlow::pointRectCell::getCellIterator
auto getCellIterator() const
Definition: pointRectCell.hpp:127
pFlow::pointRectCell::mesh_
rectangleMesh mesh_
Definition: pointRectCell.hpp:44
pFlow::rectangleMesh
Definition: rectangleMesh.hpp:34
pFlow::pointRectCell::processedRepository
auto & processedRepository()
Definition: pointRectCell.hpp:91
pFlow
Definition: demGeometry.hpp:27
cellMapper.hpp
pFlow::pointStructure
Definition: pointStructure.hpp:34
pFlow::int32
int int32
Definition: builtinTypes.hpp:50
pFlow::pointRectCell::processedRepository_
repository & processedRepository_
Definition: pointRectCell.hpp:42
pFlow::pointRectCell
Definition: pointRectCell.hpp:32
pFlow::pointRectCell::map_
mapType map_
Definition: pointRectCell.hpp:50
pFlow::cellMapper::getCellIterator
auto getCellIterator() const
Definition: cellMapper.hpp:124
pFlow::pointRectCell::nPointInCell
int32 nPointInCell(int32 i, int32 j, int32 k) const
Definition: pointRectCell.hpp:132
pFlow::rectangleMesh::nz
int32 nz() const
Definition: rectangleMesh.hpp:87
rectMeshFields.hpp
pFlow::cellMapper
Definition: cellMapper.hpp:33
pStruct
auto & pStruct
Definition: setPointStructure.hpp:24
pFlow::pointRectCell::mesh
const auto & mesh() const
Definition: pointRectCell.hpp:86
pFlow::hostViewType1D
Kokkos::View< T *, Kokkos::HostSpace > hostViewType1D
1D array (vector with host memeory space)
Definition: KokkosTypes.hpp:136
pFlow::cellMapper::build
bool build(const hostViewType1D< realx3 > &pointPos, const pFlagTypeHost &flags)
Definition: cellMapper.cpp:68
n
uint32 n
Definition: NBSLoop.hpp:24
pFlow::cellMapper::NoPos
static constexpr uint32 NoPos
Definition: cellMapper.hpp:42
pFlow::pointRectCell::nPointInCell_
int32RectMeshField_H nPointInCell_
Definition: pointRectCell.hpp:52
pFlow::repository
Definition: repository.hpp:34
pFlow::internalPoints::activePointsMaskHost
const pFlagTypeHost & activePointsMaskHost() const
Definition: internalPoints.cpp:201
pointStructure.hpp
pFlow::dictionary
Dictionary holds a set of data entries or sub-dictionaries that are enclosed in a curely braces or ar...
Definition: dictionary.hpp:67
pFlow::rectangleMesh::nx
int32 nx() const
Definition: rectangleMesh.hpp:77
pFlow::pointRectCell::pointRectCell
pointRectCell(const dictionary &dictMesh, const pointStructure &pStruct, repository &rep)
Definition: pointRectCell.hpp:56