# PhasicFlow: src/Interaction/contactSearch/methods/cellBased/NBS/NBS.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.

NBS.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 __NBS_hpp__
#define __NBS_hpp__
#include "particleWallContactSearchs.hpp"
#include "NBSLevel0.hpp"
#include "cellsWallLevel0.hpp"
#include "Vector.hpp"
namespace pFlow
{
class NBS
:
public particleWallContactSearchs<NBS>
{
public:
using CellIterator = typename NBSLevel0::CellIterator;
private:
real sizeRatio_ = 1.0;
real cellExtent_ = 0.5;
Logical adjustableBox_;
NBSLevel0 NBSLevel0_;
cellsWallLevel0 cellsWallLevel0_;
protected:
friend particleWallContactSearchs<NBS>;
bool impl_broadSearch
(
csPairContainerType& ppPairs,
csPairContainerType& pwPairs,
const deviceViewType1D<realx3>& pointPos,
const pFlagTypeDevice& flags,
const deviceViewType1D<real>& diameter
)
{
bool searchBoxChanged;
if( !NBSLevel0_.broadSearch(
ppPairs,
pointPos,
flags,
diameter,
searchBoxChanged))
{
fatalErrorInFunction<<
"Error in broadSearch for NBS (particle-particle)"<<endl;
return false;
}
if(!cellsWallLevel0_.broadSearch(
pwPairs,
NBSLevel0_.getSearchCells(),
NBSLevel0_.getCellIterator(),
pointPos,
diameter,
sizeRatio_))
{
fatalErrorInFunction<<
"Error in broadSearch for NBS (particle-wall)"<<endl;
return false;
}
return true;
}
public:
TypeInfoNV("NBS");
NBS(
const dictionary& dict,
const box& domainBox,
real minBSSize,
real maxBSSize,
const deviceViewType1D<realx3> &position,
const pFlagTypeDevice &flags,
const deviceViewType1D<real> &diam,
uint32 nWallPoints,
uint32 nWallElements,
const ViewType1D<realx3,memory_space>& wallPoints,
const ViewType1D<uint32x3,memory_space>& wallVertices,
const ViewType1D<realx3,memory_space>& wallNormals );
INLINE_FUNCTION_HD
NBS(const NBS&) = default;
INLINE_FUNCTION_HD
NBS(NBS&&) = default;
INLINE_FUNCTION_HD
NBS& operator = (const NBS&) = default;
INLINE_FUNCTION_HD
NBS& operator = (NBS&&) = default;
INLINE_FUNCTION_HD
~NBS()=default;
uint32 numLevels()const
{
return 1;
}
real sizeRatio()const
{
return sizeRatio_;
}
real cellExtent()const
{
return cellExtent_;
}
auto getCellIterator([[maybe_unused]] uint32 lvl)const
{
return NBSLevel0_.getCellIterator();
}
Vector<cells> getDomainCellsLevels()const
{
return Vector<cells>("Cells", 1, NBSLevel0_.getDomainCells());
}
};
}
#endif
pFlow::NBS::impl_broadSearch
bool impl_broadSearch(csPairContainerType &ppPairs, csPairContainerType &pwPairs, const deviceViewType1D< realx3 > &pointPos, const pFlagTypeDevice &flags, const deviceViewType1D< real > &diameter)
Definition: NBS.hpp:59
pFlow::NBS::cellExtent_
real cellExtent_
Definition: NBS.hpp:46
pFlow::NBS::sizeRatio_
real sizeRatio_
Definition: NBS.hpp:44
pFlow::real
float real
Definition: builtinTypes.hpp:45
pFlow::NBSLevel0
Definition: NBSLevel0.hpp:32
pFlow::NBS::sizeRatio
real sizeRatio() const
Definition: NBS.hpp:138
pFlow::particleWallContactSearchs
Definition: particleWallContactSearchs.hpp:31
pFlow::NBSLevel0::broadSearch
bool broadSearch(csPairContainerType &pairs, const deviceViewType1D< realx3 > &pointPos, const pFlagTypeDevice &flags, const deviceViewType1D< real > &diameter, bool &searchBoxChanged)
Definition: NBSLevel0.cpp:94
pFlow::NBS::~NBS
INLINE_FUNCTION_HD ~NBS()=default
pFlow::NBS::adjustableBox_
Logical adjustableBox_
Definition: NBS.hpp:48
NBSLevel0.hpp
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
pFlow::NBS::TypeInfoNV
TypeInfoNV("NBS")
cellsWallLevel0.hpp
pFlow::NBS::CellIterator
typename NBSLevel0::CellIterator CellIterator
Definition: NBS.hpp:40
pFlow::NBS::operator=
INLINE_FUNCTION_HD NBS & operator=(const NBS &)=default
pFlow::endl
iOstream & endl(iOstream &os)
Add newline and flush stream.
Definition: iOstream.hpp:341
pFlow::deviceViewType1D
Kokkos::View< T * > deviceViewType1D
1D array (vector) with default device (memory space and execution space)
Definition: KokkosTypes.hpp:121
pFlow::unsortedPairs
Definition: unsortedPairs.hpp:32
pFlow
Definition: demGeometry.hpp:27
pFlow::mapperNBS::getSearchCells
const auto & getSearchCells() const
Definition: mapperNBS.hpp:160
fatalErrorInFunction
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
Definition: error.hpp:77
pFlow::NBS::getCellIterator
auto getCellIterator([[maybe_unused]] uint32 lvl) const
Definition: NBS.hpp:148
particleWallContactSearchs.hpp
pFlow::NBS::NBSLevel0_
NBSLevel0 NBSLevel0_
Definition: NBS.hpp:50
pFlow::mapperNBS::getDomainCells
const auto & getDomainCells() const
Definition: mapperNBS.hpp:155
pFlow::NBS::NBS
NBS(const dictionary &dict, const box &domainBox, real minBSSize, real maxBSSize, const deviceViewType1D< realx3 > &position, const pFlagTypeDevice &flags, const deviceViewType1D< real > &diam, uint32 nWallPoints, uint32 nWallElements, const ViewType1D< realx3, memory_space > &wallPoints, const ViewType1D< uint32x3, memory_space > &wallVertices, const ViewType1D< realx3, memory_space > &wallNormals)
Definition: NBS.cpp:24
pFlow::NBS
Definition: NBS.hpp:34
pFlow::ViewType1D
Kokkos::View< T *, properties... > ViewType1D
1D veiw as a vector
Definition: KokkosTypes.hpp:93
pFlow::NBS::cellsWallLevel0_
cellsWallLevel0 cellsWallLevel0_
Definition: NBS.hpp:52
pFlow::Logical
Holds a bool value and converts strings to bool.
Definition: Logical.hpp:39
pFlow::NBS::getDomainCellsLevels
Vector< cells > getDomainCellsLevels() const
Definition: NBS.hpp:153
pFlow::NBS::cellExtent
real cellExtent() const
Definition: NBS.hpp:143
pFlow::box
Definition: box.hpp:32
pFlow::mapperNBS::getCellIterator
auto getCellIterator() const
Definition: mapperNBS.hpp:150
pFlow::cellsWallLevel0
Definition: cellsWallLevel0.hpp:34
pFlow::NBS::numLevels
uint32 numLevels() const
Definition: NBS.hpp:133
pFlow::NBSLevel0::CellIterator
typename MapperType::CellIterator CellIterator
Definition: NBSLevel0.hpp:40
INLINE_FUNCTION_HD
#define INLINE_FUNCTION_HD
Definition: pFlowMacros.hpp:55
pFlow::Vector
Definition: Vector.hpp:48
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
Vector.hpp
pFlow::pointFlag< DefaultExecutionSpace >
pFlow::cellsWallLevel0::broadSearch
bool broadSearch(csPairContainerType &pairs, const cells &searchBox, const mapperNBS::CellIterator &particleMap, const deviceViewType1D< realx3 > &pPoints, const deviceViewType1D< real > &pDiams, real sizeRatio)
Definition: cellsWallLevel0.cpp:66