phase1 of periodict boundary condition (serial)
upto now, particles are transfered from one boundary to another (mirro). this has been tested using iterateSphereParticles utility.
This commit is contained in:
parent
593cb9e6ed
commit
a900ff32bb
|
@ -52,8 +52,7 @@ protected:
|
||||||
static inline
|
static inline
|
||||||
const message defaultMessage_ =
|
const message defaultMessage_ =
|
||||||
(
|
(
|
||||||
message::BNDR_RESET+
|
message::BNDR_RESET
|
||||||
message::BNDR_REARRANGE
|
|
||||||
);
|
);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -26,4 +26,6 @@ template<class T, class MemorySpace>
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
BoundaryFieldType(boundary, internal)
|
BoundaryFieldType(boundary, internal)
|
||||||
{}
|
{
|
||||||
|
this->addEvent(message::BNDR_DELETE);
|
||||||
|
}
|
|
@ -26,4 +26,7 @@ template<class T, class MemorySpace>
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
BoundaryFieldType(boundary, internal)
|
BoundaryFieldType(boundary, internal)
|
||||||
{}
|
{
|
||||||
|
this->addEvent(message::BNDR_APPEND)
|
||||||
|
.addEvent(message::BNDR_TRANSFER);
|
||||||
|
}
|
|
@ -70,8 +70,17 @@ public:
|
||||||
const anyList& varList
|
const anyList& varList
|
||||||
) override
|
) override
|
||||||
{
|
{
|
||||||
notImplementedFunction;
|
BoundaryFieldType::hearChanges(t,dt,iter, msg,varList);
|
||||||
return false;
|
|
||||||
|
if(msg.equivalentTo(message::BNDR_APPEND))
|
||||||
|
{
|
||||||
|
// do nothing;
|
||||||
|
}
|
||||||
|
if(msg.equivalentTo(message::BNDR_TRANSFER))
|
||||||
|
{
|
||||||
|
//do nothing
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,16 +42,18 @@ public:
|
||||||
ITEM_INSERT = 4, // internal points item inserted
|
ITEM_INSERT = 4, // internal points item inserted
|
||||||
RANGE_CHANGED = 5, // internal points range changed
|
RANGE_CHANGED = 5, // internal points range changed
|
||||||
ITEM_REARRANGE = 6, // internal points item rearrange
|
ITEM_REARRANGE = 6, // internal points item rearrange
|
||||||
BNDR_REARRANGE = 7, // boundary indices rearrange
|
ITEM_FLAGCHANGED= 7, // internal points item flag changed, this occurs when transfer occurs
|
||||||
BNDR_TRANSFER = 8, // boundary indices transfered
|
BNDR_REARRANGE = 8, // boundary indices rearrange
|
||||||
BNDR_RESET = 9, // boundary indices reset entirely
|
BNDR_TRANSFER = 9, // boundary indices transfered
|
||||||
BNDR_DELETE = 10 // boundary indices deleted
|
BNDR_RESET = 10, // boundary indices reset entirely
|
||||||
|
BNDR_DELETE = 11, // boundary indices deleted
|
||||||
|
BNDR_APPEND = 12
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static constexpr size_t numberOfEvents_ = 11;
|
static constexpr size_t numberOfEvents_ = 13;
|
||||||
|
|
||||||
std::bitset<numberOfEvents_> events_{0x0000};
|
std::bitset<numberOfEvents_> events_{0x0000};
|
||||||
|
|
||||||
|
@ -65,10 +67,12 @@ private:
|
||||||
"insertedIndices",
|
"insertedIndices",
|
||||||
"range",
|
"range",
|
||||||
"rearrangedIndices",
|
"rearrangedIndices",
|
||||||
|
"transferredIndices",
|
||||||
"rearrangedIndices",
|
"rearrangedIndices",
|
||||||
"transferredIndices",
|
"transferredIndices",
|
||||||
"",
|
"",
|
||||||
"deletedIndices"
|
"deletedIndices",
|
||||||
|
"appendedIndices"
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -142,6 +146,19 @@ public:
|
||||||
return remove(evnt);
|
return remove(evnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
message& operator+(const message& msg)
|
||||||
|
{
|
||||||
|
for(size_t i=0uL; i< events_.size(); i++)
|
||||||
|
{
|
||||||
|
if(msg.equivalentTo(i))
|
||||||
|
{
|
||||||
|
events_.set(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
auto constexpr numEvents()
|
auto constexpr numEvents()
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,6 +19,7 @@ Licence:
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "boundaryBase.hpp"
|
#include "boundaryBase.hpp"
|
||||||
|
#include "boundaryList.hpp"
|
||||||
#include "dictionary.hpp"
|
#include "dictionary.hpp"
|
||||||
#include "internalPoints.hpp"
|
#include "internalPoints.hpp"
|
||||||
#include "anyList.hpp"
|
#include "anyList.hpp"
|
||||||
|
@ -34,17 +35,35 @@ void pFlow::boundaryBase::setNewIndices
|
||||||
indexList_.assign(newIndices, false);
|
indexList_.assign(newIndices, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pFlow::boundaryBase::appendNewIndices
|
bool pFlow::boundaryBase::appendNewIndices
|
||||||
(
|
(
|
||||||
const uint32Vector_D& newIndices
|
const uint32Vector_D& newIndices
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
indexList_.append(newIndices);
|
indexList_.append(newIndices);
|
||||||
|
|
||||||
// TODO: notify observers about this change
|
message msg;
|
||||||
|
|
||||||
|
msg.add(message::BNDR_APPEND);
|
||||||
|
anyList varList;
|
||||||
|
varList.emplaceBack(
|
||||||
|
message::eventName(message::BNDR_APPEND),
|
||||||
|
newIndices);
|
||||||
|
|
||||||
|
if(!notify(
|
||||||
|
internal_.time().currentIter(),
|
||||||
|
internal_.time().currentTime(),
|
||||||
|
internal_.time().dt(),
|
||||||
|
msg,
|
||||||
|
varList))
|
||||||
|
{
|
||||||
|
fatalErrorInFunction;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
// the index list should be sorted
|
|
||||||
//sort(indexList_.deviceViewAll(), 0, newSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pFlow::boundaryBase::removeIndices
|
bool pFlow::boundaryBase::removeIndices
|
||||||
|
@ -128,37 +147,32 @@ bool pFlow::boundaryBase::transferPoints
|
||||||
keepIndices
|
keepIndices
|
||||||
);
|
);
|
||||||
|
|
||||||
// third, remove the indices from this list
|
|
||||||
setNewIndices(keepIndices);
|
|
||||||
|
|
||||||
// first, change the flags in the internalPoints
|
// first, change the flags in the internalPoints
|
||||||
if( !internal_.changePointsFlag(
|
if( !internal_.changePointsFlagPosition(
|
||||||
transferIndices.deviceView(),
|
transferIndices,
|
||||||
|
transferVector,
|
||||||
|
thisBoundaryIndex(),
|
||||||
transferBoundaryIndex) )
|
transferBoundaryIndex) )
|
||||||
{
|
{
|
||||||
|
fatalErrorInFunction;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// second, change the position of points
|
// second, remove the indices from this list
|
||||||
if(!internal_.changePointsPoisition(
|
setNewIndices(keepIndices);
|
||||||
transferIndices.deviceView(),
|
|
||||||
transferVector))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// fourth, add the indices to the mirror boundary
|
// third, add the indices to the mirror boundary
|
||||||
internal_.boundary(transferBoundaryIndex).
|
return mirrorBoundary().appendNewIndices(transferIndices);
|
||||||
appendNewIndices(transferIndices);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlow::boundaryBase::boundaryBase
|
pFlow::boundaryBase::boundaryBase
|
||||||
(
|
(
|
||||||
const dictionary &dict,
|
const dictionary &dict,
|
||||||
const plane &bplane,
|
const plane &bplane,
|
||||||
internalPoints &internal
|
internalPoints &internal,
|
||||||
|
boundaryList &bndrs,
|
||||||
|
uint32 thisIndex
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
subscriber(dict.name()),
|
subscriber(dict.name()),
|
||||||
|
@ -166,20 +180,23 @@ pFlow::boundaryBase::boundaryBase
|
||||||
indexList_(groupNames(dict.name(), "indexList")),
|
indexList_(groupNames(dict.name(), "indexList")),
|
||||||
neighborLength_(dict.getVal<real>("neighborLength")),
|
neighborLength_(dict.getVal<real>("neighborLength")),
|
||||||
internal_(internal),
|
internal_(internal),
|
||||||
|
boundaries_(bndrs),
|
||||||
|
thisBoundaryIndex_(thisIndex),
|
||||||
mirrorProcessoNo_(dict.getVal<uint32>("mirrorProcessorNo")),
|
mirrorProcessoNo_(dict.getVal<uint32>("mirrorProcessorNo")),
|
||||||
name_(dict.name()),
|
name_(dict.name()),
|
||||||
type_(dict.getVal<word>("type"))
|
type_(dict.getVal<word>("type"))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pFlow::boundaryBase &pFlow::boundaryBase::mirrorBoundary()
|
||||||
|
{
|
||||||
|
return boundaries_[mirrorBoundaryIndex()];
|
||||||
|
}
|
||||||
|
|
||||||
void pFlow::boundaryBase::setSize(uint32 newSize)
|
void pFlow::boundaryBase::setSize(uint32 newSize)
|
||||||
{
|
{
|
||||||
indexList_.resize(newSize);
|
indexList_.resize(newSize);
|
||||||
/*if( indexList_.capacity() <= newSize+1 )
|
|
||||||
{
|
|
||||||
indexList_.reserve(newSize+1);
|
|
||||||
}*/
|
|
||||||
//INFORMATION<<"new size of boundary "<< name_<<" "<< indexList_.size()<<END_INFO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typename pFlow::boundaryBase::pointFieldAccessType
|
typename pFlow::boundaryBase::pointFieldAccessType
|
||||||
|
@ -202,17 +219,21 @@ typename pFlow::boundaryBase::pointFieldAccessType
|
||||||
return pointFieldAccessType();
|
return pointFieldAccessType();
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlow::uniquePtr<pFlow::boundaryBase> pFlow::boundaryBase::create(
|
pFlow::uniquePtr<pFlow::boundaryBase> pFlow::boundaryBase::create
|
||||||
|
(
|
||||||
const dictionary &dict,
|
const dictionary &dict,
|
||||||
const plane &bplane,
|
const plane &bplane,
|
||||||
internalPoints &internal)
|
internalPoints &internal,
|
||||||
|
boundaryList &bndrs,
|
||||||
|
uint32 thisIndex
|
||||||
|
)
|
||||||
{
|
{
|
||||||
word type = dict.getVal<word>("type");
|
word type = dict.getVal<word>("type");
|
||||||
word bType = angleBracketsNames("boundary", type);
|
word bType = angleBracketsNames("boundary", type);
|
||||||
|
|
||||||
if( dictionaryvCtorSelector_.search(bType) )
|
if( dictionaryvCtorSelector_.search(bType) )
|
||||||
{
|
{
|
||||||
return dictionaryvCtorSelector_[bType] (dict, bplane, internal);
|
return dictionaryvCtorSelector_[bType] (dict, bplane, internal, bndrs, thisIndex);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,6 +36,7 @@ namespace pFlow
|
||||||
|
|
||||||
class internalPoints;
|
class internalPoints;
|
||||||
class dictionary;
|
class dictionary;
|
||||||
|
class boundaryList;
|
||||||
|
|
||||||
class boundaryBase
|
class boundaryBase
|
||||||
:
|
:
|
||||||
|
@ -53,16 +54,18 @@ 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_;
|
||||||
|
|
||||||
/// a reference to
|
/// a reference to
|
||||||
internalPoints& internal_;
|
internalPoints& internal_;
|
||||||
|
|
||||||
|
/// a reference to the list of boundaries
|
||||||
|
/// (never use this in the constructor).
|
||||||
|
boundaryList& boundaries_;
|
||||||
|
|
||||||
|
uint32 thisBoundaryIndex_;
|
||||||
|
|
||||||
uint32 mirrorProcessoNo_;
|
uint32 mirrorProcessoNo_;
|
||||||
|
|
||||||
word name_;
|
word name_;
|
||||||
|
@ -73,7 +76,7 @@ protected:
|
||||||
|
|
||||||
void setNewIndices(const uint32Vector_D& newIndices);
|
void setNewIndices(const uint32Vector_D& newIndices);
|
||||||
|
|
||||||
void appendNewIndices(const uint32Vector_D& newIndices);
|
bool appendNewIndices(const uint32Vector_D& newIndices);
|
||||||
|
|
||||||
bool removeIndices(
|
bool removeIndices(
|
||||||
uint32 numRemove,
|
uint32 numRemove,
|
||||||
|
@ -85,7 +88,6 @@ protected:
|
||||||
uint32 transferBoundaryIndex,
|
uint32 transferBoundaryIndex,
|
||||||
realx3 transferVector);
|
realx3 transferVector);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TypeInfo("boundaryBase");
|
TypeInfo("boundaryBase");
|
||||||
|
@ -94,7 +96,9 @@ public:
|
||||||
boundaryBase(
|
boundaryBase(
|
||||||
const dictionary &dict,
|
const dictionary &dict,
|
||||||
const plane &bplane,
|
const plane &bplane,
|
||||||
internalPoints& internal);
|
internalPoints &internal,
|
||||||
|
boundaryList &bndrs,
|
||||||
|
uint32 thisIndex);
|
||||||
|
|
||||||
boundaryBase(const boundaryBase&) = delete;
|
boundaryBase(const boundaryBase&) = delete;
|
||||||
|
|
||||||
|
@ -114,9 +118,11 @@ public:
|
||||||
(
|
(
|
||||||
const dictionary &dict,
|
const dictionary &dict,
|
||||||
const plane &bplane,
|
const plane &bplane,
|
||||||
internalPoints& internal
|
internalPoints &internal,
|
||||||
|
boundaryList &bndrs,
|
||||||
|
uint32 thisIndex
|
||||||
),
|
),
|
||||||
(dict, bplane, internal)
|
(dict, bplane, internal, bndrs, thisIndex)
|
||||||
);
|
);
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
|
@ -172,6 +178,20 @@ public:
|
||||||
return internal_;
|
return internal_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boundaryBase& mirrorBoundary();
|
||||||
|
|
||||||
|
inline
|
||||||
|
uint32 thisBoundaryIndex()const
|
||||||
|
{
|
||||||
|
return thisBoundaryIndex_;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
uint32 mirrorBoundaryIndex()const
|
||||||
|
{
|
||||||
|
return thisBoundaryIndex_%2==0? thisBoundaryIndex_+1:thisBoundaryIndex_-1;
|
||||||
|
}
|
||||||
|
|
||||||
/// @brief set the size of indexList
|
/// @brief set the size of indexList
|
||||||
/// Always make sure that size+1 <= capacity
|
/// Always make sure that size+1 <= capacity
|
||||||
void setSize(uint32 newSize);
|
void setSize(uint32 newSize);
|
||||||
|
@ -202,7 +222,9 @@ public:
|
||||||
(
|
(
|
||||||
const dictionary &dict,
|
const dictionary &dict,
|
||||||
const plane &bplane,
|
const plane &bplane,
|
||||||
internalPoints& internal
|
internalPoints &internal,
|
||||||
|
boundaryList &bndrs,
|
||||||
|
uint32 thisIndex
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,12 @@ pFlow::boundaryExit::boundaryExit
|
||||||
(
|
(
|
||||||
const dictionary &dict,
|
const dictionary &dict,
|
||||||
const plane &bplane,
|
const plane &bplane,
|
||||||
internalPoints& internal
|
internalPoints &internal,
|
||||||
|
boundaryList &bndrs,
|
||||||
|
uint32 thisIndex
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
boundaryBase(dict, bplane, internal)
|
boundaryBase(dict, bplane, internal, bndrs, thisIndex)
|
||||||
{
|
{
|
||||||
exitMarginLength_ = max(
|
exitMarginLength_ = max(
|
||||||
dict.getValOrSet("exitMarginLength",(real)0.0), (real)0.0);
|
dict.getValOrSet("exitMarginLength",(real)0.0), (real)0.0);
|
||||||
|
|
|
@ -49,7 +49,9 @@ public:
|
||||||
boundaryExit(
|
boundaryExit(
|
||||||
const dictionary &dict,
|
const dictionary &dict,
|
||||||
const plane &bplane,
|
const plane &bplane,
|
||||||
internalPoints& internal);
|
internalPoints &internal,
|
||||||
|
boundaryList &bndrs,
|
||||||
|
uint32 thisIndex);
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
~boundaryExit() = default;
|
~boundaryExit() = default;
|
||||||
|
|
|
@ -110,7 +110,9 @@ bool pFlow::boundaryList::setLists()
|
||||||
(
|
(
|
||||||
pStruct_.simDomain().boundaryDict(i),
|
pStruct_.simDomain().boundaryDict(i),
|
||||||
pStruct_.simDomain().boundaryPlane(i),
|
pStruct_.simDomain().boundaryPlane(i),
|
||||||
pStruct_
|
pStruct_,
|
||||||
|
*this,
|
||||||
|
i
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -144,7 +146,9 @@ bool pFlow::boundaryList::beforeIteration
|
||||||
"Error in beforeIteration in boundary "<<bdry->name()<<endl;
|
"Error in beforeIteration in boundary "<<bdry->name()<<endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,12 @@ pFlow::boundaryNone::boundaryNone
|
||||||
(
|
(
|
||||||
const dictionary &dict,
|
const dictionary &dict,
|
||||||
const plane &bplane,
|
const plane &bplane,
|
||||||
internalPoints& internal
|
internalPoints &internal,
|
||||||
|
boundaryList &bndrs,
|
||||||
|
uint32 thisIndex
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
boundaryBase(dict, bplane, internal)
|
boundaryBase(dict, bplane, internal, bndrs, thisIndex)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool pFlow::boundaryNone::beforeIteration
|
bool pFlow::boundaryNone::beforeIteration
|
||||||
|
|
|
@ -39,7 +39,9 @@ public:
|
||||||
boundaryNone(
|
boundaryNone(
|
||||||
const dictionary &dict,
|
const dictionary &dict,
|
||||||
const plane &bplane,
|
const plane &bplane,
|
||||||
internalPoints& internal);
|
internalPoints &internal,
|
||||||
|
boundaryList &bndrs,
|
||||||
|
uint32 thisIndex);
|
||||||
|
|
||||||
~boundaryNone() override= default;
|
~boundaryNone() override= default;
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,12 @@ pFlow::boundaryPeriodic::boundaryPeriodic
|
||||||
(
|
(
|
||||||
const dictionary &dict,
|
const dictionary &dict,
|
||||||
const plane &bplane,
|
const plane &bplane,
|
||||||
internalPoints& internal
|
internalPoints &internal,
|
||||||
|
boundaryList &bndrs,
|
||||||
|
uint32 thisIndex
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
boundaryBase(dict, bplane, internal),
|
boundaryBase(dict, bplane, internal, bndrs, thisIndex),
|
||||||
mirrorBoundaryIndex_(dict.getVal<uint32>("mirrorBoundaryIndex"))
|
mirrorBoundaryIndex_(dict.getVal<uint32>("mirrorBoundaryIndex"))
|
||||||
{
|
{
|
||||||
extendedPlane_ = boundaryBase::boundaryPlane().parallelPlane(-boundaryBase::neighborLength());
|
extendedPlane_ = boundaryBase::boundaryPlane().parallelPlane(-boundaryBase::neighborLength());
|
||||||
|
@ -94,17 +96,16 @@ bool pFlow::boundaryPeriodic::beforeIteration(
|
||||||
|
|
||||||
// to obtain the transfer vector
|
// to obtain the transfer vector
|
||||||
const auto& thisP = boundaryPlane();
|
const auto& thisP = boundaryPlane();
|
||||||
const auto& mirrorP = internal().boundary(mirrorBoundaryIndex_).boundaryPlane();
|
const auto& mirrorP = mirrorBoundary().boundaryPlane();
|
||||||
realx3 transferVec = thisP.normal()*(thisP.d() + mirrorP.d());
|
realx3 transferVec = thisP.normal()*(thisP.d() + mirrorP.d());
|
||||||
|
|
||||||
return transferPoints
|
return transferPoints
|
||||||
(
|
(
|
||||||
numTransfered,
|
numTransfered,
|
||||||
transferFlags,
|
transferFlags,
|
||||||
mirrorBoundaryIndex_,
|
mirrorBoundaryIndex(),
|
||||||
transferVec
|
transferVec
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pFlow::boundaryPeriodic::iterate
|
bool pFlow::boundaryPeriodic::iterate
|
||||||
|
|
|
@ -44,7 +44,9 @@ public:
|
||||||
boundaryPeriodic(
|
boundaryPeriodic(
|
||||||
const dictionary &dict,
|
const dictionary &dict,
|
||||||
const plane &bplane,
|
const plane &bplane,
|
||||||
internalPoints& internal);
|
internalPoints &internal,
|
||||||
|
boundaryList &bndrs,
|
||||||
|
uint32 thisIndex);
|
||||||
|
|
||||||
|
|
||||||
~boundaryPeriodic() override= default;
|
~boundaryPeriodic() override= default;
|
||||||
|
|
|
@ -48,7 +48,7 @@ bool pFlow::internalPoints::deletePoints(const uint32Vector_D& delPoints)
|
||||||
"Error in deleting points from internal points"<<endl;
|
"Error in deleting points from internal points"<<endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
pFlagSync_ = false;
|
unSyncFlag();
|
||||||
|
|
||||||
auto newRange = pFlagsD_.activeRange();
|
auto newRange = pFlagsD_.activeRange();
|
||||||
auto newSize = size();
|
auto newSize = size();
|
||||||
|
@ -88,41 +88,62 @@ bool pFlow::internalPoints::deletePoints(const uint32Vector_D& delPoints)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pFlow::internalPoints::changePointsFlag
|
bool pFlow::internalPoints::changePointsFlagPosition
|
||||||
(
|
(
|
||||||
deviceViewType1D<uint32> changePoints,
|
const uint32Vector_D& changePoints,
|
||||||
uint32 boundaryIndex
|
realx3 transferVector,
|
||||||
|
uint32 fromBoundaryIndex,
|
||||||
|
uint32 toBoundaryIndex
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if(boundaryIndex>5)
|
if(toBoundaryIndex>5)
|
||||||
{
|
{
|
||||||
fatalErrorInFunction<<
|
fatalErrorInFunction<<
|
||||||
"Invalid boundary index "<< boundaryIndex<<endl;
|
"Invalid boundary index "<< toBoundaryIndex<<endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlagsD_.changeFlags(changePoints, boundaryIndex);
|
// change the flag
|
||||||
pFlagSync_ = false;
|
pFlagsD_.changeFlags(changePoints.deviceView(), toBoundaryIndex);
|
||||||
WARNING<<"NOTIFY About transfering the data "<<END_WARNING;
|
unSyncFlag();
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool pFlow::internalPoints::changePointsPoisition
|
// change the position
|
||||||
(
|
|
||||||
deviceViewType1D<uint32> changePoints,
|
|
||||||
realx3 transferVector
|
|
||||||
)
|
|
||||||
{
|
|
||||||
pFlow::internalPointsKernels::changePosition
|
pFlow::internalPointsKernels::changePosition
|
||||||
(
|
(
|
||||||
pointPosition_.deviceViewAll(),
|
pointPosition_.deviceViewAll(),
|
||||||
changePoints,
|
changePoints.deviceView(),
|
||||||
transferVector
|
transferVector
|
||||||
);
|
);
|
||||||
WARNING<<"Notify about the change in the position of points"<<END_WARNING;
|
|
||||||
|
anyList varList;
|
||||||
|
message msg;
|
||||||
|
|
||||||
|
varList.emplaceBack(
|
||||||
|
message::eventName(message::ITEM_FLAGCHANGED),
|
||||||
|
changePoints);
|
||||||
|
varList.emplaceBack("fromBoundaryIndex", fromBoundaryIndex);
|
||||||
|
varList.emplaceBack("toBoundaryIndex", toBoundaryIndex);
|
||||||
|
|
||||||
|
msg.add(message::ITEM_FLAGCHANGED);
|
||||||
|
|
||||||
|
if( !notify(
|
||||||
|
time().currentIter(),
|
||||||
|
time().currentTime(),
|
||||||
|
time().dt(),
|
||||||
|
msg,
|
||||||
|
varList))
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
"Error in notify for item transfer from "<< fromBoundaryIndex<<
|
||||||
|
" to "<<toBoundaryIndex<< " boundary"<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pFlow::internalPoints::internalPoints()
|
pFlow::internalPoints::internalPoints()
|
||||||
:
|
:
|
||||||
subscriber("internalPoints"),
|
subscriber("internalPoints"),
|
||||||
|
@ -203,8 +224,10 @@ typename pFlow::internalPoints::PointsTypeHost
|
||||||
|
|
||||||
auto aRange = maskH.activeRange();
|
auto aRange = maskH.activeRange();
|
||||||
uint32 n = 0;
|
uint32 n = 0;
|
||||||
|
|
||||||
for(auto i=aRange.start(); i<aRange.end(); i++)
|
for(auto i=aRange.start(); i<aRange.end(); i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
if( maskH.isActive(i) )
|
if( maskH.isActive(i) )
|
||||||
{
|
{
|
||||||
aPoints[n] = pointsH[i];
|
aPoints[n] = pointsH[i];
|
||||||
|
@ -226,7 +249,7 @@ bool pFlow::internalPoints::deletePoints
|
||||||
"Error in deleting points from internal points"<<endl;
|
"Error in deleting points from internal points"<<endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
pFlagSync_ = false;
|
unSyncFlag();
|
||||||
WARNING<<"Notify the observersin in internalPoints"<<END_WARNING;
|
WARNING<<"Notify the observersin in internalPoints"<<END_WARNING;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -239,7 +262,7 @@ pFlow::uint32 pFlow::internalPoints::updateFlag
|
||||||
const std::array<real,6>& dist
|
const std::array<real,6>& dist
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
pFlagSync_ = false;
|
unSyncFlag();
|
||||||
return pFlagsD_.markPointRegions
|
return pFlagsD_.markPointRegions
|
||||||
(
|
(
|
||||||
dm,
|
dm,
|
||||||
|
@ -292,7 +315,7 @@ bool pFlow::internalPoints::read
|
||||||
pointPosition_.assignFromHost(fRead);
|
pointPosition_.assignFromHost(fRead);
|
||||||
|
|
||||||
pFlagsD_ = pFlagTypeDevice(pointPosition_.capacity(), 0, pointPosition_.size());
|
pFlagsD_ = pFlagTypeDevice(pointPosition_.capacity(), 0, pointPosition_.size());
|
||||||
pFlagSync_ = false;
|
unSyncFlag();
|
||||||
syncPFlag();
|
syncPFlag();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -328,8 +351,7 @@ bool pFlow::internalPoints::read
|
||||||
|
|
||||||
pointPosition_.assignFromHost(fRead);
|
pointPosition_.assignFromHost(fRead);
|
||||||
|
|
||||||
pFlagsD_ = pFlagTypeDevice(pointPosition_.capacity(), 0, pointPosition_.size());
|
createDeviceFlag(pointPosition_.capacity(), 0, pointPosition_.size());
|
||||||
pFlagSync_ = false;
|
|
||||||
syncPFlag();
|
syncPFlag();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -347,118 +369,3 @@ bool pFlow::internalPoints::write
|
||||||
auto aPoints = activePointsHost();
|
auto aPoints = activePointsHost();
|
||||||
return aPoints.write(os,iop);
|
return aPoints.write(os,iop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*FUNCTION_H
|
|
||||||
bool pFlow::internalPoints::evaluateinternalPoints()
|
|
||||||
{
|
|
||||||
if(pointFlag_.size() != pointPosition_.size())
|
|
||||||
{
|
|
||||||
fatalErrorInFunction<<
|
|
||||||
"number of elements in pointFlag and pointPosition is not equal \n";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
setNumMaxPoints();
|
|
||||||
|
|
||||||
int32 minActive, maxActive;
|
|
||||||
numActivePoints_ = pFlow::internalPointsKernels::scanPointFlag(
|
|
||||||
0,
|
|
||||||
numPoints_,
|
|
||||||
static_cast<int8>(internalPoints::ACTIVE),
|
|
||||||
pointFlag_.deviceViewAll(),
|
|
||||||
minActive,
|
|
||||||
maxActive
|
|
||||||
);
|
|
||||||
|
|
||||||
activeRange_ = {minActive, maxActive};
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
FUNCTION_H
|
|
||||||
void pFlow::internalPoints::setNumMaxPoints()
|
|
||||||
{
|
|
||||||
maxPoints_ = pointFlag_.capacity();
|
|
||||||
numPoints_ = pointFlag_.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
FUNCTION_H
|
|
||||||
pFlow::realx3Field_D& pFlow::internalPoints::pointPosition()
|
|
||||||
{
|
|
||||||
return pointPosition_;
|
|
||||||
}
|
|
||||||
|
|
||||||
FUNCTION_H
|
|
||||||
pFlow::int8Field_HD& pFlow::internalPoints::pointFlag()
|
|
||||||
{
|
|
||||||
return pointFlag_;
|
|
||||||
}
|
|
||||||
|
|
||||||
pFlow::uniquePtr<pFlow::int32IndexContainer>
|
|
||||||
pFlow::internalPoints::getNewPointsIndices(int32 numNewPoints)const
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
if( capacity() - activeRange_.second >= numNewPoints )
|
|
||||||
{
|
|
||||||
// fill the sequence starting from activeRange_.second-1
|
|
||||||
return makeUnique<int32IndexContainer>(
|
|
||||||
activeRange_.second,
|
|
||||||
activeRange_.second+numNewPoints);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// second, check if there is space at the beginning
|
|
||||||
if( activeRange_.first >= numNewPoints)
|
|
||||||
{
|
|
||||||
return makeUnique<int32IndexContainer>(
|
|
||||||
0,
|
|
||||||
numNewPoints);
|
|
||||||
}
|
|
||||||
|
|
||||||
// otherwise scan the points from first to the end to find empty spaces
|
|
||||||
int32Vector newPoints(
|
|
||||||
numNewPoints,
|
|
||||||
RESERVE());
|
|
||||||
|
|
||||||
newPoints.clear();
|
|
||||||
int32 numAdded = 0;
|
|
||||||
ForAll(i, pointFlag_)
|
|
||||||
{
|
|
||||||
if(!isActive(i))
|
|
||||||
{
|
|
||||||
newPoints.push_back(static_cast<int32>(i));
|
|
||||||
numAdded++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(numAdded == numNewPoints)
|
|
||||||
{
|
|
||||||
return makeUnique<int32IndexContainer>(
|
|
||||||
newPoints.data(),
|
|
||||||
numNewPoints);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if there is space at the end for the remaining of points
|
|
||||||
if( numAdded <numNewPoints && capacity() - size() >= numNewPoints - numAdded )
|
|
||||||
{
|
|
||||||
int32 ind = size();
|
|
||||||
for(int32 i=numAdded; i<numNewPoints; i++)
|
|
||||||
{
|
|
||||||
newPoints.push_back(ind);
|
|
||||||
ind++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return makeUnique<int32IndexContainer>(
|
|
||||||
newPoints.data(),
|
|
||||||
numNewPoints);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fatalErrorInFunction<<"not enough capacity for inserting particles into the point structure\n";
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}*/
|
|
|
@ -53,7 +53,11 @@ public:
|
||||||
|
|
||||||
using execution_space = typename PointsType::execution_space;
|
using execution_space = typename PointsType::execution_space;
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
|
|
||||||
|
//// - friend et al.
|
||||||
|
|
||||||
|
friend boundaryBase;
|
||||||
|
|
||||||
//// - data members
|
//// - data members
|
||||||
|
|
||||||
|
@ -71,20 +75,30 @@ protected:
|
||||||
|
|
||||||
//// - protected members
|
//// - protected members
|
||||||
|
|
||||||
void syncPFlag()const;
|
|
||||||
|
|
||||||
friend boundaryBase;
|
|
||||||
|
|
||||||
|
|
||||||
bool deletePoints(const uint32Vector_D& delPoints);
|
bool deletePoints(const uint32Vector_D& delPoints);
|
||||||
|
|
||||||
bool changePointsFlag(
|
bool changePointsFlagPosition(
|
||||||
deviceViewType1D<uint32> changePoints,
|
const uint32Vector_D& changePoints,
|
||||||
uint32 boundaryIndex);
|
realx3 transferVector,
|
||||||
|
uint32 fromBoundaryIndex,
|
||||||
|
uint32 toBoundaryIndex);
|
||||||
|
|
||||||
bool changePointsPoisition(
|
protected:
|
||||||
deviceViewType1D<uint32> changePoints,
|
|
||||||
realx3 transferVector);
|
void syncPFlag()const;
|
||||||
|
|
||||||
|
inline
|
||||||
|
void unSyncFlag()
|
||||||
|
{
|
||||||
|
pFlagSync_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void createDeviceFlag(uint32 cap, uint32 start, uint32 end)
|
||||||
|
{
|
||||||
|
unSyncFlag();
|
||||||
|
pFlagsD_ = pFlagTypeDevice(cap, start, end);
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -101,7 +115,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
/// Construct from point positions, assume all points are active
|
/// Construct from point positions, assume all points are active
|
||||||
internalPoints(const realx3Vector& posVec);
|
explicit internalPoints(const realx3Vector& posVec);
|
||||||
|
|
||||||
/// No Copy construct
|
/// No Copy construct
|
||||||
internalPoints(const internalPoints&) = delete;
|
internalPoints(const internalPoints&) = delete;
|
||||||
|
@ -262,134 +276,3 @@ iOstream& operator<<(iOstream& os, const internalPoints& ip)
|
||||||
|
|
||||||
#endif //__internalPoints_hpp__
|
#endif //__internalPoints_hpp__
|
||||||
|
|
||||||
|
|
||||||
/*class activePointsDevice
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
ViewType1D<int8> flag_;
|
|
||||||
|
|
||||||
bool allActive_;
|
|
||||||
|
|
||||||
range activeRange_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
INLINE_FUNCTION_H
|
|
||||||
activePointsDevice(bool allActive, range active, const ViewType1D<int8>& flag)
|
|
||||||
:
|
|
||||||
flag_(flag),
|
|
||||||
allActive_(allActive),
|
|
||||||
activeRange_(active)
|
|
||||||
{}
|
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
|
||||||
activePointsDevice(const activePointsDevice&) = default;
|
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
|
||||||
activePointsDevice& operator=(const activePointsDevice&) = default;
|
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
|
||||||
bool operator()(int32 i)const {
|
|
||||||
if(i<activeRange_.second && flag_[i] == 1)return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
|
||||||
auto activeRange()const {
|
|
||||||
return activeRange_;
|
|
||||||
}
|
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
|
||||||
auto allActive()const {
|
|
||||||
return allActive_;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
class activePointsHost
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
|
|
||||||
ViewType1D<int8, HostSpace> flag_;
|
|
||||||
|
|
||||||
bool allActive_;
|
|
||||||
|
|
||||||
range activeRange_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
INLINE_FUNCTION_H
|
|
||||||
activePointsHost(bool allActive, range active, const ViewType1D<int8, HostSpace>& flag)
|
|
||||||
:
|
|
||||||
flag_(flag),
|
|
||||||
allActive_(allActive),
|
|
||||||
activeRange_(active){}
|
|
||||||
|
|
||||||
INLINE_FUNCTION_H
|
|
||||||
activePointsHost(const activePointsHost&) = default;
|
|
||||||
|
|
||||||
INLINE_FUNCTION_H
|
|
||||||
activePointsHost& operator=(const activePointsHost&) = default;
|
|
||||||
|
|
||||||
INLINE_FUNCTION_H
|
|
||||||
bool operator()(int32 i)const {
|
|
||||||
if(i <activeRange_.second && flag_[i] == PointFlag::ACTIVE)return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
INLINE_FUNCTION_H
|
|
||||||
auto activeRange()const{
|
|
||||||
return activeRange_;
|
|
||||||
}
|
|
||||||
|
|
||||||
INLINE_FUNCTION_H
|
|
||||||
bool allActive()const {
|
|
||||||
return allActive_;
|
|
||||||
}
|
|
||||||
};*/
|
|
||||||
|
|
||||||
|
|
||||||
/*FUNCTION_H`
|
|
||||||
size_t markDeleteOutOfBox(const box& domain);*/
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// - const access to points to be newly inserted
|
|
||||||
/*FUNCTION_H
|
|
||||||
auto insertedPointIndex()const
|
|
||||||
{
|
|
||||||
return tobeInsertedIndex_;
|
|
||||||
}
|
|
||||||
|
|
||||||
FUNCTION_H
|
|
||||||
auto insertedPointIndexH()const
|
|
||||||
{
|
|
||||||
return tobeInsertedIndex_.hostView();
|
|
||||||
}
|
|
||||||
|
|
||||||
FUNCTION_H
|
|
||||||
auto insertedPointIndexD()const
|
|
||||||
{
|
|
||||||
return tobeInsertedIndex_.deviceView();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
FUNCTION_H
|
|
||||||
auto mortonSortedIndex()const
|
|
||||||
{
|
|
||||||
return mortonSortedIndex_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// - update data structure by inserting/setting new points
|
|
||||||
// Notifies all the fields in the registered list of data structure
|
|
||||||
// and exclude the fields that re in the exclusionList
|
|
||||||
// retrun nullptr if it fails
|
|
||||||
/*FUNCTION_H
|
|
||||||
virtual uniquePtr<int32IndexContainer> insertPoints(
|
|
||||||
const realx3Vector& pos,
|
|
||||||
const setFieldList& setField,
|
|
||||||
repository& owner,
|
|
||||||
const List<eventObserver*>& exclusionList={nullptr}
|
|
||||||
);*/
|
|
||||||
|
|
|
@ -27,8 +27,8 @@ bool pFlow::pointStructure::setupPointStructure(const realx3Vector& points)
|
||||||
{
|
{
|
||||||
PointsTypeHost hPoints
|
PointsTypeHost hPoints
|
||||||
(
|
(
|
||||||
pointPosition_.name(),
|
pointPosition().name(),
|
||||||
pointPosition_.fieldKey()
|
pointPosition().fieldKey()
|
||||||
);
|
);
|
||||||
|
|
||||||
hPoints.assign(points);
|
hPoints.assign(points);
|
||||||
|
@ -49,8 +49,8 @@ bool pFlow::pointStructure::setupPointStructure(const PointsTypeHost &points)
|
||||||
|
|
||||||
PointsTypeHost internal
|
PointsTypeHost internal
|
||||||
(
|
(
|
||||||
pointPosition_.name(),
|
pointPosition().name(),
|
||||||
pointPosition_.fieldKey(),
|
pointPosition().fieldKey(),
|
||||||
thisN,
|
thisN,
|
||||||
thisN,
|
thisN,
|
||||||
RESERVE()
|
RESERVE()
|
||||||
|
@ -80,10 +80,9 @@ bool pFlow::pointStructure::setupPointStructure(const PointsTypeHost &points)
|
||||||
|
|
||||||
bool pFlow::pointStructure::initializePoints(const PointsTypeHost &points)
|
bool pFlow::pointStructure::initializePoints(const PointsTypeHost &points)
|
||||||
{
|
{
|
||||||
pointPosition_.assignFromHost(points);
|
pointPosition().assignFromHost(points);
|
||||||
|
|
||||||
pFlagsD_ = pFlagTypeDevice(pointPosition_.capacity(), 0, pointPosition_.size());
|
createDeviceFlag(pointPosition().capacity(), 0, pointPosition().size());
|
||||||
pFlagSync_ = false;
|
|
||||||
syncPFlag();
|
syncPFlag();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -205,8 +204,8 @@ bool pFlow::pointStructure::read(
|
||||||
|
|
||||||
PointsTypeHost fRead
|
PointsTypeHost fRead
|
||||||
(
|
(
|
||||||
this->pointPosition_.name(),
|
this->pointPosition().name(),
|
||||||
this->pointPosition_.fieldKey()
|
this->pointPosition().fieldKey()
|
||||||
);
|
);
|
||||||
|
|
||||||
if( !fRead.read(is, iop))
|
if( !fRead.read(is, iop))
|
||||||
|
|
Loading…
Reference in New Issue