centerPoint enhanced & DEMsystem modified for id

- center points enhanced to select particle ids based on the particles located in box, sphere and cylinder
- readme.md modified
- DEMsystem is modified to pass id
This commit is contained in:
Hamidreza
2025-05-22 09:37:07 +03:30
parent 832d1fb16b
commit c89a297e6f
10 changed files with 79 additions and 20 deletions

View File

@ -19,7 +19,7 @@ boxRegionPoints::boxRegionPoints
(boxRegion_.maxPoint().y() - boxRegion_.minPoint().y()) *
(boxRegion_.maxPoint().z() - boxRegion_.minPoint().z())
),
diameter_(pow(3 * volume_ / 4.0 / Pi, 1.0 / 3.0)),
diameter_(2 * pow(3 * volume_ / 4.0 / Pi, 1.0 / 3.0)),
selectedPoints_("selectedPoints")
{
}

View File

@ -8,6 +8,8 @@ namespace pFlow::postprocessData
bool centerPointsRegionPoints::selectIds()
{
// check if it is already found the ids of particles
// if not, then find the ids of particles
if(!firstTimeUpdate_) return true;
firstTimeUpdate_ = false;
@ -26,16 +28,20 @@ bool centerPointsRegionPoints::selectIds()
}
}
else
// TODO: this should be corrected to select ids of particles
// that are selected based on the selector (this is visa versa)
{
auto selectorPtr = pStructSelector::create(
selector,
database().pStruct(),
probDict_.subDict(selector+"Info"));
auto selectedPoints = selectorPtr->selectedPoints();
ids_.resize(selectedPoints.size());
ids_.assign(selectedPoints.begin(), selectedPoints.end());
const auto& idField = database().updateFieldUint32(idName_);
ids_.clear();
ids_.reserve(selectedPoints.size());
for( auto& pntIndex: selectedPoints)
{
ids_.push_back(idField[pntIndex]);
}
}
volume_.resize(ids_.size(),1.0);
@ -62,11 +68,12 @@ bool centerPointsRegionPoints::update()
const auto& idField = database().updateFieldUint32(idName_);
selectedPoints_.fill(-1);
for(uint32 i = 0; i < idField.size(); ++i)
for( uint32 j=0; j< ids_.size(); ++j)
{
for( uint32 j=0; j< ids_.size(); ++j)
auto id = ids_[j];
for( uint32 i=0; i< idField.size(); i++)
{
if(idField[i] == ids_[j])
if(idField[i] == id)
{
selectedPoints_[j] = i;
break;