# PhasicFlow: src/phasicFlow/structuredData/boundaries/boundaryExit/boundaryExit.cpp 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.

boundaryExit.cpp
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.
-----------------------------------------------------------------------------*/
#include "boundaryExit.hpp"
#include "internalPoints.hpp"
#include "dictionary.hpp"
pFlow::boundaryExit::boundaryExit
(
const dictionary &dict,
const plane &bplane,
internalPoints &internal,
boundaryList &bndrs,
uint32 thisIndex
)
:
boundaryBase(dict, bplane, internal, bndrs, thisIndex)
{
exitMarginLength_ = max(
dict.getValOrSet("exitMarginLength",(real)0.0), (real)0.0);
checkForExitInterval_ = max(
dict.getValOrSet("checkForExitInterval", 1), 1);
}
bool pFlow::boundaryExit::beforeIteration
(
uint32 step,
const timeInfo& ti,
bool updateIter,
bool iterBeforeUpdate ,
bool& callAgain
)
{
if(step == 1)
{
boundaryBase::beforeIteration(step, ti, updateIter, iterBeforeUpdate, callAgain);
callAgain = true;
return true;
}
else if(step == 2 )
{
callAgain = false;
if( !performBoundarytUpdate())
{
return true;
}
// nothing have to be done
if(empty())
{
return true;
}
uint32 s = size();
uint32Vector_D deleteFlags("deleteFlags",s+1, s+1, RESERVE());
deleteFlags.fill(0u);
const auto& deleteD = deleteFlags.deviceViewAll();
auto points = thisPoints();
auto p = boundaryPlane().infPlane();
uint32 numDeleted = 0;
Kokkos::parallel_reduce
(
"boundaryExit::beforeIteration",
deviceRPolicyStatic(0,s),
LAMBDA_HD(uint32 i, uint32& delToUpdate)
{
if(p.pointInNegativeSide(points(i)))
{
deleteD(i)=1;
delToUpdate++;
}
},
numDeleted
);
// no point is deleted
if(numDeleted == 0 )
{
return true;
}
return this->removeIndices(numDeleted, deleteFlags);
}
return true;
}
bool pFlow::boundaryExit::iterate(const timeInfo& ti)
{
return true;
}
bool pFlow::boundaryExit::afterIteration(const timeInfo& ti)
{
return true;
}
pFlow::VectorSingle::fill
INLINE_FUNCTION_H void fill(const T &val)
Fill the range [0,size) with val.
Definition: VectorSingle.cpp:365
pFlow::dictionary::getValOrSet
T getValOrSet(const word &keyword, const T &setVal) const
get the value of data entry or if not found, set the value to setVal
Definition: dictionary.hpp:415
pFlow::internalPoints
Definition: internalPoints.hpp:38
pFlow::real
float real
Definition: builtinTypes.hpp:45
pFlow::plane
Definition: plane.hpp:30
pFlow::empty
Definition: empty.hpp:30
pFlow::boundaryExit::afterIteration
bool afterIteration(const timeInfo &ti) final
Definition: boundaryExit.cpp:118
pFlow::algorithms::KOKKOS::max
INLINE_FUNCTION_H Type max(const Type *first, uint32 numElems)
Definition: kokkosAlgorithms.hpp:104
pFlow::boundaryExit::beforeIteration
bool beforeIteration(uint32 step, const timeInfo &ti, bool updateIter, bool iterBeforeUpdate, bool &callAgain) final
Definition: boundaryExit.cpp:44
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
boundaryExit.hpp
pFlow::boundaryList
Definition: boundaryList.hpp:35
pFlow::timeInfo
Definition: timeInfo.hpp:28
RESERVE
Definition: Vector.hpp:40
dictionary.hpp
pFlow::boundaryExit::iterate
bool iterate(const timeInfo &ti) final
Definition: boundaryExit.cpp:113
pFlow::boundaryBase
Definition: boundaryBase.hpp:42
pFlow::VectorSingle< uint32 >
pFlow::VectorSingle::deviceViewAll
INLINE_FUNCTION_H auto & deviceViewAll()
Device view range [0,capcity)
Definition: VectorSingle.cpp:249
LAMBDA_HD
#define LAMBDA_HD
Definition: pFlowMacros.hpp:58
pFlow::deviceRPolicyStatic
Kokkos::RangePolicy< Kokkos::DefaultExecutionSpace, Kokkos::Schedule< Kokkos::Static >, Kokkos::IndexType< pFlow::uint32 > > deviceRPolicyStatic
Definition: KokkosTypes.hpp:66
pFlow::boundaryExit::boundaryExit
boundaryExit(const dictionary &dict, const plane &bplane, internalPoints &internal, boundaryList &bndrs, uint32 thisIndex)
Definition: boundaryExit.cpp:27
internalPoints.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