# PhasicFlow: utilities/postprocessPhasicFlow/pointRectCell.hpp Source File

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 "mapperNBS.hpp"
#include "rectMeshFields.hpp"
#include "pointStructure.hpp"
namespace pFlow
{
class pointRectCell
{
public:
using mapType = mapperNBS<DefaultHostExecutionSpace>;
using memory_space = typename mapType::memory_space;
protected:
repository& processedRepository_;
rectangleMesh& mesh_;
const pointStructure& pStruct_;
ViewType1D<realx3, memory_space> pointPosition_;
mapType map_;
int32RectMeshField_H nPointInCell_;
public:
pointRectCell(
const dictionary& dictMesh,
const pointStructure& pStruct,
repository& rep)
:
processedRepository_(rep),
mesh_
(
processedRepository_.emplaceObject<rectangleMesh>
(
objectFile
(
"rectMesh",
"",
objectFile::READ_NEVER,
objectFile::WRITE_NEVER
),
dictMesh
)
),
pStruct_(pStruct),
pointPosition_(pStruct_.pointPosition().hostVectorAll()),
map_(
mesh_.domain(),
mesh_.nx(),
mesh_.ny(),
mesh_.nz(),
pointPosition_),
nPointInCell_(mesh_, 0)
{
mapPOints();
}
const auto& mesh()const
{
return mesh_;
}
auto& processedRepository()
{
return processedRepository_;
}
void mapPOints()
{
range activeRange = pStruct_.activeRange();
auto activeMask = pStruct_.activePointsMaskH();
map_.buildCheckInDomain(activeRange, activeMask);
auto iterator = map_.getCellIterator();
for(int32 i=0; i<map_.nx(); i++)
{
for(int32 j=0; j<map_.ny(); j++)
{
for(int32 k=0; k<map_.nz(); k++)
{
int32 res = 0;
int32 n = iterator.start(i,j,k);
while( n>-1)
{
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: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