# PhasicFlow: src/Interaction/contactSearch/wallMappings/cellsWallLevels.hpp Source File

cellsWallLevels.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 __cellsWallLevels_hpp__
#define __cellsWallLevels_hpp__
#include "cellsWallLevel0.hpp"
namespace pFlow
{
template<
typename executionSpace
>
class cellsWallLevels
{
public:
using cellsWallLevel0Type = cellsWallLevel0<executionSpace>;
using IdType = typename cellsWallLevel0Type::IdType;
using IndexType = typename cellsWallLevel0Type::IndexType;
using Cells = typename cellsWallLevel0Type::Cells;
using CellType = typename Cells::CellType;
using execution_space = typename cellsWallLevel0Type::execution_space;
using memory_space = typename cellsWallLevel0Type::memory_space;
using iBoxType = iBox<IndexType>;
protected:
int32 numLevles_=1;
Vector<cellsWallLevel0Type> cellsWallLevels_;
public:
TypeInfoNV("cellsWallLevels");
FUNCTION_H
cellsWallLevels(
int32 numLevels,
const Vector<Cells>& cellsLevels,
real cellExtent,
int32 numPoints,
int32 numElements,
const ViewType1D<realx3,memory_space>& points,
const ViewType1D<int32x3,memory_space>& vertices
)
:
numLevles_(numLevels),
cellsWallLevels_("cellsWallLevels",numLevels, numLevels, RESERVE())
{
for(int32 lvl=0; lvl<numLevles_; lvl++)
{
cellsWallLevels_[lvl] =
cellsWallLevel0Type(
cellsLevels[lvl],
cellExtent,
numPoints,
numElements,
points,
vertices);
}
}
template<typename PairsContainer, typename particleMapType>
bool broadSearch(PairsContainer& pairs, particleMapType& particleMap)
{
// map walls onto the cells
for(int32 lvl=0; lvl<numLevles_; lvl++)
{
cellsWallLevels_[lvl].build();
}
this->particleWallFindPairs(pairs, particleMap);
return true;
}
template<typename PairsContainer, typename particleMapType>
bool particleWallFindPairs(PairsContainer& pairs, particleMapType& particleMap)
{
int32 getFull = 1;
while (getFull)
{
getFull = 0;
for(int32 lvl=0; lvl<numLevles_; lvl++)
{
getFull +=
cellsWallLevels_[lvl].findPairsElementRangeCount(
pairs,
particleMap.getCellIterator(lvl));
}
if(getFull)
{
// - resize the container
// note that getFull now shows the number of failed insertions.
uint32 len = max(getFull, 5000);
auto oldCap = pairs.capacity();
pairs.increaseCapacityBy(len);
INFORMATION<<"Contact pair container capacity increased from "<<
oldCap << " to "
<< pairs.capacity() <<" in cellsWallLevels."<<endINFO;
Kokkos::fence();
}
}
return true;
}
}; // cellsWallLevels
} // pFlow
#endif // __cellsWallLevels_hpp__
pFlow::cellsWallLevel0::IndexType
int32 IndexType
Definition: cellsWallLevel0.hpp:45
pFlow::cellsWallLevels::Cells
typename cellsWallLevel0Type::Cells Cells
Definition: cellsWallLevels.hpp:42
pFlow::cellsWallLevels::TypeInfoNV
TypeInfoNV("cellsWallLevels")
pFlow::real
float real
Definition: builtinTypes.hpp:46
pFlow::cellsWallLevels::cellsWallLevels
FUNCTION_H cellsWallLevels(int32 numLevels, const Vector< Cells > &cellsLevels, real cellExtent, int32 numPoints, int32 numElements, const ViewType1D< realx3, memory_space > &points, const ViewType1D< int32x3, memory_space > &vertices)
Definition: cellsWallLevels.hpp:64
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:59
pFlow::cellsWallLevels::numLevles_
int32 numLevles_
Definition: cellsWallLevels.hpp:54
pFlow::cellsWallLevel0::IdType
int32 IdType
Definition: cellsWallLevel0.hpp:43
cellsWallLevel0.hpp
pFlow::cellsWallLevels::cellsWallLevels_
Vector< cellsWallLevel0Type > cellsWallLevels_
Definition: cellsWallLevels.hpp:57
pFlow::cellsWallLevels
Definition: cellsWallLevels.hpp:32
pFlow
Definition: demComponent.hpp:28
FUNCTION_H
#define FUNCTION_H
Definition: pFlowMacros.hpp:58
RESERVE
Definition: Vector.hpp:38
pFlow::cellsWallLevels::cellsWallLevel0Type
cellsWallLevel0< executionSpace > cellsWallLevel0Type
Definition: cellsWallLevels.hpp:36
pFlow::cellsWallLevel0::execution_space
executionSpace execution_space
Definition: cellsWallLevel0.hpp:51
pFlow::cellsWallLevels::IndexType
typename cellsWallLevel0Type::IndexType IndexType
Definition: cellsWallLevels.hpp:40
pFlow::cellsWallLevels::IdType
typename cellsWallLevel0Type::IdType IdType
Definition: cellsWallLevels.hpp:38
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
pFlow::cellsWallLevel0::memory_space
typename execution_space::memory_space memory_space
Definition: cellsWallLevel0.hpp:53
pFlow::max
T max(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:164
pFlow::cellsWallLevels::broadSearch
bool broadSearch(PairsContainer &pairs, particleMapType &particleMap)
Definition: cellsWallLevels.hpp:96
pFlow::cellsWallLevel0::Cells
cells< IndexType > Cells
Definition: cellsWallLevel0.hpp:47
pFlow::cellsWallLevels::memory_space
typename cellsWallLevel0Type::memory_space memory_space
Definition: cellsWallLevels.hpp:48
pFlow::cellsWallLevels::CellType
typename Cells::CellType CellType
Definition: cellsWallLevels.hpp:44
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::cellsWallLevel0
Definition: cellsWallLevel0.hpp:37
pFlow::iBox
Definition: iBox.hpp:33
pFlow::Vector
Definition: Vector.hpp:46
endINFO
#define endINFO
Definition: streams.hpp:38
pFlow::cellsWallLevels::particleWallFindPairs
bool particleWallFindPairs(PairsContainer &pairs, particleMapType &particleMap)
Definition: cellsWallLevels.hpp:111
INFORMATION
#define INFORMATION
Definition: streams.hpp:37