structured data has been modified for new changes in version (1.0)

This commit is contained in:
Hamidreza Norouzi 2024-03-24 02:02:48 -07:00
parent 22405db699
commit 6b3a4f017b
19 changed files with 251 additions and 133 deletions

View File

@ -21,57 +21,25 @@ Licence:
#include "boundaryBase.hpp" #include "boundaryBase.hpp"
#include "dictionary.hpp" #include "dictionary.hpp"
#include "internalPoints.hpp" #include "internalPoints.hpp"
#include "anyList.hpp"
#include "Time.hpp"
#include "boundaryBaseKernels.hpp" #include "boundaryBaseKernels.hpp"
/*pFlow::boundaryBase::boundaryBase
(
const plane& bplane,
uint32 mirrorProc,
const word& name,
const word& type,
internalPoints& internal
)
:
subscriber(groupNames(name,type)),
boundaryPlane_(bplane),
name_(name),
type_(type),
mirrorProcessoNo_(mirrorProc),
internal_(internal)
{
}*/
void pFlow::boundaryBase::setNewIndices void pFlow::boundaryBase::setNewIndices
( (
deviceViewType1D<uint32> newIndices const uint32Vector_D& newIndices
) )
{ {
auto newSize = newIndices.size(); indexList_.assign(newIndices, false);
setSize(static_cast<uint32>(newSize));
if(newSize>0u)
{
copy(indexList_.deviceView(), newIndices);
}
} }
void pFlow::boundaryBase::appendNewIndices void pFlow::boundaryBase::appendNewIndices
( (
deviceViewType1D<uint32> newIndices const uint32Vector_D& newIndices
) )
{ {
auto s = static_cast<uint32>(newIndices.size()); indexList_.append(newIndices);
if(s == 0) return;
uint32 oldS = size();
uint32 newSize = oldS + s;
setSize(newSize);
auto appendView = Kokkos::subview(
indexList_.deviceViewAll(),
Kokkos::make_pair<uint32>(oldS, newSize));
copy(appendView, newIndices);
// TODO: notify observers about this change // TODO: notify observers about this change
@ -79,12 +47,10 @@ void pFlow::boundaryBase::appendNewIndices
//sort(indexList_.deviceViewAll(), 0, newSize); //sort(indexList_.deviceViewAll(), 0, newSize);
} }
bool pFlow::boundaryBase::removeIndices bool pFlow::boundaryBase::removeIndices
( (
uint32 numRemove, uint32 numRemove,
deviceViewType1D<uint32> removeMask const uint32Vector_D& removeMask
) )
{ {
if(removeMask.size() != size()+1 ) if(removeMask.size() != size()+1 )
@ -93,12 +59,12 @@ bool pFlow::boundaryBase::removeIndices
return false; return false;
} }
deviceViewType1D<uint32> removeIndices("removeIndices", 1); uint32Vector_D removeIndices("removeIndices");
deviceViewType1D<uint32> keepIndices("keepIndices",1); uint32Vector_D keepIndices("keepIndices");
pFlow::boundaryBaseKernels::createRemoveKeepIndices pFlow::boundaryBaseKernels::createRemoveKeepIndices
( (
indexList_.deviceView(), indexList_,
numRemove, numRemove,
removeMask, removeMask,
removeIndices, removeIndices,
@ -114,15 +80,32 @@ bool pFlow::boundaryBase::removeIndices
setNewIndices(keepIndices); setNewIndices(keepIndices);
//TODO: notify observers about changes anyList aList;
return false; aList.emplaceBack(
message::eventName(message::BNDR_RESET),
std::move(keepIndices));
message msgBndry = message::BNDR_RESET;
uint32 iter = internal_.time().currentIter();
real t = internal_.time().currentTime();
real dt = internal_.time().dt();
if( !this->notify(iter, t, dt, msgBndry, aList) )
{
fatalErrorInFunction<<"Error in notify operation in boundary "<<
name_ <<endl;
return false;
}
return true;
} }
bool pFlow::boundaryBase::transferPoints bool pFlow::boundaryBase::transferPoints
( (
uint32 numTransfer, uint32 numTransfer,
deviceViewType1D<uint32> transferMask, const uint32Vector_D& transferMask,
uint32 transferBoundaryIndex, uint32 transferBoundaryIndex,
realx3 transferVector realx3 transferVector
) )
@ -133,12 +116,12 @@ bool pFlow::boundaryBase::transferPoints
return false; return false;
} }
deviceViewType1D<uint32> transferIndices("transferIndices",1); uint32Vector_D transferIndices("transferIndices");
deviceViewType1D<uint32> keepIndices("keepIndices",1); uint32Vector_D keepIndices("keepIndices");
pFlow::boundaryBaseKernels::createRemoveKeepIndices pFlow::boundaryBaseKernels::createRemoveKeepIndices
( (
indexList_.deviceView(), indexList_,
numTransfer, numTransfer,
transferMask, transferMask,
transferIndices, transferIndices,
@ -150,7 +133,7 @@ bool pFlow::boundaryBase::transferPoints
// first, change the flags in the internalPoints // first, change the flags in the internalPoints
if( !internal_.changePointsFlag( if( !internal_.changePointsFlag(
transferIndices, transferIndices.deviceView(),
transferBoundaryIndex) ) transferBoundaryIndex) )
{ {
return false; return false;
@ -158,7 +141,7 @@ bool pFlow::boundaryBase::transferPoints
// second, change the position of points // second, change the position of points
if(!internal_.changePointsPoisition( if(!internal_.changePointsPoisition(
transferIndices, transferIndices.deviceView(),
transferVector)) transferVector))
{ {
return false; return false;

View File

@ -53,6 +53,10 @@ private:
/// list of particles indices on device /// list of particles indices on device
uint32Vector_D indexList_; uint32Vector_D indexList_;
uint32Vector_H indexListH_;
bool indexSync_ = false;
/// The length defined for creating neighbor list /// The length defined for creating neighbor list
real neighborLength_; real neighborLength_;
@ -67,17 +71,17 @@ private:
protected: protected:
void setNewIndices(deviceViewType1D<uint32> newIndices); void setNewIndices(const uint32Vector_D& newIndices);
void appendNewIndices(deviceViewType1D<uint32> newIndices); void appendNewIndices(const uint32Vector_D& newIndices);
bool removeIndices( bool removeIndices(
uint32 numRemove, uint32 numRemove,
deviceViewType1D<uint32> removeMask); const uint32Vector_D& removeMask);
bool transferPoints( bool transferPoints(
uint32 numTransfer, uint32 numTransfer,
deviceViewType1D<uint32> transferMask, const uint32Vector_D& transferMask,
uint32 transferBoundaryIndex, uint32 transferBoundaryIndex,
realx3 transferVector); realx3 transferVector);
@ -176,10 +180,10 @@ public:
bool beforeIteration(uint32 iterNum, real t, real dt) = 0 ; bool beforeIteration(uint32 iterNum, real t, real dt) = 0 ;
virtual virtual
bool iterate(uint32 iterNum, real t) = 0; bool iterate(uint32 iterNum, real t, real dt) = 0;
virtual virtual
bool afterIteration(uint32 iterNum, real t) = 0; bool afterIteration(uint32 iterNum, real t, real dt) = 0;
const auto& indexList()const const auto& indexList()const

View File

@ -24,16 +24,25 @@ void pFlow::boundaryBaseKernels::createRemoveKeepLists
( (
uint32 numTotal, uint32 numTotal,
uint32 numRemove, uint32 numRemove,
deviceViewType1D<uint32> removeMask, const uint32Vector_D& removeMask,
deviceViewType1D<uint32>& removeList, uint32Vector_D& removeList,
deviceViewType1D<uint32>& keepList uint32Vector_D& keepList
) )
{ {
uint32 numKeep = numTotal - numRemove; uint32 numKeep = numTotal - numRemove;
deviceViewType1D<uint32> rList("rList",numRemove); removeList.reallocate(numRemove,numRemove);
deviceViewType1D<uint32> kList("kList",numKeep); keepList.reallocate(numKeep,numKeep);
exclusiveScan(removeMask, 0u, numTotal+1, removeMask, 0u); auto maskD = removeMask.deviceViewAll();
const auto& removeD = removeList.deviceViewAll();
const auto& keepD = keepList.deviceViewAll();
exclusiveScan(
maskD,
0u,
numTotal+1,
maskD,
0u);
Kokkos::parallel_for Kokkos::parallel_for
( (
@ -41,35 +50,38 @@ void pFlow::boundaryBaseKernels::createRemoveKeepLists
deviceRPolicyStatic(0, numTotal), deviceRPolicyStatic(0, numTotal),
LAMBDA_HD(uint32 i) LAMBDA_HD(uint32 i)
{ {
if(removeMask(i)!= removeMask(i+1)) if(maskD(i)!= maskD(i+1))
rList(removeMask(i)) = i; removeD(maskD(i)) = i;
else else
kList(i-removeMask(i)) = i; keepD(i-maskD(i)) = i;
} }
); );
Kokkos::fence(); Kokkos::fence();
removeList = rList;
keepList = kList;
} }
void pFlow::boundaryBaseKernels::createRemoveKeepIndices void pFlow::boundaryBaseKernels::createRemoveKeepIndices
( (
deviceViewType1D<uint32> indices, const uint32Vector_D& indices,
uint32 numRemove, uint32 numRemove,
deviceViewType1D<uint32> removeMask, const uint32Vector_D& removeMask,
deviceViewType1D<uint32>& removeIndices, uint32Vector_D& removeIndices,
deviceViewType1D<uint32>& keepIndices uint32Vector_D& keepIndices
) )
{ {
uint32 numTotal = indices.size(); uint32 numTotal = indices.size();
uint32 numKeep = numTotal - numRemove; uint32 numKeep = numTotal - numRemove;
deviceViewType1D<uint32> rIndices("rIndices",numRemove);
deviceViewType1D<uint32> kIndices("kIndices",numKeep);
exclusiveScan(removeMask, 0u, numTotal+1, removeMask, 0u); removeIndices.reallocate(numRemove, numRemove);
keepIndices.reallocate(numKeep, numKeep);
auto maskD = removeMask.deviceViewAll();
const auto& removeD = removeIndices.deviceViewAll();
const auto& keepD = keepIndices.deviceViewAll();
const auto& indicesD = indices.deviceViewAll();
exclusiveScan(maskD, 0u, numTotal+1, maskD, 0u);
Kokkos::parallel_for Kokkos::parallel_for
( (
@ -77,14 +89,11 @@ void pFlow::boundaryBaseKernels::createRemoveKeepIndices
deviceRPolicyStatic(0, numTotal), deviceRPolicyStatic(0, numTotal),
LAMBDA_HD(uint32 i) LAMBDA_HD(uint32 i)
{ {
if(removeMask(i)!= removeMask(i+1)) if(maskD(i)!= maskD(i+1))
rIndices(removeMask(i)) = indices(i); removeD(maskD(i)) = indicesD(i);
else else
kIndices(i-removeMask(i)) = indices(i); keepD(i-maskD(i)) = indicesD(i);
} }
); );
Kokkos::fence(); Kokkos::fence();
removeIndices = rIndices;
keepIndices = kIndices;
} }

View File

@ -21,7 +21,7 @@ Licence:
#ifndef __boundaryBaseKernels_hpp__ #ifndef __boundaryBaseKernels_hpp__
#define __boundaryBaseKernels_hpp__ #define __boundaryBaseKernels_hpp__
#include "phasicFlowKokkos.hpp" #include "VectorSingles.hpp"
namespace pFlow::boundaryBaseKernels namespace pFlow::boundaryBaseKernels
{ {
@ -29,16 +29,16 @@ namespace pFlow::boundaryBaseKernels
void createRemoveKeepLists( void createRemoveKeepLists(
uint32 numTotal, uint32 numTotal,
uint32 numRemove, uint32 numRemove,
deviceViewType1D<uint32> removeMask, const uint32Vector_D& removeMask,
deviceViewType1D<uint32>& removeList, uint32Vector_D& removeList,
deviceViewType1D<uint32>& keepList); uint32Vector_D& keepList);
void createRemoveKeepIndices( void createRemoveKeepIndices(
deviceViewType1D<uint32> indices, const uint32Vector_D& indices,
uint32 numRemove, uint32 numRemove,
deviceViewType1D<uint32> removeMask, const uint32Vector_D& removeMask,
deviceViewType1D<uint32>& removeIndices, uint32Vector_D& removeIndices,
deviceViewType1D<uint32>& keepIndices); uint32Vector_D& keepIndices);
} }

View File

@ -33,7 +33,7 @@ pFlow::boundaryExit::boundaryExit
boundaryBase(dict, bplane, internal) boundaryBase(dict, bplane, internal)
{ {
exitMarginLength_ = max( exitMarginLength_ = max(
dict.getValOrSet("exitMarginLength",0.0), 0.0); dict.getValOrSet("exitMarginLength",(real)0.0), (real)0.0);
checkForExitInterval_ = max( checkForExitInterval_ = max(
dict.getValOrSet("checkForExitInterval", 1), 1); dict.getValOrSet("checkForExitInterval", 1), 1);
} }
@ -52,9 +52,10 @@ bool pFlow::boundaryExit::beforeIteration
} }
uint32 s = size(); uint32 s = size();
deviceViewType1D<uint32> deleteFlags("deleteFlags",s+1); uint32Vector_D deleteFlags("deleteFlags",s+1, s+1, RESERVE());
fill(deleteFlags, 0, s+1, 0u); deleteFlags.fill(0u);
const auto& deleteD = deleteFlags.deviceViewAll();
auto points = thisPoints(); auto points = thisPoints();
auto p = boundaryPlane().infPlane(); auto p = boundaryPlane().infPlane();
@ -68,7 +69,7 @@ bool pFlow::boundaryExit::beforeIteration
{ {
if(p.pointInNegativeSide(points(i))) if(p.pointInNegativeSide(points(i)))
{ {
deleteFlags(i)=1; deleteD(i)=1;
delToUpdate++; delToUpdate++;
} }
}, },
@ -87,7 +88,8 @@ bool pFlow::boundaryExit::beforeIteration
bool pFlow::boundaryExit::iterate bool pFlow::boundaryExit::iterate
( (
uint32 iterNum, uint32 iterNum,
real t real t,
real dt
) )
{ {
return true; return true;
@ -96,7 +98,8 @@ bool pFlow::boundaryExit::iterate
bool pFlow::boundaryExit::afterIteration bool pFlow::boundaryExit::afterIteration
( (
uint32 iterNum, uint32 iterNum,
real t real t,
real dt
) )
{ {
return true; return true;

View File

@ -63,9 +63,9 @@ public:
bool beforeIteration(uint32 iterNum, real t, real dt) override; bool beforeIteration(uint32 iterNum, real t, real dt) override;
bool iterate(uint32 iterNum, real t) override; bool iterate(uint32 iterNum, real t, real dt) override;
bool afterIteration(uint32 iterNum, real t) override; bool afterIteration(uint32 iterNum, real t, real dt) override;
}; };

View File

@ -155,6 +155,15 @@ bool pFlow::boundaryList::iterate
real dt real dt
) )
{ {
for(auto& bdry:*this)
{
if( !bdry->iterate(iter, t, dt))
{
fatalErrorInFunction<<
"Error in iterate in boundary "<<bdry->name()<<endl;
return false;
}
}
return true; return true;
} }
@ -165,5 +174,14 @@ bool pFlow::boundaryList::afterIteration
real dt real dt
) )
{ {
return true; for(auto& bdry:*this)
{
if( !bdry->afterIteration(iter, t, dt))
{
fatalErrorInFunction<<
"Error in afterIteration in boundary "<<bdry->name()<<endl;
return false;
}
}
return true;
} }

View File

@ -43,7 +43,8 @@ bool pFlow::boundaryNone::beforeIteration
bool pFlow::boundaryNone::iterate bool pFlow::boundaryNone::iterate
( (
uint32 iterNum, uint32 iterNum,
real t real t,
real dt
) )
{ {
return true; return true;
@ -52,7 +53,8 @@ bool pFlow::boundaryNone::iterate
bool pFlow::boundaryNone::afterIteration bool pFlow::boundaryNone::afterIteration
( (
uint32 iterNum, uint32 iterNum,
real t real t,
real dt
) )
{ {
return true; return true;

View File

@ -52,9 +52,9 @@ public:
bool beforeIteration(uint32 iterNum, real t, real dt) override; bool beforeIteration(uint32 iterNum, real t, real dt) override;
bool iterate(uint32 iterNum, real t) override; bool iterate(uint32 iterNum, real t, real dt) override;
bool afterIteration(uint32 iterNum, real t) override; bool afterIteration(uint32 iterNum, real t, real dt) override;
}; };

View File

@ -63,11 +63,12 @@ bool pFlow::boundaryPeriodic::beforeIteration(
} }
uint32 s = size(); uint32 s = size();
deviceViewType1D<uint32> transferFlags("transferFlags",s+1); uint32Vector_D transferFlags("transferFlags",s+1, s+1, RESERVE());
fill(transferFlags, 0, s+1, 0u); transferFlags.fill(0u);
auto points = thisPoints(); auto points = thisPoints();
auto p = boundaryPlane().infPlane(); auto p = boundaryPlane().infPlane();
const auto & transferD = transferFlags.deviceViewAll();
uint32 numTransfered = 0; uint32 numTransfered = 0;
Kokkos::parallel_reduce Kokkos::parallel_reduce
@ -78,7 +79,7 @@ bool pFlow::boundaryPeriodic::beforeIteration(
{ {
if(p.pointInNegativeSide(points(i))) if(p.pointInNegativeSide(points(i)))
{ {
transferFlags(i)=1; transferD(i)=1;
trnasToUpdate++; trnasToUpdate++;
} }
}, },
@ -109,7 +110,8 @@ bool pFlow::boundaryPeriodic::beforeIteration(
bool pFlow::boundaryPeriodic::iterate bool pFlow::boundaryPeriodic::iterate
( (
uint32 iterNum, uint32 iterNum,
real t real t,
real dt
) )
{ {
return true; return true;
@ -118,7 +120,8 @@ bool pFlow::boundaryPeriodic::iterate
bool pFlow::boundaryPeriodic::afterIteration bool pFlow::boundaryPeriodic::afterIteration
( (
uint32 iterNum, uint32 iterNum,
real t real t,
real dt
) )
{ {
return true; return true;

View File

@ -46,7 +46,7 @@ public:
const plane& bplane, const plane& bplane,
internalPoints& internal); internalPoints& internal);
virtual
~boundaryPeriodic() override= default; ~boundaryPeriodic() override= default;
add_vCtor add_vCtor
@ -64,9 +64,9 @@ public:
bool beforeIteration(uint32 iterNum, real t, real dt) override; bool beforeIteration(uint32 iterNum, real t, real dt) override;
bool iterate(uint32 iterNum, real t) override; bool iterate(uint32 iterNum, real t, real dt) override;
bool afterIteration(uint32 iterNum, real t) override; bool afterIteration(uint32 iterNum, real t, real dt) override;
}; };

View File

@ -53,7 +53,7 @@ pFlow::domain pFlow::simulationDomain::extendThisDomain
} }
pFlow::uniquePtr<pFlow::simulationDomain> pFlow::uniquePtr<pFlow::simulationDomain>
pFlow::simulationDomain::create(systemControl &control) pFlow::simulationDomain::create(systemControl &control)
{ {
word sType = angleBracketsNames( word sType = angleBracketsNames(
"simulationDomain", "simulationDomain",

View File

@ -43,7 +43,7 @@ protected:
public: public:
// - type info // - type info
TypeInfoTemplateNV("iBox", intType); TypeInfoTemplateNV11("iBox", intType);
//// - Constructors //// - Constructors
INLINE_FUNCTION_HD INLINE_FUNCTION_HD

View File

@ -18,10 +18,11 @@ Licence:
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
#include "Time.hpp"
#include "internalPoints.hpp" #include "internalPoints.hpp"
#include "domain.hpp" #include "domain.hpp"
#include "Vectors.hpp" #include "Vectors.hpp"
#include "anyList.hpp"
#include "internalPointsKernels.hpp" #include "internalPointsKernels.hpp"
void pFlow::internalPoints::syncPFlag()const void pFlow::internalPoints::syncPFlag()const
@ -33,16 +34,57 @@ void pFlow::internalPoints::syncPFlag()const
} }
} }
bool pFlow::internalPoints::deletePoints(deviceViewType1D<uint32> delPoints) bool pFlow::internalPoints::deletePoints(const uint32Vector_D& delPoints)
{ {
if(!pFlagsD_.deletePoints(delPoints))
if(delPoints.empty())return true;
auto oldRange = pFlagsD_.activeRange();
auto oldSize = size();
if(!pFlagsD_.deletePoints(delPoints.deviceView()))
{ {
fatalErrorInFunction<< fatalErrorInFunction<<
"Error in deleting points from internal points"<<endl; "Error in deleting points from internal points"<<endl;
return false; return false;
} }
pFlagSync_ = false; pFlagSync_ = false;
WARNING<<"Notify the observersin in internalPoints"<<END_WARNING;
auto newRange = pFlagsD_.activeRange();
auto newSize = size();
anyList varList;
varList.emplaceBack(
message::eventName(message::ITEM_DELETE),
delPoints);
message msg(message::ITEM_DELETE);
if(oldSize!= newSize)
{
msg.add(message::SIZE_CHANGED);
varList.emplaceBack(
message::eventName(message::SIZE_CHANGED),
newSize);
}
if(oldRange!=newRange)
{
msg.add(message::RANGE_CHANGED);
varList.emplaceBack(
message::eventName(message::RANGE_CHANGED),
newRange);
}
auto iter = time().currentIter();
auto t = time().currentTime();
auto dt = time().dt();
if( !notify(iter, t, dt, msg, varList) )
{
fatalErrorInFunction;
return false;
}
return true; return true;
} }
@ -247,7 +289,7 @@ bool pFlow::internalPoints::read
return false; return false;
} }
pointPosition_.assign(fRead); pointPosition_.assignFromHost(fRead);
pFlagsD_ = pFlagTypeDevice(pointPosition_.capacity(), 0, pointPosition_.size()); pFlagsD_ = pFlagTypeDevice(pointPosition_.capacity(), 0, pointPosition_.size());
pFlagSync_ = false; pFlagSync_ = false;
@ -284,7 +326,7 @@ bool pFlow::internalPoints::read
return false; return false;
} }
pointPosition_.assign(fRead); pointPosition_.assignFromHost(fRead);
pFlagsD_ = pFlagTypeDevice(pointPosition_.capacity(), 0, pointPosition_.size()); pFlagsD_ = pFlagTypeDevice(pointPosition_.capacity(), 0, pointPosition_.size());
pFlagSync_ = false; pFlagSync_ = false;

View File

@ -22,6 +22,7 @@ Licence:
#include "subscriber.hpp" #include "subscriber.hpp"
#include "Vectors.hpp" #include "Vectors.hpp"
#include "VectorSingles.hpp"
#include "Fields.hpp" #include "Fields.hpp"
#include "pointFlag.hpp" #include "pointFlag.hpp"
@ -75,7 +76,7 @@ protected:
friend boundaryBase; friend boundaryBase;
bool deletePoints(deviceViewType1D<uint32> delPoints); bool deletePoints(const uint32Vector_D& delPoints);
bool changePointsFlag( bool changePointsFlag(
deviceViewType1D<uint32> changePoints, deviceViewType1D<uint32> changePoints,
@ -161,6 +162,12 @@ public:
return pointPosition_.capacity(); return pointPosition_.capacity();
} }
INLINE_FUNCTION_H
bool empty()const
{
return size()==0u;
}
// - number of active points // - number of active points
INLINE_FUNCTION_H INLINE_FUNCTION_H
uint32 numActive() const uint32 numActive() const

View File

@ -277,6 +277,9 @@ public:
isAllActive_); isAllActive_);
} }
ViewType1D<uint32, memory_space> getActivePoints();
/// @brief Loop over the active points and mark those out of the box /// @brief Loop over the active points and mark those out of the box
/// and return number of deleted points /// and return number of deleted points
/// @param validBox the box whose inside is valid /// @param validBox the box whose inside is valid

View File

@ -20,7 +20,36 @@ Licence:
#ifndef __pointFlagKernels_hpp__ #ifndef __pointFlagKernels_hpp__
#define __pointFlagKernels_hpp__ #define __pointFlagKernels_hpp__
#include "streams.hpp" template<typename ExecutionSpace>
pFlow::ViewType1D<pFlow::uint32, typename pFlow::pointFlag<ExecutionSpace>::memory_space>
pFlow::pointFlag<ExecutionSpace>::getActivePoints()
{
using rpAPoints = Kokkos::RangePolicy<execution_space,
Kokkos::IndexType<uint32>>;
ViewType1D<pFlow::uint32,memory_space>
aPoints("activePoints", activeRange_.end()+1);
Kokkos::parallel_for(
"pFlow::pointFlag<ExecutionSpace>::getActivePoints",
rpAPoints(0,activeRange_.end()),
CLASS_LAMBDA_HD(uint32 i)
{
if( isActive(i))
{
aPoints[i] = 1;
}
else
{
aPoints[i] = 0;
}
}
);
Kokkos::fence();
return aPoints;
}
template<typename ExecutionSpace> template<typename ExecutionSpace>
pFlow::uint32 pFlow::pointFlag<ExecutionSpace>::markOutOfBoxDelete pFlow::uint32 pFlow::pointFlag<ExecutionSpace>::markOutOfBoxDelete

View File

@ -80,7 +80,7 @@ bool pFlow::pointStructure::setupPointStructure(const PointsTypeHost &points)
bool pFlow::pointStructure::initializePoints(const PointsTypeHost &points) bool pFlow::pointStructure::initializePoints(const PointsTypeHost &points)
{ {
pointPosition_.assign(points); pointPosition_.assignFromHost(points);
pFlagsD_ = pFlagTypeDevice(pointPosition_.capacity(), 0, pointPosition_.size()); pFlagsD_ = pFlagTypeDevice(pointPosition_.capacity(), 0, pointPosition_.size());
pFlagSync_ = false; pFlagSync_ = false;
@ -117,7 +117,7 @@ pFlow::pointStructure::pointStructure
*this *this
) )
{ {
REPORT(0)<< "Reading "<< Green_Text("point structure")<< REPORT(1)<< "Reading "<< Green_Text("pointStructure")<<
" from "<<IOobject::path()<<END_REPORT; " from "<<IOobject::path()<<END_REPORT;
if( !IOobject::readObject() ) if( !IOobject::readObject() )
@ -177,11 +177,24 @@ bool pFlow::pointStructure::beforeIteration()
bool pFlow::pointStructure::iterate() bool pFlow::pointStructure::iterate()
{ {
if( !boundaries_.iterate(currentIter(), currentTime(), dt()) )
{
fatalErrorInFunction<<
"Unable to perform iterate for boundaries"<<endl;
return false;
}
return true; return true;
} }
bool pFlow::pointStructure::afterIteration() bool pFlow::pointStructure::afterIteration()
{ {
if( !boundaries_.afterIteration(currentIter(), currentTime(), dt()) )
{
fatalErrorInFunction<<
"Unable to perform afterIteration for boundaries"<<endl;
return false;
}
return true; return true;
} }

View File

@ -27,12 +27,9 @@ Licence:
#include "boundaryList.hpp" #include "boundaryList.hpp"
#include "streams.hpp" #include "streams.hpp"
namespace pFlow namespace pFlow
{ {
class pointStructure class pointStructure
: :
public IOobject, public IOobject,
@ -74,7 +71,7 @@ public:
//// - Constructors //// - Constructors
/// an empty pointStructure, good for reading from file /// an empty pointStructure, good for reading from file
pointStructure(systemControl& control); explicit pointStructure(systemControl& control);
/// construct from point positions, assume all points are active /// construct from point positions, assume all points are active
pointStructure( pointStructure(
@ -119,7 +116,6 @@ public:
return boundaries_; return boundaries_;
} }
Time& time() override Time& time() override
{ {
return demComponent::time(); return demComponent::time();
@ -140,11 +136,17 @@ public:
return boundaries_[i]; return boundaries_[i];
} }
inline
const auto& simDomain()const const auto& simDomain()const
{ {
return simulationDomain_(); return simulationDomain_();
} }
inline
const auto& thisDomain()const
{
return simulationDomain_().thisDomain();
}
// - IO methods // - IO methods