structured data has been modified for new changes in version (1.0)
This commit is contained in:
parent
22405db699
commit
6b3a4f017b
|
@ -21,57 +21,25 @@ Licence:
|
|||
#include "boundaryBase.hpp"
|
||||
#include "dictionary.hpp"
|
||||
#include "internalPoints.hpp"
|
||||
|
||||
#include "anyList.hpp"
|
||||
#include "Time.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
|
||||
(
|
||||
deviceViewType1D<uint32> newIndices
|
||||
const uint32Vector_D& newIndices
|
||||
)
|
||||
{
|
||||
auto newSize = newIndices.size();
|
||||
setSize(static_cast<uint32>(newSize));
|
||||
if(newSize>0u)
|
||||
{
|
||||
copy(indexList_.deviceView(), newIndices);
|
||||
}
|
||||
indexList_.assign(newIndices, false);
|
||||
}
|
||||
|
||||
void pFlow::boundaryBase::appendNewIndices
|
||||
(
|
||||
deviceViewType1D<uint32> newIndices
|
||||
const uint32Vector_D& newIndices
|
||||
)
|
||||
{
|
||||
auto s = static_cast<uint32>(newIndices.size());
|
||||
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);
|
||||
indexList_.append(newIndices);
|
||||
|
||||
// TODO: notify observers about this change
|
||||
|
||||
|
@ -79,12 +47,10 @@ void pFlow::boundaryBase::appendNewIndices
|
|||
//sort(indexList_.deviceViewAll(), 0, newSize);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool pFlow::boundaryBase::removeIndices
|
||||
(
|
||||
uint32 numRemove,
|
||||
deviceViewType1D<uint32> removeMask
|
||||
const uint32Vector_D& removeMask
|
||||
)
|
||||
{
|
||||
if(removeMask.size() != size()+1 )
|
||||
|
@ -93,12 +59,12 @@ bool pFlow::boundaryBase::removeIndices
|
|||
return false;
|
||||
}
|
||||
|
||||
deviceViewType1D<uint32> removeIndices("removeIndices", 1);
|
||||
deviceViewType1D<uint32> keepIndices("keepIndices",1);
|
||||
uint32Vector_D removeIndices("removeIndices");
|
||||
uint32Vector_D keepIndices("keepIndices");
|
||||
|
||||
pFlow::boundaryBaseKernels::createRemoveKeepIndices
|
||||
(
|
||||
indexList_.deviceView(),
|
||||
indexList_,
|
||||
numRemove,
|
||||
removeMask,
|
||||
removeIndices,
|
||||
|
@ -114,15 +80,32 @@ bool pFlow::boundaryBase::removeIndices
|
|||
|
||||
setNewIndices(keepIndices);
|
||||
|
||||
//TODO: notify observers about changes
|
||||
anyList aList;
|
||||
|
||||
aList.emplaceBack(
|
||||
message::eventName(message::BNDR_RESET),
|
||||
std::move(keepIndices));
|
||||
|
||||
message msgBndry = message::BNDR_RESET;
|
||||
|
||||
return false;
|
||||
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
|
||||
(
|
||||
uint32 numTransfer,
|
||||
deviceViewType1D<uint32> transferMask,
|
||||
const uint32Vector_D& transferMask,
|
||||
uint32 transferBoundaryIndex,
|
||||
realx3 transferVector
|
||||
)
|
||||
|
@ -133,12 +116,12 @@ bool pFlow::boundaryBase::transferPoints
|
|||
return false;
|
||||
}
|
||||
|
||||
deviceViewType1D<uint32> transferIndices("transferIndices",1);
|
||||
deviceViewType1D<uint32> keepIndices("keepIndices",1);
|
||||
uint32Vector_D transferIndices("transferIndices");
|
||||
uint32Vector_D keepIndices("keepIndices");
|
||||
|
||||
pFlow::boundaryBaseKernels::createRemoveKeepIndices
|
||||
(
|
||||
indexList_.deviceView(),
|
||||
indexList_,
|
||||
numTransfer,
|
||||
transferMask,
|
||||
transferIndices,
|
||||
|
@ -150,7 +133,7 @@ bool pFlow::boundaryBase::transferPoints
|
|||
|
||||
// first, change the flags in the internalPoints
|
||||
if( !internal_.changePointsFlag(
|
||||
transferIndices,
|
||||
transferIndices.deviceView(),
|
||||
transferBoundaryIndex) )
|
||||
{
|
||||
return false;
|
||||
|
@ -158,7 +141,7 @@ bool pFlow::boundaryBase::transferPoints
|
|||
|
||||
// second, change the position of points
|
||||
if(!internal_.changePointsPoisition(
|
||||
transferIndices,
|
||||
transferIndices.deviceView(),
|
||||
transferVector))
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -53,6 +53,10 @@ private:
|
|||
/// list of particles indices on device
|
||||
uint32Vector_D indexList_;
|
||||
|
||||
uint32Vector_H indexListH_;
|
||||
|
||||
bool indexSync_ = false;
|
||||
|
||||
/// The length defined for creating neighbor list
|
||||
real neighborLength_;
|
||||
|
||||
|
@ -67,17 +71,17 @@ private:
|
|||
|
||||
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(
|
||||
uint32 numRemove,
|
||||
deviceViewType1D<uint32> removeMask);
|
||||
const uint32Vector_D& removeMask);
|
||||
|
||||
bool transferPoints(
|
||||
uint32 numTransfer,
|
||||
deviceViewType1D<uint32> transferMask,
|
||||
const uint32Vector_D& transferMask,
|
||||
uint32 transferBoundaryIndex,
|
||||
realx3 transferVector);
|
||||
|
||||
|
@ -176,10 +180,10 @@ public:
|
|||
bool beforeIteration(uint32 iterNum, real t, real dt) = 0 ;
|
||||
|
||||
virtual
|
||||
bool iterate(uint32 iterNum, real t) = 0;
|
||||
bool iterate(uint32 iterNum, real t, real dt) = 0;
|
||||
|
||||
virtual
|
||||
bool afterIteration(uint32 iterNum, real t) = 0;
|
||||
bool afterIteration(uint32 iterNum, real t, real dt) = 0;
|
||||
|
||||
|
||||
const auto& indexList()const
|
||||
|
|
|
@ -24,16 +24,25 @@ void pFlow::boundaryBaseKernels::createRemoveKeepLists
|
|||
(
|
||||
uint32 numTotal,
|
||||
uint32 numRemove,
|
||||
deviceViewType1D<uint32> removeMask,
|
||||
deviceViewType1D<uint32>& removeList,
|
||||
deviceViewType1D<uint32>& keepList
|
||||
const uint32Vector_D& removeMask,
|
||||
uint32Vector_D& removeList,
|
||||
uint32Vector_D& keepList
|
||||
)
|
||||
{
|
||||
uint32 numKeep = numTotal - numRemove;
|
||||
deviceViewType1D<uint32> rList("rList",numRemove);
|
||||
deviceViewType1D<uint32> kList("kList",numKeep);
|
||||
|
||||
exclusiveScan(removeMask, 0u, numTotal+1, removeMask, 0u);
|
||||
removeList.reallocate(numRemove,numRemove);
|
||||
keepList.reallocate(numKeep,numKeep);
|
||||
|
||||
auto maskD = removeMask.deviceViewAll();
|
||||
const auto& removeD = removeList.deviceViewAll();
|
||||
const auto& keepD = keepList.deviceViewAll();
|
||||
|
||||
exclusiveScan(
|
||||
maskD,
|
||||
0u,
|
||||
numTotal+1,
|
||||
maskD,
|
||||
0u);
|
||||
|
||||
Kokkos::parallel_for
|
||||
(
|
||||
|
@ -41,35 +50,38 @@ void pFlow::boundaryBaseKernels::createRemoveKeepLists
|
|||
deviceRPolicyStatic(0, numTotal),
|
||||
LAMBDA_HD(uint32 i)
|
||||
{
|
||||
if(removeMask(i)!= removeMask(i+1))
|
||||
rList(removeMask(i)) = i;
|
||||
if(maskD(i)!= maskD(i+1))
|
||||
removeD(maskD(i)) = i;
|
||||
else
|
||||
kList(i-removeMask(i)) = i;
|
||||
keepD(i-maskD(i)) = i;
|
||||
}
|
||||
);
|
||||
Kokkos::fence();
|
||||
|
||||
removeList = rList;
|
||||
keepList = kList;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void pFlow::boundaryBaseKernels::createRemoveKeepIndices
|
||||
(
|
||||
deviceViewType1D<uint32> indices,
|
||||
const uint32Vector_D& indices,
|
||||
uint32 numRemove,
|
||||
deviceViewType1D<uint32> removeMask,
|
||||
deviceViewType1D<uint32>& removeIndices,
|
||||
deviceViewType1D<uint32>& keepIndices
|
||||
const uint32Vector_D& removeMask,
|
||||
uint32Vector_D& removeIndices,
|
||||
uint32Vector_D& keepIndices
|
||||
)
|
||||
{
|
||||
uint32 numTotal = indices.size();
|
||||
uint32 numKeep = numTotal - numRemove;
|
||||
deviceViewType1D<uint32> rIndices("rIndices",numRemove);
|
||||
deviceViewType1D<uint32> kIndices("kIndices",numKeep);
|
||||
|
||||
removeIndices.reallocate(numRemove, numRemove);
|
||||
keepIndices.reallocate(numKeep, numKeep);
|
||||
|
||||
exclusiveScan(removeMask, 0u, numTotal+1, removeMask, 0u);
|
||||
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
|
||||
(
|
||||
|
@ -77,14 +89,11 @@ void pFlow::boundaryBaseKernels::createRemoveKeepIndices
|
|||
deviceRPolicyStatic(0, numTotal),
|
||||
LAMBDA_HD(uint32 i)
|
||||
{
|
||||
if(removeMask(i)!= removeMask(i+1))
|
||||
rIndices(removeMask(i)) = indices(i);
|
||||
if(maskD(i)!= maskD(i+1))
|
||||
removeD(maskD(i)) = indicesD(i);
|
||||
else
|
||||
kIndices(i-removeMask(i)) = indices(i);
|
||||
keepD(i-maskD(i)) = indicesD(i);
|
||||
}
|
||||
);
|
||||
Kokkos::fence();
|
||||
|
||||
removeIndices = rIndices;
|
||||
keepIndices = kIndices;
|
||||
Kokkos::fence();
|
||||
}
|
|
@ -21,7 +21,7 @@ Licence:
|
|||
#ifndef __boundaryBaseKernels_hpp__
|
||||
#define __boundaryBaseKernels_hpp__
|
||||
|
||||
#include "phasicFlowKokkos.hpp"
|
||||
#include "VectorSingles.hpp"
|
||||
|
||||
namespace pFlow::boundaryBaseKernels
|
||||
{
|
||||
|
@ -29,16 +29,16 @@ namespace pFlow::boundaryBaseKernels
|
|||
void createRemoveKeepLists(
|
||||
uint32 numTotal,
|
||||
uint32 numRemove,
|
||||
deviceViewType1D<uint32> removeMask,
|
||||
deviceViewType1D<uint32>& removeList,
|
||||
deviceViewType1D<uint32>& keepList);
|
||||
const uint32Vector_D& removeMask,
|
||||
uint32Vector_D& removeList,
|
||||
uint32Vector_D& keepList);
|
||||
|
||||
void createRemoveKeepIndices(
|
||||
deviceViewType1D<uint32> indices,
|
||||
const uint32Vector_D& indices,
|
||||
uint32 numRemove,
|
||||
deviceViewType1D<uint32> removeMask,
|
||||
deviceViewType1D<uint32>& removeIndices,
|
||||
deviceViewType1D<uint32>& keepIndices);
|
||||
const uint32Vector_D& removeMask,
|
||||
uint32Vector_D& removeIndices,
|
||||
uint32Vector_D& keepIndices);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ pFlow::boundaryExit::boundaryExit
|
|||
boundaryBase(dict, bplane, internal)
|
||||
{
|
||||
exitMarginLength_ = max(
|
||||
dict.getValOrSet("exitMarginLength",0.0), 0.0);
|
||||
dict.getValOrSet("exitMarginLength",(real)0.0), (real)0.0);
|
||||
checkForExitInterval_ = max(
|
||||
dict.getValOrSet("checkForExitInterval", 1), 1);
|
||||
}
|
||||
|
@ -52,9 +52,10 @@ bool pFlow::boundaryExit::beforeIteration
|
|||
}
|
||||
|
||||
uint32 s = size();
|
||||
deviceViewType1D<uint32> deleteFlags("deleteFlags",s+1);
|
||||
fill(deleteFlags, 0, s+1, 0u);
|
||||
uint32Vector_D deleteFlags("deleteFlags",s+1, s+1, RESERVE());
|
||||
deleteFlags.fill(0u);
|
||||
|
||||
const auto& deleteD = deleteFlags.deviceViewAll();
|
||||
auto points = thisPoints();
|
||||
auto p = boundaryPlane().infPlane();
|
||||
|
||||
|
@ -68,7 +69,7 @@ bool pFlow::boundaryExit::beforeIteration
|
|||
{
|
||||
if(p.pointInNegativeSide(points(i)))
|
||||
{
|
||||
deleteFlags(i)=1;
|
||||
deleteD(i)=1;
|
||||
delToUpdate++;
|
||||
}
|
||||
},
|
||||
|
@ -87,7 +88,8 @@ bool pFlow::boundaryExit::beforeIteration
|
|||
bool pFlow::boundaryExit::iterate
|
||||
(
|
||||
uint32 iterNum,
|
||||
real t
|
||||
real t,
|
||||
real dt
|
||||
)
|
||||
{
|
||||
return true;
|
||||
|
@ -96,7 +98,8 @@ bool pFlow::boundaryExit::iterate
|
|||
bool pFlow::boundaryExit::afterIteration
|
||||
(
|
||||
uint32 iterNum,
|
||||
real t
|
||||
real t,
|
||||
real dt
|
||||
)
|
||||
{
|
||||
return true;
|
||||
|
|
|
@ -63,9 +63,9 @@ public:
|
|||
|
||||
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;
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -155,6 +155,15 @@ bool pFlow::boundaryList::iterate
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -165,5 +174,14 @@ bool pFlow::boundaryList::afterIteration
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,8 @@ bool pFlow::boundaryNone::beforeIteration
|
|||
bool pFlow::boundaryNone::iterate
|
||||
(
|
||||
uint32 iterNum,
|
||||
real t
|
||||
real t,
|
||||
real dt
|
||||
)
|
||||
{
|
||||
return true;
|
||||
|
@ -52,7 +53,8 @@ bool pFlow::boundaryNone::iterate
|
|||
bool pFlow::boundaryNone::afterIteration
|
||||
(
|
||||
uint32 iterNum,
|
||||
real t
|
||||
real t,
|
||||
real dt
|
||||
)
|
||||
{
|
||||
return true;
|
||||
|
|
|
@ -52,9 +52,9 @@ public:
|
|||
|
||||
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;
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -63,11 +63,12 @@ bool pFlow::boundaryPeriodic::beforeIteration(
|
|||
}
|
||||
|
||||
uint32 s = size();
|
||||
deviceViewType1D<uint32> transferFlags("transferFlags",s+1);
|
||||
fill(transferFlags, 0, s+1, 0u);
|
||||
uint32Vector_D transferFlags("transferFlags",s+1, s+1, RESERVE());
|
||||
transferFlags.fill(0u);
|
||||
|
||||
auto points = thisPoints();
|
||||
auto p = boundaryPlane().infPlane();
|
||||
const auto & transferD = transferFlags.deviceViewAll();
|
||||
uint32 numTransfered = 0;
|
||||
|
||||
Kokkos::parallel_reduce
|
||||
|
@ -78,7 +79,7 @@ bool pFlow::boundaryPeriodic::beforeIteration(
|
|||
{
|
||||
if(p.pointInNegativeSide(points(i)))
|
||||
{
|
||||
transferFlags(i)=1;
|
||||
transferD(i)=1;
|
||||
trnasToUpdate++;
|
||||
}
|
||||
},
|
||||
|
@ -109,7 +110,8 @@ bool pFlow::boundaryPeriodic::beforeIteration(
|
|||
bool pFlow::boundaryPeriodic::iterate
|
||||
(
|
||||
uint32 iterNum,
|
||||
real t
|
||||
real t,
|
||||
real dt
|
||||
)
|
||||
{
|
||||
return true;
|
||||
|
@ -118,7 +120,8 @@ bool pFlow::boundaryPeriodic::iterate
|
|||
bool pFlow::boundaryPeriodic::afterIteration
|
||||
(
|
||||
uint32 iterNum,
|
||||
real t
|
||||
real t,
|
||||
real dt
|
||||
)
|
||||
{
|
||||
return true;
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
const plane& bplane,
|
||||
internalPoints& internal);
|
||||
|
||||
virtual
|
||||
|
||||
~boundaryPeriodic() override= default;
|
||||
|
||||
add_vCtor
|
||||
|
@ -64,9 +64,9 @@ public:
|
|||
|
||||
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;
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -53,7 +53,7 @@ pFlow::domain pFlow::simulationDomain::extendThisDomain
|
|||
}
|
||||
|
||||
pFlow::uniquePtr<pFlow::simulationDomain>
|
||||
pFlow::simulationDomain::create(systemControl &control)
|
||||
pFlow::simulationDomain::create(systemControl &control)
|
||||
{
|
||||
word sType = angleBracketsNames(
|
||||
"simulationDomain",
|
||||
|
|
|
@ -43,7 +43,7 @@ protected:
|
|||
public:
|
||||
|
||||
// - type info
|
||||
TypeInfoTemplateNV("iBox", intType);
|
||||
TypeInfoTemplateNV11("iBox", intType);
|
||||
|
||||
//// - Constructors
|
||||
INLINE_FUNCTION_HD
|
||||
|
|
|
@ -18,10 +18,11 @@ Licence:
|
|||
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include "Time.hpp"
|
||||
#include "internalPoints.hpp"
|
||||
#include "domain.hpp"
|
||||
#include "Vectors.hpp"
|
||||
#include "anyList.hpp"
|
||||
#include "internalPointsKernels.hpp"
|
||||
|
||||
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<<
|
||||
"Error in deleting points from internal points"<<endl;
|
||||
return 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;
|
||||
}
|
||||
|
||||
|
@ -247,7 +289,7 @@ bool pFlow::internalPoints::read
|
|||
return false;
|
||||
}
|
||||
|
||||
pointPosition_.assign(fRead);
|
||||
pointPosition_.assignFromHost(fRead);
|
||||
|
||||
pFlagsD_ = pFlagTypeDevice(pointPosition_.capacity(), 0, pointPosition_.size());
|
||||
pFlagSync_ = false;
|
||||
|
@ -284,7 +326,7 @@ bool pFlow::internalPoints::read
|
|||
return false;
|
||||
}
|
||||
|
||||
pointPosition_.assign(fRead);
|
||||
pointPosition_.assignFromHost(fRead);
|
||||
|
||||
pFlagsD_ = pFlagTypeDevice(pointPosition_.capacity(), 0, pointPosition_.size());
|
||||
pFlagSync_ = false;
|
||||
|
|
|
@ -22,6 +22,7 @@ Licence:
|
|||
|
||||
#include "subscriber.hpp"
|
||||
#include "Vectors.hpp"
|
||||
#include "VectorSingles.hpp"
|
||||
#include "Fields.hpp"
|
||||
#include "pointFlag.hpp"
|
||||
|
||||
|
@ -75,7 +76,7 @@ protected:
|
|||
friend boundaryBase;
|
||||
|
||||
|
||||
bool deletePoints(deviceViewType1D<uint32> delPoints);
|
||||
bool deletePoints(const uint32Vector_D& delPoints);
|
||||
|
||||
bool changePointsFlag(
|
||||
deviceViewType1D<uint32> changePoints,
|
||||
|
@ -160,6 +161,12 @@ public:
|
|||
{
|
||||
return pointPosition_.capacity();
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_H
|
||||
bool empty()const
|
||||
{
|
||||
return size()==0u;
|
||||
}
|
||||
|
||||
// - number of active points
|
||||
INLINE_FUNCTION_H
|
||||
|
|
|
@ -277,6 +277,9 @@ public:
|
|||
isAllActive_);
|
||||
}
|
||||
|
||||
ViewType1D<uint32, memory_space> getActivePoints();
|
||||
|
||||
|
||||
/// @brief Loop over the active points and mark those out of the box
|
||||
/// and return number of deleted points
|
||||
/// @param validBox the box whose inside is valid
|
||||
|
|
|
@ -20,7 +20,36 @@ Licence:
|
|||
#ifndef __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>
|
||||
pFlow::uint32 pFlow::pointFlag<ExecutionSpace>::markOutOfBoxDelete
|
||||
|
|
|
@ -80,7 +80,7 @@ bool pFlow::pointStructure::setupPointStructure(const PointsTypeHost &points)
|
|||
|
||||
bool pFlow::pointStructure::initializePoints(const PointsTypeHost &points)
|
||||
{
|
||||
pointPosition_.assign(points);
|
||||
pointPosition_.assignFromHost(points);
|
||||
|
||||
pFlagsD_ = pFlagTypeDevice(pointPosition_.capacity(), 0, pointPosition_.size());
|
||||
pFlagSync_ = false;
|
||||
|
@ -117,7 +117,7 @@ pFlow::pointStructure::pointStructure
|
|||
*this
|
||||
)
|
||||
{
|
||||
REPORT(0)<< "Reading "<< Green_Text("point structure")<<
|
||||
REPORT(1)<< "Reading "<< Green_Text("pointStructure")<<
|
||||
" from "<<IOobject::path()<<END_REPORT;
|
||||
|
||||
if( !IOobject::readObject() )
|
||||
|
@ -177,11 +177,24 @@ bool pFlow::pointStructure::beforeIteration()
|
|||
|
||||
bool pFlow::pointStructure::iterate()
|
||||
{
|
||||
if( !boundaries_.iterate(currentIter(), currentTime(), dt()) )
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"Unable to perform iterate for boundaries"<<endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool pFlow::pointStructure::afterIteration()
|
||||
{
|
||||
if( !boundaries_.afterIteration(currentIter(), currentTime(), dt()) )
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"Unable to perform afterIteration for boundaries"<<endl;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,12 +27,9 @@ Licence:
|
|||
#include "boundaryList.hpp"
|
||||
#include "streams.hpp"
|
||||
|
||||
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
|
||||
class pointStructure
|
||||
:
|
||||
public IOobject,
|
||||
|
@ -74,7 +71,7 @@ public:
|
|||
//// - Constructors
|
||||
|
||||
/// an empty pointStructure, good for reading from file
|
||||
pointStructure(systemControl& control);
|
||||
explicit pointStructure(systemControl& control);
|
||||
|
||||
/// construct from point positions, assume all points are active
|
||||
pointStructure(
|
||||
|
@ -119,17 +116,16 @@ public:
|
|||
return boundaries_;
|
||||
}
|
||||
|
||||
|
||||
Time& time() override
|
||||
{
|
||||
return demComponent::time();
|
||||
}
|
||||
|
||||
|
||||
const Time& time() const override
|
||||
{
|
||||
return demComponent::time();
|
||||
}
|
||||
|
||||
|
||||
boundaryBase& boundary(size_t i ) override
|
||||
{
|
||||
return boundaries_[i];
|
||||
|
@ -140,11 +136,17 @@ public:
|
|||
return boundaries_[i];
|
||||
}
|
||||
|
||||
inline
|
||||
const auto& simDomain()const
|
||||
{
|
||||
return simulationDomain_();
|
||||
}
|
||||
|
||||
inline
|
||||
const auto& thisDomain()const
|
||||
{
|
||||
return simulationDomain_().thisDomain();
|
||||
}
|
||||
|
||||
// - IO methods
|
||||
|
||||
|
|
Loading…
Reference in New Issue