bug fix for particle insertion and id handling

This commit is contained in:
Hamidreza Norouzi
2023-04-02 23:34:37 -07:00
parent 60ed8eb2b7
commit 651c74313c
9 changed files with 88 additions and 52 deletions

View File

@ -32,39 +32,8 @@ class particleIdHandler
protected:
int32 nextId_=0;
public:
particleIdHandler(int32PointField_HD & id)
{
int32 maxID = maxActive<DeviceSide>(id);
if( maxID != -1 && id.size() == 0 )
{
nextId_ = 0;
}
else if( maxID == -1 && id.size()>0 )
{
nextId_ = 0;
id.modifyOnHost();
ForAll(i,id)
{
if(id.isActive(i))
{
id[i] = getNextId();
}
}
id.syncViews();
}
else if( maxID >= static_cast<int32>(id.size()) )
{
nextId_ = maxID + 1;
}
else
{
nextId_ = id.size();
}
}
particleIdHandler(int32PointField_HD & id);
int32 getNextId()
{
return nextId_++;