# PhasicFlow: utilities/postprocessPhasicFlow/pointRectCell.hpp Source File
PhasicFlow is an open-source parallel DEM (discrete element method) package for simulating granular flow. It is developed in C++ and can be exectued on both GPU (like CUDA) and CPU.

pointRectCell.hpp
Go to the documentation of this file.
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __pointRectCell_hpp__
#define __pointRectCell_hpp__
#include "cellMapper.hpp"
#include "rectMeshFields.hpp"
#include "pointStructure.hpp"
namespace pFlow
{
class pointRectCell
{
public:
using mapType = cellMapper;
//using memory_space = typename mapType::memory_space;
protected:
repository& processedRepository_;
rectangleMesh mesh_;
const pointStructure& pStruct_;
hostViewType1D<realx3> pointPosition_;
mapType map_;
int32RectMeshField_H nPointInCell_;
public:
pointRectCell(
const dictionary& dictMesh,
const pointStructure& pStruct,
repository& rep)
:
processedRepository_(rep),
mesh_
(
dictMesh,
&rep
),
pStruct_(pStruct),
pointPosition_(pStruct_.pointPosition().hostViewAll()),
map_
(
mesh_,
pointPosition_,
pStruct_.activePointsMaskHost()
),
nPointInCell_(mesh_,"nPointInCell", 0)
{
mapPOints();
}
auto& mesh()
{
return mesh_;
}
const auto& mesh()const
{
return mesh_;
}
auto& processedRepository()
{
return processedRepository_;
}
void mapPOints()
{
auto points = pStruct_.pointPositionHost();
auto activeMask = pStruct_.activePointsMaskHost();
map_.build(points, activeMask);
auto iterator = map_.getCellIterator();
for(int32 i=0; i<mesh_.nx(); i++)
{
for(int32 j=0; j<mesh_.ny(); j++)
{
for(int32 k=0; k<mesh_.nz(); k++)
{
int32 res = 0;
uint32 n = iterator.start(i,j,k);
while( n!= cellMapper::NoPos)
{
res+=1;
n = iterator.getNext(n);
}
nPointInCell_(i,j,k) = res;
}
}
}
}
auto getCellIterator()const
{
return map_.getCellIterator();
}
int32 nPointInCell(int32 i, int32 j, int32 k)const
{
return nPointInCell_(i,j,k);
}
//auto
};
}
#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