# PhasicFlow: src/Particles/particles/regularParticleIdHandler/regularParticleIdHandler.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.

regularParticleIdHandler.cpp
Go to the documentation of this file.
#include "regularParticleIdHandler.hpp"
pFlow::regularParticleIdHandler::regularParticleIdHandler
(
pointStructure& pStruct
)
:
particleIdHandler(pStruct)
{
initialIdCheck();
}
pFlow::Pair<pFlow::uint32, pFlow::uint32>
pFlow::regularParticleIdHandler::getIdRange(uint32 nNewParticles)
{
if(nNewParticles==0) return {0,0};
uint32 startId;
if(maxId_== static_cast< uint32 >(-1))
{
startId = 0;
}
else
{
startId = maxId_+1;
}
uint32 endId = startId+nNewParticles-1;
maxId_ = endId;
return {startId, endId};
}
bool pFlow::regularParticleIdHandler::initialIdCheck()
{
if( pStruct().empty() ) return true;
uint32 maxId = max( *this );
if(maxId == static_cast< uint32 >(-1))
{
fillSequence(*this,0u);
maxId_ = size()-1;
}
else
{
maxId_ = maxId;
}
return true;
}
pFlow::regularParticleIdHandler::regularParticleIdHandler
regularParticleIdHandler(pointStructure &pStruct)
Definition: regularParticleIdHandler.cpp:6
pFlow::empty
Definition: empty.hpp:30
pFlow::Pair
Kokkos::pair< T1, T2 > Pair
Pair of two variables.
Definition: KokkosTypes.hpp:85
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
pFlow::particleIdHandler
Definition: particleIdHandler.hpp:30
pFlow::regularParticleIdHandler::initialIdCheck
bool initialIdCheck() override
Definition: regularParticleIdHandler.cpp:35
pFlow::max
T max(const internalField< T, MemorySpace > &iField)
Definition: internalFieldAlgorithms.hpp:79
pFlow::regularParticleIdHandler::getIdRange
Pair< uint32, uint32 > getIdRange(uint32 nNewParticles) override
Definition: regularParticleIdHandler.cpp:16
pFlow::regularParticleIdHandler::maxId_
uint32 maxId_
Definition: regularParticleIdHandler.hpp:34
regularParticleIdHandler.hpp
pFlow::pointStructure
Definition: pointStructure.hpp:34
pStruct
auto & pStruct
Definition: setPointStructure.hpp:24
pFlow::fillSequence
void fillSequence(internalField< T, MemorySpace > &iField, const T &startVal)
Definition: internalFieldAlgorithms.hpp:198