commit
d909301f32
|
@ -77,6 +77,11 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isActive()const override
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
uniquePtr<boundaryIntegration> create(
|
uniquePtr<boundaryIntegration> create(
|
||||||
const boundaryBase& boundary,
|
const boundaryBase& boundary,
|
||||||
|
|
|
@ -7,11 +7,11 @@ pFlow::boundaryIntegrationList::boundaryIntegrationList(
|
||||||
integration &intgrtn
|
integration &intgrtn
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
ListPtr<boundaryIntegration>(6),
|
boundaryListPtr<boundaryIntegration>(),
|
||||||
boundaries_(pStruct.boundaries())
|
boundaries_(pStruct.boundaries())
|
||||||
{
|
{
|
||||||
|
|
||||||
for(uint32 i=0; i<6; i++)
|
ForAllBoundariesPtr(i, this)
|
||||||
{
|
{
|
||||||
this->set(
|
this->set(
|
||||||
i,
|
i,
|
||||||
|
@ -19,25 +19,23 @@ pFlow::boundaryIntegrationList::boundaryIntegrationList(
|
||||||
boundaries_[i],
|
boundaries_[i],
|
||||||
pStruct,
|
pStruct,
|
||||||
method,
|
method,
|
||||||
intgrtn
|
intgrtn
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pFlow::boundaryIntegrationList::correct(real dt, realx3PointField_D &y, realx3PointField_D &dy)
|
bool pFlow::boundaryIntegrationList::correct(real dt, realx3PointField_D &y, realx3PointField_D &dy)
|
||||||
{
|
{
|
||||||
for(auto& bndry:*this)
|
ForAllActiveBoundariesPtr(i,this)
|
||||||
{
|
{
|
||||||
if(!bndry->correct(dt, y, dy))
|
if(!boundaryPtr(i)->correct(dt, y, dy))
|
||||||
{
|
{
|
||||||
fatalErrorInFunction<<"Error in correcting boundary "<<
|
fatalErrorInFunction<<"Error in correcting boundary "<<
|
||||||
bndry->boundaryName()<<endl;
|
boundaryPtr(i)->boundaryName()<<endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,14 +44,15 @@ bool pFlow::boundaryIntegrationList::correctPStruct(
|
||||||
pointStructure &pStruct,
|
pointStructure &pStruct,
|
||||||
const realx3PointField_D &vel)
|
const realx3PointField_D &vel)
|
||||||
{
|
{
|
||||||
for(auto& bndry:*this)
|
ForAllActiveBoundariesPtr(i,this)
|
||||||
{
|
{
|
||||||
if(!bndry->correctPStruct(dt, vel))
|
if(!boundaryPtr(i)->correctPStruct(dt, vel))
|
||||||
{
|
{
|
||||||
fatalErrorInFunction<<"Error in correcting boundary "<<
|
fatalErrorInFunction<<"Error in correcting boundary "<<
|
||||||
bndry->boundaryName()<<" in pointStructure."<<endl;
|
boundaryPtr(i)->boundaryName()<<" in pointStructure."<<endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include "boundaryList.hpp"
|
#include "boundaryList.hpp"
|
||||||
#include "ListPtr.hpp"
|
#include "boundaryListPtr.hpp"
|
||||||
#include "boundaryIntegration.hpp"
|
#include "boundaryIntegration.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ class integration;
|
||||||
|
|
||||||
class boundaryIntegrationList
|
class boundaryIntegrationList
|
||||||
:
|
:
|
||||||
public ListPtr<boundaryIntegration>
|
public boundaryListPtr<boundaryIntegration>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,11 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isActive()const override
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static uniquePtr<boundaryContactSearch> create(
|
static uniquePtr<boundaryContactSearch> create(
|
||||||
const dictionary &dict,
|
const dictionary &dict,
|
||||||
const boundaryBase &boundary,
|
const boundaryBase &boundary,
|
||||||
|
|
|
@ -1,3 +1,23 @@
|
||||||
|
/*------------------------------- phasicFlow ---------------------------------
|
||||||
|
O C enter of
|
||||||
|
O O E ngineering and
|
||||||
|
O O M ultiscale modeling of
|
||||||
|
OOOOOOO F luid flow
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Copyright (C): www.cemf.ir
|
||||||
|
email: hamid.r.norouzi AT gmail.com
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Licence:
|
||||||
|
This file is part of phasicFlow code. It is a free software for simulating
|
||||||
|
granular and multiphase flows. You can redistribute it and/or modify it under
|
||||||
|
the terms of GNU General Public License v3 or any other later versions.
|
||||||
|
|
||||||
|
phasicFlow is distributed to help others in their research in the field of
|
||||||
|
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
||||||
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "boundaryContactSearchList.hpp"
|
#include "boundaryContactSearchList.hpp"
|
||||||
#include "boundaryList.hpp"
|
#include "boundaryList.hpp"
|
||||||
|
|
||||||
|
@ -5,7 +25,7 @@ void pFlow::boundaryContactSearchList::setList(
|
||||||
const dictionary &dict,
|
const dictionary &dict,
|
||||||
const contactSearch &cSearch)
|
const contactSearch &cSearch)
|
||||||
{
|
{
|
||||||
for(auto i=0; i<boundaries_.size(); i++)
|
ForAllBoundariesPtr(i, this)
|
||||||
{
|
{
|
||||||
this->set
|
this->set
|
||||||
(
|
(
|
||||||
|
@ -20,7 +40,7 @@ pFlow::boundaryContactSearchList::boundaryContactSearchList(
|
||||||
const boundaryList& bndrs,
|
const boundaryList& bndrs,
|
||||||
const contactSearch &cSearch)
|
const contactSearch &cSearch)
|
||||||
:
|
:
|
||||||
ListPtr(bndrs.size()),
|
boundaryListPtr(),
|
||||||
boundaries_(bndrs)
|
boundaries_(bndrs)
|
||||||
{
|
{
|
||||||
setList(dict, cSearch);
|
setList(dict, cSearch);
|
||||||
|
|
|
@ -1,4 +1,24 @@
|
||||||
#include "ListPtr.hpp"
|
/*------------------------------- phasicFlow ---------------------------------
|
||||||
|
O C enter of
|
||||||
|
O O E ngineering and
|
||||||
|
O O M ultiscale modeling of
|
||||||
|
OOOOOOO F luid flow
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Copyright (C): www.cemf.ir
|
||||||
|
email: hamid.r.norouzi AT gmail.com
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Licence:
|
||||||
|
This file is part of phasicFlow code. It is a free software for simulating
|
||||||
|
granular and multiphase flows. You can redistribute it and/or modify it under
|
||||||
|
the terms of GNU General Public License v3 or any other later versions.
|
||||||
|
|
||||||
|
phasicFlow is distributed to help others in their research in the field of
|
||||||
|
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
||||||
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "boundaryListPtr.hpp"
|
||||||
#include "boundaryContactSearch.hpp"
|
#include "boundaryContactSearch.hpp"
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
|
@ -9,7 +29,7 @@ class contactSearch;
|
||||||
|
|
||||||
class boundaryContactSearchList
|
class boundaryContactSearchList
|
||||||
:
|
:
|
||||||
public ListPtr<boundaryContactSearch>
|
public boundaryListPtr<boundaryContactSearch>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,11 @@ public:
|
||||||
csPairContainerType &ppPairs,
|
csPairContainerType &ppPairs,
|
||||||
csPairContainerType &pwPairs,
|
csPairContainerType &pwPairs,
|
||||||
bool force = false) override;
|
bool force = false) override;
|
||||||
|
|
||||||
|
bool isActive()const override
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,8 +152,6 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool hearChanges
|
bool hearChanges
|
||||||
(
|
(
|
||||||
real t,
|
real t,
|
||||||
|
@ -170,6 +168,11 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isActive()const override
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
uniquePtr<BoundaryGrainInteractionType> create(
|
uniquePtr<BoundaryGrainInteractionType> create(
|
||||||
const boundaryBase& boundary,
|
const boundaryBase& boundary,
|
||||||
|
|
|
@ -7,11 +7,11 @@ pFlow::boundaryGrainInteractionList<CFModel, gMModel>::boundaryGrainInteractionL
|
||||||
const gMModel &geomMotion
|
const gMModel &geomMotion
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
ListPtr<boundaryGrainInteraction<CFModel,gMModel>>(6),
|
boundaryListPtr<boundaryGrainInteraction<CFModel,gMModel>>(),
|
||||||
boundaries_(grnPrtcls.pStruct().boundaries())
|
boundaries_(grnPrtcls.pStruct().boundaries())
|
||||||
{
|
{
|
||||||
//gSettings::sleepMiliSeconds(1000*pFlowProcessors().localRank());
|
//gSettings::sleepMiliSeconds(1000*pFlowProcessors().localRank());
|
||||||
for(uint32 i=0; i<6; i++)
|
ForAllBoundariesPtr(i, this)
|
||||||
{
|
{
|
||||||
this->set(
|
this->set(
|
||||||
i,
|
i,
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include "boundaryList.hpp"
|
#include "boundaryList.hpp"
|
||||||
#include "ListPtr.hpp"
|
#include "boundaryListPtr.hpp"
|
||||||
#include "boundaryGrainInteraction.hpp"
|
#include "boundaryGrainInteraction.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ namespace pFlow
|
||||||
template<typename contactForceModel,typename geometryMotionModel>
|
template<typename contactForceModel,typename geometryMotionModel>
|
||||||
class boundaryGrainInteractionList
|
class boundaryGrainInteractionList
|
||||||
:
|
:
|
||||||
public ListPtr<boundaryGrainInteraction<contactForceModel,geometryMotionModel>>
|
public boundaryListPtr<boundaryGrainInteraction<contactForceModel,geometryMotionModel>>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -78,13 +78,15 @@ public:
|
||||||
|
|
||||||
~periodicBoundaryGrainInteraction()override = default;
|
~periodicBoundaryGrainInteraction()override = default;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool grainGrainInteraction(
|
bool grainGrainInteraction(
|
||||||
real dt,
|
real dt,
|
||||||
const ContactForceModel& cfModel,
|
const ContactForceModel& cfModel,
|
||||||
uint32 step)override;
|
uint32 step)override;
|
||||||
|
|
||||||
|
bool isActive()const override
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@ public:
|
||||||
return geometryMotion_;
|
return geometryMotion_;
|
||||||
}
|
}
|
||||||
|
|
||||||
ContactListType& ppPairs()
|
ContactListType& ppPairs()
|
||||||
{
|
{
|
||||||
return ppPairs_();
|
return ppPairs_();
|
||||||
}
|
}
|
||||||
|
@ -170,6 +170,11 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isActive()const override
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
uniquePtr<BoundarySphereInteractionType> create(
|
uniquePtr<BoundarySphereInteractionType> create(
|
||||||
const boundaryBase& boundary,
|
const boundaryBase& boundary,
|
||||||
|
|
|
@ -7,11 +7,11 @@ pFlow::boundarySphereInteractionList<CFModel, gMModel>::boundarySphereInteractio
|
||||||
const gMModel &geomMotion
|
const gMModel &geomMotion
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
ListPtr<boundarySphereInteraction<CFModel,gMModel>>(6),
|
boundaryListPtr<boundarySphereInteraction<CFModel,gMModel>>(),
|
||||||
boundaries_(sphPrtcls.pStruct().boundaries())
|
boundaries_(sphPrtcls.pStruct().boundaries())
|
||||||
{
|
{
|
||||||
//gSettings::sleepMiliSeconds(1000*pFlowProcessors().localRank());
|
|
||||||
for(uint32 i=0; i<6; i++)
|
ForAllActiveBoundariesPtr(i, this)
|
||||||
{
|
{
|
||||||
this->set(
|
this->set(
|
||||||
i,
|
i,
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include "boundaryList.hpp"
|
#include "boundaryList.hpp"
|
||||||
#include "ListPtr.hpp"
|
#include "boundaryListPtr.hpp"
|
||||||
#include "boundarySphereInteraction.hpp"
|
#include "boundarySphereInteraction.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ namespace pFlow
|
||||||
template<typename contactForceModel,typename geometryMotionModel>
|
template<typename contactForceModel,typename geometryMotionModel>
|
||||||
class boundarySphereInteractionList
|
class boundarySphereInteractionList
|
||||||
:
|
:
|
||||||
public ListPtr<boundarySphereInteraction<contactForceModel,geometryMotionModel>>
|
public boundaryListPtr<boundarySphereInteraction<contactForceModel,geometryMotionModel>>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -76,15 +76,17 @@ public:
|
||||||
boundaryBase
|
boundaryBase
|
||||||
);
|
);
|
||||||
|
|
||||||
~periodicBoundarySphereInteraction()override = default;
|
~periodicBoundarySphereInteraction()override = default;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool sphereSphereInteraction(
|
bool sphereSphereInteraction(
|
||||||
real dt,
|
real dt,
|
||||||
const ContactForceModel& cfModel,
|
const ContactForceModel& cfModel,
|
||||||
uint32 step)override;
|
uint32 step)override;
|
||||||
|
|
||||||
|
bool isActive()const override
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -145,11 +145,6 @@ pFlow::sphereInteraction<cFM,gMM, cLT>::sphereInteraction
|
||||||
{
|
{
|
||||||
fatalExit;
|
fatalExit;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(uint32 i=0; i<6; i++)
|
|
||||||
{
|
|
||||||
activeBoundaries_[i] = boundaryInteraction_[i].ppPairsAllocated();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename cFM,typename gMM,template <class, class, class> class cLT>
|
template<typename cFM,typename gMM,template <class, class, class> class cLT>
|
||||||
|
@ -193,15 +188,14 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
|
||||||
{
|
{
|
||||||
contactListMangementBoundaryTimer_.start();
|
contactListMangementBoundaryTimer_.start();
|
||||||
ComputationTimer().start();
|
ComputationTimer().start();
|
||||||
for(uint32 i=0; i<6u; i++)
|
|
||||||
|
ForAllActiveBoundaries(i, boundaryInteraction_)
|
||||||
{
|
{
|
||||||
if(activeBoundaries_[i])
|
auto& BI = boundaryInteraction_[i];
|
||||||
{
|
BI.ppPairs().beforeBroadSearch();
|
||||||
auto& BI = boundaryInteraction_[i];
|
BI.pwPairs().beforeBroadSearch();
|
||||||
BI.ppPairs().beforeBroadSearch();
|
|
||||||
BI.pwPairs().beforeBroadSearch();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ComputationTimer().end();
|
ComputationTimer().end();
|
||||||
contactListMangementBoundaryTimer_.pause();
|
contactListMangementBoundaryTimer_.pause();
|
||||||
}
|
}
|
||||||
|
@ -219,22 +213,19 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
|
||||||
fatalExit;
|
fatalExit;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(uint32 i=0; i<6u; i++)
|
ForAllActiveBoundaries(i, boundaryInteraction_)
|
||||||
{
|
{
|
||||||
if(activeBoundaries_[i])
|
auto& BI = boundaryInteraction_[i];
|
||||||
|
if(!contactSearchRef.boundaryBroadSearch(
|
||||||
|
i,
|
||||||
|
ti,
|
||||||
|
BI.ppPairs(),
|
||||||
|
BI.pwPairs())
|
||||||
|
)
|
||||||
{
|
{
|
||||||
auto& BI = boundaryInteraction_[i];
|
fatalErrorInFunction<<
|
||||||
if(!contactSearchRef.boundaryBroadSearch(
|
"failed to perform broadSearch for boundary index "<<i<<endl;
|
||||||
i,
|
return false;
|
||||||
ti,
|
|
||||||
BI.ppPairs(),
|
|
||||||
BI.pwPairs())
|
|
||||||
)
|
|
||||||
{
|
|
||||||
fatalErrorInFunction<<
|
|
||||||
"failed to perform broadSearch for boundary index "<<i<<endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ComputationTimer().end();
|
ComputationTimer().end();
|
||||||
|
@ -253,15 +244,14 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
|
||||||
{
|
{
|
||||||
contactListMangementBoundaryTimer_.resume();
|
contactListMangementBoundaryTimer_.resume();
|
||||||
ComputationTimer().start();
|
ComputationTimer().start();
|
||||||
for(uint32 i=0; i<6u; i++)
|
|
||||||
|
ForAllActiveBoundaries(i, boundaryInteraction_ )
|
||||||
{
|
{
|
||||||
if(activeBoundaries_[i])
|
auto& BI = boundaryInteraction_[i];
|
||||||
{
|
BI.ppPairs().afterBroadSearch();
|
||||||
auto& BI = boundaryInteraction_[i];
|
BI.pwPairs().afterBroadSearch();
|
||||||
BI.ppPairs().afterBroadSearch();
|
|
||||||
BI.pwPairs().afterBroadSearch();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ComputationTimer().end();
|
ComputationTimer().end();
|
||||||
contactListMangementBoundaryTimer_.end();
|
contactListMangementBoundaryTimer_.end();
|
||||||
}
|
}
|
||||||
|
@ -274,7 +264,7 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
|
||||||
ComputationTimer().start();
|
ComputationTimer().start();
|
||||||
while(requireStep.anyElement(true) && step <= 10)
|
while(requireStep.anyElement(true) && step <= 10)
|
||||||
{
|
{
|
||||||
for(uint32 i=0; i<6u; i++)
|
ForAllBoundaries(i, boundaryInteraction_)
|
||||||
{
|
{
|
||||||
if(requireStep[i] )
|
if(requireStep[i] )
|
||||||
{
|
{
|
||||||
|
@ -313,7 +303,7 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
|
||||||
const auto& cfModel = this->forceModel_();
|
const auto& cfModel = this->forceModel_();
|
||||||
while( requireStep.anyElement(true) && step < 20 )
|
while( requireStep.anyElement(true) && step < 20 )
|
||||||
{
|
{
|
||||||
for(uint32 i=0; i<6u; i++)
|
ForAllBoundaries(i, boundaryInteraction_)
|
||||||
{
|
{
|
||||||
if(requireStep[i])
|
if(requireStep[i])
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,6 +65,11 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isActive()const override
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
uniquePtr<boundaryGrainParticles> create(
|
uniquePtr<boundaryGrainParticles> create(
|
||||||
const boundaryBase &boundary,
|
const boundaryBase &boundary,
|
||||||
|
|
|
@ -5,10 +5,10 @@ pFlow::boundaryGrainParticlesList::boundaryGrainParticlesList(
|
||||||
grainParticles &prtcls
|
grainParticles &prtcls
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
ListPtr(bndrs.size()),
|
boundaryListPtr(),
|
||||||
boundaries_(bndrs)
|
boundaries_(bndrs)
|
||||||
{
|
{
|
||||||
for(auto i=0; i<boundaries_.size(); i++)
|
ForAllBoundariesPtr(i, this)
|
||||||
{
|
{
|
||||||
this->set
|
this->set
|
||||||
(
|
(
|
||||||
|
@ -16,4 +16,5 @@ pFlow::boundaryGrainParticlesList::boundaryGrainParticlesList(
|
||||||
boundaryGrainParticles::create(boundaries_[i], prtcls)
|
boundaryGrainParticles::create(boundaries_[i], prtcls)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
#ifndef __boundaryGrainParticlesList_hpp__
|
#ifndef __boundaryGrainParticlesList_hpp__
|
||||||
#define __boundaryGrainParticlesList_hpp__
|
#define __boundaryGrainParticlesList_hpp__
|
||||||
|
|
||||||
#include "ListPtr.hpp"
|
#include "boundaryListPtr.hpp"
|
||||||
#include "boundaryList.hpp"
|
#include "boundaryList.hpp"
|
||||||
#include "boundaryGrainParticles.hpp"
|
#include "boundaryGrainParticles.hpp"
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ namespace pFlow
|
||||||
|
|
||||||
class boundaryGrainParticlesList
|
class boundaryGrainParticlesList
|
||||||
:
|
:
|
||||||
public ListPtr<boundaryGrainParticles>
|
public boundaryListPtr<boundaryGrainParticles>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -316,9 +316,10 @@ bool pFlow::grainParticles::iterate()
|
||||||
accelertion().deviceViewAll(),
|
accelertion().deviceViewAll(),
|
||||||
rAcceleration().deviceViewAll()
|
rAcceleration().deviceViewAll()
|
||||||
);
|
);
|
||||||
for(auto& bndry:boundaryGrainParticles_)
|
|
||||||
|
ForAllActiveBoundaries(i,boundaryGrainParticles_)
|
||||||
{
|
{
|
||||||
bndry->acceleration(ti, g);
|
boundaryGrainParticles_[i].acceleration(ti, g);
|
||||||
}
|
}
|
||||||
accelerationTimer_.end();
|
accelerationTimer_.end();
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,11 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isActive()const override
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
uniquePtr<boundarySphereParticles> create(
|
uniquePtr<boundarySphereParticles> create(
|
||||||
const boundaryBase &boundary,
|
const boundaryBase &boundary,
|
||||||
|
|
|
@ -5,10 +5,10 @@ pFlow::boundarySphereParticlesList::boundarySphereParticlesList(
|
||||||
sphereParticles &prtcls
|
sphereParticles &prtcls
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
ListPtr(bndrs.size()),
|
boundaryListPtr(),
|
||||||
boundaries_(bndrs)
|
boundaries_(bndrs)
|
||||||
{
|
{
|
||||||
for(auto i=0; i<boundaries_.size(); i++)
|
ForAllBoundariesPtr(i, this)
|
||||||
{
|
{
|
||||||
this->set
|
this->set
|
||||||
(
|
(
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#ifndef __boundarySphereParticlesList_hpp__
|
#ifndef __boundarySphereParticlesList_hpp__
|
||||||
#define __boundarySphereParticlesList_hpp__
|
#define __boundarySphereParticlesList_hpp__
|
||||||
|
|
||||||
#include "ListPtr.hpp"
|
#include "boundaryListPtr.hpp"
|
||||||
#include "boundaryList.hpp"
|
#include "boundaryList.hpp"
|
||||||
#include "boundarySphereParticles.hpp"
|
#include "boundarySphereParticles.hpp"
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ namespace pFlow
|
||||||
|
|
||||||
class boundarySphereParticlesList
|
class boundarySphereParticlesList
|
||||||
:
|
:
|
||||||
public ListPtr<boundarySphereParticles>
|
public boundaryListPtr<boundarySphereParticles>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -552,10 +552,11 @@ bool pFlow::sphereParticles::iterate()
|
||||||
accelertion().deviceViewAll(),
|
accelertion().deviceViewAll(),
|
||||||
rAcceleration().deviceViewAll()
|
rAcceleration().deviceViewAll()
|
||||||
);
|
);
|
||||||
for(auto& bndry:boundarySphereParticles_)
|
ForAllActiveBoundaries(i,boundarySphereParticles_)
|
||||||
{
|
{
|
||||||
bndry->acceleration(ti, g);
|
boundarySphereParticles_[i].acceleration(ti, g);
|
||||||
}
|
}
|
||||||
|
|
||||||
accelerationTimer_.end();
|
accelerationTimer_.end();
|
||||||
|
|
||||||
intCorrectTimer_.start();
|
intCorrectTimer_.start();
|
||||||
|
|
|
@ -1,87 +0,0 @@
|
||||||
|
|
||||||
list(APPEND SourceFiles
|
|
||||||
types/basicTypes/bTypesFunctions.cpp
|
|
||||||
types/basicTypes/Logical.cpp
|
|
||||||
types/types.cpp
|
|
||||||
|
|
||||||
globals/error.cpp
|
|
||||||
|
|
||||||
streams/token/tokenIO.cpp
|
|
||||||
streams/token/token.cpp
|
|
||||||
streams/iStream/IOstream.cpp
|
|
||||||
streams/iStream/iIstream.cpp
|
|
||||||
streams/iStream/iOstream.cpp
|
|
||||||
streams/Stream/Istream.cpp
|
|
||||||
streams/Stream/Ostream.cpp
|
|
||||||
streams/Fstream/iFstream.cpp
|
|
||||||
streams/Fstream/oFstream.cpp
|
|
||||||
streams/Fstream/fileStream.cpp
|
|
||||||
streams/TStream/iTstream.cpp
|
|
||||||
streams/TStream/oTstream.cpp
|
|
||||||
streams/streams.cpp
|
|
||||||
|
|
||||||
dictionary/dictionary.cpp
|
|
||||||
dictionary/entry/iEntry.cpp
|
|
||||||
dictionary/entry/dataEntry.cpp
|
|
||||||
dictionary/twoPartEntry/twoPartEntry.cpp
|
|
||||||
|
|
||||||
fileSystem/fileSystem.cpp
|
|
||||||
|
|
||||||
commandLine/commandLine.cpp
|
|
||||||
|
|
||||||
random/randomReal/randomReal.cpp
|
|
||||||
random/randomReal/randomReals.cpp
|
|
||||||
|
|
||||||
Timer/Timer.cpp
|
|
||||||
Timer/Timers.cpp
|
|
||||||
|
|
||||||
repository/Time/Time.cpp
|
|
||||||
repository/Time/timeControl.cpp
|
|
||||||
repository/systemControl/systemControl.cpp
|
|
||||||
repository/systemControl/dynamicLinkLibs.cpp
|
|
||||||
repository/repository/repository.cpp
|
|
||||||
repository/IOobject/objectFile.cpp
|
|
||||||
repository/IOobject/IOobject.cpp
|
|
||||||
repository/IOobject/IOfileHeader.cpp
|
|
||||||
|
|
||||||
structuredData/box/box.cpp
|
|
||||||
structuredData/cells/cells.cpp
|
|
||||||
structuredData/cylinder/cylinder.cpp
|
|
||||||
structuredData/sphere/sphere.cpp
|
|
||||||
structuredData/iBox/iBoxs.cpp
|
|
||||||
structuredData/line/line.cpp
|
|
||||||
structuredData/zAxis/zAxis.cpp
|
|
||||||
structuredData/pointStructure/pointStructure.cpp
|
|
||||||
structuredData/pointStructure/mortonIndexing.cpp
|
|
||||||
structuredData/pointStructure/selectors/pStructSelector/pStructSelector.cpp
|
|
||||||
structuredData/pointStructure/selectors/selectBox/selectBox.cpp
|
|
||||||
structuredData/pointStructure/selectors/selectRange/selectRange.cpp
|
|
||||||
structuredData/pointStructure/selectors/selectRandom/selectRandom.cpp
|
|
||||||
structuredData/trisurfaceStructure/triSurface.cpp
|
|
||||||
structuredData/trisurfaceStructure/multiTriSurface.cpp
|
|
||||||
structuredData/trisurfaceStructure/stlFile.cpp
|
|
||||||
structuredData/peakableRegion/sphereRegion/sphereRegion.cpp
|
|
||||||
structuredData/peakableRegion/cylinderRegion/cylinderRegion.cpp
|
|
||||||
structuredData/peakableRegion/boxRegion/boxRegion.cpp
|
|
||||||
structuredData/peakableRegion/peakableRegion/peakableRegion.cpp
|
|
||||||
structuredData/peakableRegion/peakableRegions.cpp
|
|
||||||
|
|
||||||
containers/Vector/Vectors.cpp
|
|
||||||
containers/Field/Fields.cpp
|
|
||||||
containers/symArrayHD/symArrays.cpp
|
|
||||||
containers/triSurfaceField/triSurfaceFields.cpp
|
|
||||||
containers/bitsetHD/bitsetHDs.cpp
|
|
||||||
containers/indexContainer/indexContainer.cpp
|
|
||||||
|
|
||||||
setFieldList/setFieldList.cpp
|
|
||||||
setFieldList/setFieldEntry.cpp
|
|
||||||
|
|
||||||
eventSubscriber/eventSubscriber.cpp
|
|
||||||
eventSubscriber/eventObserver.cpp)
|
|
||||||
|
|
||||||
set(link_libs Kokkos::kokkos tbb)
|
|
||||||
|
|
||||||
pFlow_add_library_install(phasicFlow SourceFiles link_libs)
|
|
||||||
|
|
||||||
target_include_directories(phasicFlow PUBLIC ./Kokkos ./algorithms ./globals)
|
|
||||||
|
|
|
@ -184,6 +184,12 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isActive()const override
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
uniquePtr<boundaryField> create(
|
uniquePtr<boundaryField> create(
|
||||||
const boundaryBase& boundary,
|
const boundaryBase& boundary,
|
||||||
|
|
|
@ -22,7 +22,7 @@ Licence:
|
||||||
|
|
||||||
#include "boundaryField.hpp"
|
#include "boundaryField.hpp"
|
||||||
#include "boundaryList.hpp"
|
#include "boundaryList.hpp"
|
||||||
#include "ListPtr.hpp"
|
#include "boundaryListPtr.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
|
@ -31,7 +31,7 @@ namespace pFlow
|
||||||
template< class T, class MemorySpace = void >
|
template< class T, class MemorySpace = void >
|
||||||
class boundaryFieldList
|
class boundaryFieldList
|
||||||
:
|
:
|
||||||
public ListPtr< boundaryField<T, MemorySpace> >
|
public boundaryListPtr< boundaryField<T, MemorySpace> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -50,10 +50,10 @@ public:
|
||||||
|
|
||||||
boundaryFieldList(const boundaryList& boundaries, InternalFieldType& internal)
|
boundaryFieldList(const boundaryList& boundaries, InternalFieldType& internal)
|
||||||
:
|
:
|
||||||
ListPtr<BoundaryFieldType>(boundaries.size()),
|
boundaryListPtr<BoundaryFieldType>(),
|
||||||
boundaries_(boundaries)
|
boundaries_(boundaries)
|
||||||
{
|
{
|
||||||
for(auto i=0; i<boundaries.size(); i++)
|
ForAllBoundaries(i, *this)
|
||||||
{
|
{
|
||||||
this->set
|
this->set
|
||||||
(
|
(
|
||||||
|
@ -68,26 +68,18 @@ public:
|
||||||
if( direction == DataDirection::SlaveToMaster
|
if( direction == DataDirection::SlaveToMaster
|
||||||
&& slaveToMasterUpdateIter_ == iter) return;
|
&& slaveToMasterUpdateIter_ == iter) return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// first step
|
// first step
|
||||||
uint32 i=0;
|
ForAllBoundaries(i,*this)
|
||||||
for(auto b:*this)
|
|
||||||
{
|
{
|
||||||
if(i==0 )
|
this->boundaryPtr(i)->updateBoundary(1, direction);
|
||||||
{
|
|
||||||
//pOutput<<"request for update boundaries for field "<< b->name()<<endl;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
b->updateBoundary(1, direction);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// second step
|
// second step
|
||||||
for(auto b:*this)
|
ForAllBoundaries(i,*this)
|
||||||
{
|
{
|
||||||
b->updateBoundary(2, direction);
|
this->boundaryPtr(i)->updateBoundary(1, direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(direction == DataDirection::SlaveToMaster)
|
if(direction == DataDirection::SlaveToMaster)
|
||||||
{
|
{
|
||||||
slaveToMasterUpdateIter_ = iter;
|
slaveToMasterUpdateIter_ = iter;
|
||||||
|
@ -96,9 +88,9 @@ public:
|
||||||
|
|
||||||
void fill(const T& val)
|
void fill(const T& val)
|
||||||
{
|
{
|
||||||
for(auto& bf: *this)
|
ForAllBoundaries(i, *this)
|
||||||
{
|
{
|
||||||
bf->fill(val);
|
this->boundaryPtr(i)->fill(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,11 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isActive()const override
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,6 +147,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
const Time& time()const;
|
const Time& time()const;
|
||||||
|
|
||||||
|
virtual
|
||||||
|
bool isActive()const = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,10 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isActive()const override
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,60 +26,65 @@ Licence:
|
||||||
|
|
||||||
namespace pFlow {
|
namespace pFlow {
|
||||||
|
|
||||||
|
///
|
||||||
|
/// @class span
|
||||||
|
/// @brief Represents a view into a contiguous sequence of elements.
|
||||||
|
///
|
||||||
|
/// `span` provides a lightweight way to work with arrays and other contiguous
|
||||||
|
/// sequences without the overhead of copying. This will word on both GPU and CPU
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class span
|
class span
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
using iterator = T*;
|
using iterator = T*;
|
||||||
|
|
||||||
using constIterator = const T*;
|
using constIterator = const T*;
|
||||||
|
|
||||||
using reference = T&;
|
using reference = T&;
|
||||||
|
|
||||||
using constReference = const T&;
|
using constReference = const T&;
|
||||||
|
|
||||||
using valueType = T;
|
using valueType = T;
|
||||||
|
|
||||||
using pointer = T*;
|
using pointer = T*;
|
||||||
|
|
||||||
using constPointer = const T*;
|
using constPointer = const T*;
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
|
|
||||||
T* data_ = nullptr;
|
mutable T* data_ = nullptr;
|
||||||
|
|
||||||
uint32 size_ = 0;
|
index size_ = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TypeInfoTemplateNV11("span", T);
|
TypeInfoTemplateNV11("span", T);
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor with no arguments
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
span() = default;
|
span() = default;
|
||||||
|
|
||||||
|
|
||||||
|
/// Constructor that takes a pointer to the beginning of the data and the size of the span
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
span(T* data, uint32 size)
|
span(T* data, uint32 size)
|
||||||
: data_(data), size_(size)
|
: data_(data), size_(size)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/// copy
|
/// copy constructor
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
span(const span&) = default;
|
span(const span&) = default;
|
||||||
|
|
||||||
/// assignment
|
/// copy assignment operator
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
span& operator=(const span&) = default;
|
span& operator=(const span&) = default;
|
||||||
|
|
||||||
/// move
|
/// move constructor
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
span(span&&) = default;
|
span(span&&) = default;
|
||||||
|
|
||||||
/// assignment
|
/// move assignment operator
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
span& operator=(span&) = default;
|
span& operator=(span&) = default;
|
||||||
|
|
||||||
|
@ -90,6 +95,7 @@ public:
|
||||||
return size_ == 0;
|
return size_ == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a pointer to the beginning of the data
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
T* data() const
|
T* data() const
|
||||||
{
|
{
|
||||||
|
@ -98,7 +104,7 @@ public:
|
||||||
|
|
||||||
/// Returns the number of elements in the span
|
/// Returns the number of elements in the span
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
uint32 size() const
|
index size() const
|
||||||
{
|
{
|
||||||
return size_;
|
return size_;
|
||||||
}
|
}
|
||||||
|
@ -110,7 +116,7 @@ public:
|
||||||
return data_;
|
return data_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns an iterator to the beginning of the span
|
/// Returns an iterator to the beginning of the span (const version)
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
constIterator cbegin() const
|
constIterator cbegin() const
|
||||||
{
|
{
|
||||||
|
@ -124,93 +130,59 @@ public:
|
||||||
return data_ + size_;
|
return data_ + size_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns an iterator to one past the end of the span
|
/// Returns an iterator to one past the end of the span (const version)
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
constIterator cend() const
|
constIterator cend() const
|
||||||
{
|
{
|
||||||
return data_ + size_;
|
return data_ + size_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a reference to the element at the specified index
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
T& operator[](uint32 i)
|
T& operator[](index i)
|
||||||
{
|
{
|
||||||
return data_[i];
|
return data_[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a const reference to the element at the specified index
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
const T& operator[](uint32 i)const
|
T& operator[](index i)const
|
||||||
{
|
{
|
||||||
return data_[i];
|
return data_[i];
|
||||||
}
|
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
|
||||||
T& operator[](int32 i)
|
|
||||||
{
|
|
||||||
return data_[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
|
||||||
const T& operator[](int32 i)const
|
|
||||||
{
|
|
||||||
return data_[i];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*template<typename T, typename... properties, template<class, class...> class Container>
|
|
||||||
size_t makeSpan(Container<T, properties...>& container)
|
|
||||||
{
|
|
||||||
return span<T>(container.data(), container.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T, typename... properties, template<class, class...> class Container>
|
|
||||||
size_t makeSpan(const Container<T, properties...>& container)
|
|
||||||
{
|
|
||||||
return span<T>(
|
|
||||||
const_cast<T*>(container.data()),
|
|
||||||
container.size());
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
|
/// Creates a span of char from a span of any type.
|
||||||
|
///
|
||||||
|
/// This helper function reinterprets the underlying memory of the given span
|
||||||
|
/// as a span of char.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline
|
inline
|
||||||
span<char> charSpan(span<T> s)
|
span<char> charSpan(span<T> s)
|
||||||
{
|
{
|
||||||
auto el = sizeof(T);
|
auto el = sizeof(T);
|
||||||
return span<char>(
|
return span<char>(
|
||||||
reinterpret_cast<char*>(s.data()),
|
reinterpret_cast<char*>(s.data()),
|
||||||
s.size()*el);
|
s.size()*el);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Creates a span of const char from a span of const any type.
|
||||||
|
///
|
||||||
|
/// This helper function reinterprets the underlying memory of the given span
|
||||||
|
/// as a span of const char.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline
|
inline
|
||||||
span<const char> charSpan(span<const T> s)
|
span<const char> charSpan(span<const T> s)
|
||||||
{
|
{
|
||||||
auto el = sizeof(T);
|
auto el = sizeof(T);
|
||||||
return span<const char>(
|
return span<const char>(
|
||||||
reinterpret_cast<const char*>(s.data()),
|
reinterpret_cast<const char*>(s.data()),
|
||||||
s.size()*el);
|
s.size()*el);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*template<typename T, template<class> class Container>
|
|
||||||
span<T> makeSpan(Container<T>& container)
|
|
||||||
{
|
|
||||||
return span<T>(container.data(), container.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T, template<class> class Container>
|
|
||||||
span<T> makeSpan(const Container<T>& container)
|
|
||||||
{
|
|
||||||
return span<T>(
|
|
||||||
const_cast<T*>(container.data()),
|
|
||||||
container.size());
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // pFlow
|
} // pFlow
|
||||||
|
|
||||||
#endif //__span_hpp__
|
#endif //__span_hpp__
|
|
@ -25,15 +25,12 @@ Licence:
|
||||||
#include "message.hpp"
|
#include "message.hpp"
|
||||||
|
|
||||||
pFlow::subscriber::subscriber(const subscriber & src)
|
pFlow::subscriber::subscriber(const subscriber & src)
|
||||||
:
|
|
||||||
subName_(src.subName_)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlow::subscriber::subscriber(subscriber && src)
|
pFlow::subscriber::subscriber(subscriber && src)
|
||||||
:
|
:
|
||||||
observerList_(std::move(src.observerList_)),
|
observerList_(std::move(src.observerList_))
|
||||||
subName_(std::move(src.subName_))
|
|
||||||
{
|
{
|
||||||
|
|
||||||
for(size_t i=0; i<observerList_.size(); i++)
|
for(size_t i=0; i<observerList_.size(); i++)
|
||||||
|
@ -47,13 +44,13 @@ pFlow::subscriber::subscriber(subscriber && src)
|
||||||
|
|
||||||
pFlow::subscriber &pFlow::subscriber::operator=(const subscriber & rhs)
|
pFlow::subscriber &pFlow::subscriber::operator=(const subscriber & rhs)
|
||||||
{
|
{
|
||||||
this->subName_ = rhs.subName_;
|
//this->subName_ = rhs.subName_;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlow::subscriber &pFlow::subscriber::operator=(subscriber && rhs)
|
pFlow::subscriber &pFlow::subscriber::operator=(subscriber && rhs)
|
||||||
{
|
{
|
||||||
this->subName_ = std::move(rhs.subName_);
|
//this->subName_ = std::move(rhs.subName_);
|
||||||
this->observerList_ = std::move(rhs.observerList_);
|
this->observerList_ = std::move(rhs.observerList_);
|
||||||
|
|
||||||
for(size_t i=0; i<observerList_.size(); i++)
|
for(size_t i=0; i<observerList_.size(); i++)
|
||||||
|
|
|
@ -39,15 +39,13 @@ class subscriber
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// - list of subsribed objectd that recieve updage messages
|
// - list of subsribed objectd that recieve updage messages
|
||||||
mutable std::array<List<observer*>,message::numEvents()> observerList_;
|
mutable std::vector<List<observer*>> observerList_{message::numEvents()};
|
||||||
|
|
||||||
word subName_;
|
//word subName_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
subscriber(const word& name)
|
subscriber(const word& name)
|
||||||
:
|
|
||||||
subName_(name)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/// Copy constructor, only copies the name, not the list
|
/// Copy constructor, only copies the name, not the list
|
||||||
|
@ -82,9 +80,9 @@ public:
|
||||||
const message msg,
|
const message msg,
|
||||||
const anyList& varList);
|
const anyList& varList);
|
||||||
|
|
||||||
const word& subscriberName()const
|
word subscriberName()const
|
||||||
{
|
{
|
||||||
return subName_;
|
return "subscriber"; //subName_;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -32,41 +32,35 @@ Licence:
|
||||||
static pFlow::Ostream& errorStream = pFlow::pOutput;
|
static pFlow::Ostream& errorStream = pFlow::pOutput;
|
||||||
|
|
||||||
pFlow::iOstream&
|
pFlow::iOstream&
|
||||||
fatalErrorMessage(const char* fileName, int linNumber)
|
pFlow::fatalErrorMessage(const char* fileName, int lineNumber)
|
||||||
{
|
{
|
||||||
errorStream << "\n>>> Fatal error in phasicFlow\n"
|
errorStream << "\nError occured in file ("<<lineNumber<<"):" <<Red_Text(fileName)<<'\n';
|
||||||
<< "Error occured in source file " << Red_Text(fileName)
|
|
||||||
<< " at line " << Red_Text(linNumber) << '\n';
|
|
||||||
return errorStream;
|
return errorStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlow::iOstream&
|
pFlow::iOstream&
|
||||||
fatalErrorInMessage(const char* fnName, const char* fileName, int linNumber)
|
pFlow::fatalErrorInMessage(const char* fnName, const char* fileName, int lineNumber)
|
||||||
{
|
{
|
||||||
errorStream << "\n>>> Fatal error in phasicFlow\n"
|
errorStream << "\nError occured in file ("<<lineNumber<<"):" <<Red_Text(fileName)<<'\n'<<
|
||||||
<< " Error is issued in function " << Red_Text(fnName)
|
"Function: "<<Red_Text(fnName)<<'\n';
|
||||||
<< ", located in file " << Red_Text(fileName) << " at line "
|
|
||||||
<< Red_Text(linNumber) << '\n';
|
|
||||||
return errorStream;
|
return errorStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlow::iOstream&
|
pFlow::iOstream&
|
||||||
notImplementedErrorMessage(
|
pFlow::notImplementedErrorMessage(
|
||||||
const char* fnName,
|
const char* fnName,
|
||||||
const char* fileName,
|
const char* fileName,
|
||||||
int lineNumber
|
int lineNumber
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
errorStream << "\n>>> Fatal error in phasicFlow\n";
|
errorStream << "\n Function " << Yellow_Text(fnName)
|
||||||
errorStream << " Function " << Red_Text(fnName)
|
|
||||||
<< " has not been implemented yet!\n"
|
<< " has not been implemented yet!\n"
|
||||||
<< " File " << Yellow_Text(fileName) << " at line "
|
<< " Look into file ("<<lineNumber<<"):" <<fileName<<'\n';
|
||||||
<< Yellow_Text(lineNumber) << '\n';
|
|
||||||
return errorStream;
|
return errorStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlow::iOstream&
|
pFlow::iOstream&
|
||||||
ioErrorMessage(
|
pFlow::ioErrorMessage(
|
||||||
const char* fileName,
|
const char* fileName,
|
||||||
int fileLineNumber,
|
int fileLineNumber,
|
||||||
const char* fnName,
|
const char* fnName,
|
||||||
|
@ -84,7 +78,7 @@ ioErrorMessage(
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlow::iOstream&
|
pFlow::iOstream&
|
||||||
ioErrorMessage(
|
pFlow::ioErrorMessage(
|
||||||
const pFlow::word& fileName,
|
const pFlow::word& fileName,
|
||||||
int fileLineNumber,
|
int fileLineNumber,
|
||||||
const char* fnName,
|
const char* fnName,
|
||||||
|
@ -98,7 +92,7 @@ ioErrorMessage(
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlow::iOstream&
|
pFlow::iOstream&
|
||||||
warningMessage(const char* fnName, const char* fileName, int linNumber)
|
pFlow::warningMessage(const char* fnName, const char* fileName, int linNumber)
|
||||||
{
|
{
|
||||||
errorStream << "\n>>> Warning in phasicFlow\n"
|
errorStream << "\n>>> Warning in phasicFlow\n"
|
||||||
<< " Warning is issued in function " << Yellow_Text(fnName)
|
<< " Warning is issued in function " << Yellow_Text(fnName)
|
||||||
|
@ -108,7 +102,7 @@ warningMessage(const char* fnName, const char* fileName, int linNumber)
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlow::iOstream&
|
pFlow::iOstream&
|
||||||
reportAndExit(int errorCode)
|
pFlow::reportAndExit(int errorCode)
|
||||||
{
|
{
|
||||||
errorStream << "\n>>> phasicFlow is exiting . . ." << pFlow::endl;
|
errorStream << "\n>>> phasicFlow is exiting . . ." << pFlow::endl;
|
||||||
fatalExitPhasicFlow(errorCode);
|
fatalExitPhasicFlow(errorCode);
|
||||||
|
@ -116,7 +110,7 @@ reportAndExit(int errorCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
fatalExitPhasicFlow(int errorCode)
|
pFlow::fatalExitPhasicFlow(int errorCode)
|
||||||
{
|
{
|
||||||
// Kokkos should be finalized first
|
// Kokkos should be finalized first
|
||||||
Kokkos::finalize();
|
Kokkos::finalize();
|
||||||
|
|
|
@ -27,7 +27,7 @@ Licence:
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
class iOstream;
|
class iOstream;
|
||||||
}
|
|
||||||
|
|
||||||
//- Decleartions
|
//- Decleartions
|
||||||
|
|
||||||
|
@ -66,35 +66,37 @@ warningMessage(const char* fnName, const char* fileName, int linNumber);
|
||||||
pFlow::iOstream&
|
pFlow::iOstream&
|
||||||
reportAndExit(int errorCode = EXIT_FAILURE);
|
reportAndExit(int errorCode = EXIT_FAILURE);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// Report a fatal error and exit the applicaiton
|
/// Report a fatal error and exit the applicaiton
|
||||||
#define fatalError fatalErrorMessage(__FILE__, __LINE__)
|
#define fatalError pFlow::fatalErrorMessage(__FILE__, __LINE__)
|
||||||
|
|
||||||
/// Report a fatal error and supplied function name and exit the application
|
/// Report a fatal error and supplied function name and exit the application
|
||||||
#define fatalErrorIn(functionName) \
|
#define fatalErrorIn(functionName) \
|
||||||
fatalErrorInMessage((functionName), __FILE__, __LINE__)
|
pFlow::fatalErrorInMessage((functionName), __FILE__, __LINE__)
|
||||||
|
|
||||||
/// Report a fatal error and function name and exit the application
|
/// Report a fatal error and function name and exit the application
|
||||||
#define fatalErrorInFunction fatalErrorIn(FUNCTION_NAME)
|
#define fatalErrorInFunction fatalErrorIn(FUNCTION_NAME)
|
||||||
|
|
||||||
/// Report that a function is yet not implemented with supplied function name.
|
/// Report that a function is yet not implemented with supplied function name.
|
||||||
#define Not_Implemented(functionName) \
|
#define Not_Implemented(functionName) \
|
||||||
notImplementedErrorMessage((functionName), __FILE__, __LINE__)
|
pFlow::notImplementedErrorMessage((functionName), __FILE__, __LINE__)
|
||||||
|
|
||||||
/// Report that a function is yet not implemented.
|
/// Report that a function is yet not implemented.
|
||||||
#define notImplementedFunction Not_Implemented(FUNCTION_NAME)
|
#define notImplementedFunction Not_Implemented(FUNCTION_NAME)
|
||||||
|
|
||||||
/// Report an error in file operation with supplied fileName and lineNumber.
|
/// Report an error in file operation with supplied fileName and lineNumber.
|
||||||
#define ioErrorInFile(fileName, lineNumber) \
|
#define ioErrorInFile(fileName, lineNumber) \
|
||||||
ioErrorMessage(fileName, lineNumber, FUNCTION_NAME, __FILE__, __LINE__)
|
pFlow::ioErrorMessage(fileName, lineNumber, FUNCTION_NAME, __FILE__, __LINE__)
|
||||||
|
|
||||||
/// Report a warning with supplied function name
|
/// Report a warning with supplied function name
|
||||||
#define warningIn(functionName) \
|
#define warningIn(functionName) \
|
||||||
warningMessage((functionName), __FILE__, __LINE__)
|
pFlow::warningMessage((functionName), __FILE__, __LINE__)
|
||||||
|
|
||||||
/// Report a warning
|
/// Report a warning
|
||||||
#define warningInFunction warningIn(FUNCTION_NAME)
|
#define warningInFunction warningIn(FUNCTION_NAME)
|
||||||
|
|
||||||
/// Fatal exit
|
/// Fatal exit
|
||||||
#define fatalExit reportAndExit()
|
#define fatalExit pFlow::reportAndExit()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -60,7 +60,7 @@ private:
|
||||||
fileSystem localPath_ = "";
|
fileSystem localPath_ = "";
|
||||||
|
|
||||||
/// Number of bytes used for writing/reading real variable (used for binray)
|
/// Number of bytes used for writing/reading real variable (used for binray)
|
||||||
int numBytesForReal_ = numBytesForReal__;
|
int numBytesForReal_ = sizeof(real);
|
||||||
|
|
||||||
/// Does the objectFile read & write the header?
|
/// Does the objectFile read & write the header?
|
||||||
bool readWriteHeader_ = true;
|
bool readWriteHeader_ = true;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#ifndef __boundariesMask_hpp__
|
#ifndef __boundariesMask_hpp__
|
||||||
#define __boundariesMask_hpp__
|
#define __boundariesMask_hpp__
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ bool pFlow::boundaryBase::removeIndices
|
||||||
if( !this->notify(iter, t, dt, msgBndry, aList) )
|
if( !this->notify(iter, t, dt, msgBndry, aList) )
|
||||||
{
|
{
|
||||||
fatalErrorInFunction<<"Error in notify operation in boundary "<<
|
fatalErrorInFunction<<"Error in notify operation in boundary "<<
|
||||||
name_ <<endl;
|
name() <<endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,16 +233,16 @@ pFlow::boundaryBase::boundaryBase(
|
||||||
indexList_(groupNames("indexList", dict.name())),
|
indexList_(groupNames("indexList", dict.name())),
|
||||||
indexListHost_(groupNames("hostIndexList", dict.name())),
|
indexListHost_(groupNames("hostIndexList", dict.name())),
|
||||||
neighborLength_(dict.getVal<real>("neighborLength")),
|
neighborLength_(dict.getVal<real>("neighborLength")),
|
||||||
// updateInetrval_(dict.getVal<uint32>("updateInterval")),
|
|
||||||
boundaryExtntionLengthRatio_(dict.getVal<real>("boundaryExtntionLengthRatio")),
|
boundaryExtntionLengthRatio_(dict.getVal<real>("boundaryExtntionLengthRatio")),
|
||||||
internal_(internal),
|
internal_(internal),
|
||||||
boundaries_(bndrs),
|
boundaries_(bndrs),
|
||||||
thisBoundaryIndex_(thisIndex),
|
thisBoundaryIndex_(thisIndex),
|
||||||
neighborProcessorNo_(dict.getVal<int32>("neighborProcessorNo")),
|
neighborProcessorNo_(dict.getVal<int32>("neighborProcessorNo")),
|
||||||
isBoundaryMaster_(thisProcessorNo() >= neighborProcessorNo()),
|
type_(makeUnique<word>(dict.getVal<word>("type")))
|
||||||
name_(dict.name()),
|
|
||||||
type_(dict.getVal<word>("type"))
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
isBoundaryMaster_ = thisProcessorNo() >= neighborProcessorNo();
|
||||||
|
|
||||||
unSyncLists();
|
unSyncLists();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,14 @@ Licence:
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
|
|
||||||
|
static
|
||||||
|
inline const std::array<word,6> boundaryNames_ =
|
||||||
|
{
|
||||||
|
"left", "right",
|
||||||
|
"bottom", "top",
|
||||||
|
"rear", "front"
|
||||||
|
};
|
||||||
|
|
||||||
// forward
|
// forward
|
||||||
|
|
||||||
class internalPoints;
|
class internalPoints;
|
||||||
|
@ -61,16 +69,18 @@ private:
|
||||||
/// list of particles indieces on host
|
/// list of particles indieces on host
|
||||||
mutable uint32Vector_H indexListHost_;
|
mutable uint32Vector_H indexListHost_;
|
||||||
|
|
||||||
/// device and host list are sync
|
|
||||||
mutable bool listsSync_ = false;
|
|
||||||
|
|
||||||
/// The length defined for creating neighbor list
|
/// The length defined for creating neighbor list
|
||||||
real neighborLength_;
|
real neighborLength_;
|
||||||
|
|
||||||
|
/// device and host list are sync
|
||||||
|
mutable bool listsSync_ = false;
|
||||||
|
|
||||||
bool updateTime_ = false;
|
bool updateTime_ = false;
|
||||||
|
|
||||||
bool iterBeforeUpdate_ = false;
|
bool iterBeforeUpdate_ = false;
|
||||||
|
|
||||||
|
bool isBoundaryMaster_;
|
||||||
|
|
||||||
/// the extra boundary extension beyound actual limits of boundary
|
/// the extra boundary extension beyound actual limits of boundary
|
||||||
real boundaryExtntionLengthRatio_;
|
real boundaryExtntionLengthRatio_;
|
||||||
|
|
||||||
|
@ -85,11 +95,7 @@ private:
|
||||||
|
|
||||||
int neighborProcessorNo_;
|
int neighborProcessorNo_;
|
||||||
|
|
||||||
bool isBoundaryMaster_;
|
uniquePtr<word> type_;
|
||||||
|
|
||||||
word name_;
|
|
||||||
|
|
||||||
word type_;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -251,13 +257,13 @@ public:
|
||||||
inline
|
inline
|
||||||
const word& type()const
|
const word& type()const
|
||||||
{
|
{
|
||||||
return type_;
|
return type_();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
const word& name()const
|
const word& name()const
|
||||||
{
|
{
|
||||||
return name_;
|
return boundaryNames_[thisBoundaryIndex_];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
|
@ -406,6 +412,12 @@ public:
|
||||||
return 0u;
|
return 0u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool isActive()const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/// - static create
|
/// - static create
|
||||||
static
|
static
|
||||||
uniquePtr<boundaryBase> create
|
uniquePtr<boundaryBase> create
|
||||||
|
|
|
@ -39,7 +39,8 @@ pFlow::boundaryList::setExtendedDomain()
|
||||||
boundary(3).boundaryExtensionLength() +
|
boundary(3).boundaryExtensionLength() +
|
||||||
boundary(5).boundaryExtensionLength();
|
boundary(5).boundaryExtensionLength();
|
||||||
|
|
||||||
extendedDomain_ = pStruct_.simDomain().extendThisDomain(lowerExt, upperExt);
|
extendedDomain_ = makeUnique<domain>(
|
||||||
|
pStruct_.simDomain().extendThisDomain(lowerExt, upperExt));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -66,7 +67,7 @@ pFlow::boundaryList::updateNeighborLists()
|
||||||
dist[4] = boundary(4).neighborLength();
|
dist[4] = boundary(4).neighborLength();
|
||||||
dist[5] = boundary(5).neighborLength();
|
dist[5] = boundary(5).neighborLength();
|
||||||
|
|
||||||
pStruct_.updateFlag(extendedDomain_, dist);
|
pStruct_.updateFlag(extendedDomain_(), dist);
|
||||||
|
|
||||||
const auto& maskD = pStruct_.activePointsMaskDevice();
|
const auto& maskD = pStruct_.activePointsMaskDevice();
|
||||||
boundary(0).setSize(maskD.leftSize());
|
boundary(0).setSize(maskD.leftSize());
|
||||||
|
@ -88,8 +89,8 @@ pFlow::boundaryList::updateNeighborLists()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlow::boundaryList::boundaryList(pointStructure& pStruct)
|
pFlow::boundaryList::boundaryList(pointStructure& pStruct):
|
||||||
: ListPtr<boundaryBase>(pStruct.simDomain().sizeOfBoundaries()),
|
boundaryListPtr<boundaryBase>(),
|
||||||
pStruct_(pStruct)
|
pStruct_(pStruct)
|
||||||
{
|
{
|
||||||
const dictionary& dict= pStruct_.simDomain().thisBoundariesDict();
|
const dictionary& dict= pStruct_.simDomain().thisBoundariesDict();
|
||||||
|
@ -143,7 +144,7 @@ pFlow::boundaryList::createBoundaries()
|
||||||
if (listSet_)
|
if (listSet_)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
for (auto i = 0; i < pStruct_.simDomain().sizeOfBoundaries(); i++)
|
ForAllBoundaries(i, *this)
|
||||||
{
|
{
|
||||||
this->set(
|
this->set(
|
||||||
i,
|
i,
|
||||||
|
@ -155,7 +156,9 @@ pFlow::boundaryList::createBoundaries()
|
||||||
i
|
i
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
listSet_ = true;
|
listSet_ = true;
|
||||||
setExtendedDomain();
|
setExtendedDomain();
|
||||||
return true;
|
return true;
|
||||||
|
@ -197,7 +200,24 @@ pFlow::boundaryList::beforeIteration(const timeInfo& ti, bool force)
|
||||||
|
|
||||||
while(callAgain.anyElement(true) && step <= 10u)
|
while(callAgain.anyElement(true) && step <= 10u)
|
||||||
{
|
{
|
||||||
for(size_t i=0; i<6ul; i++)
|
ForAllBoundaries(i,*this)
|
||||||
|
{
|
||||||
|
if(callAgain[i])
|
||||||
|
{
|
||||||
|
if(! boundary(i).beforeIteration(
|
||||||
|
step,
|
||||||
|
ti,
|
||||||
|
boundaryUpdate_,
|
||||||
|
iterBeforeBoundaryUpdate_,
|
||||||
|
callAgain[i]))
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<"error in performing beforeIteration for boundary"<<
|
||||||
|
boundary(i).name()<<" at step "<< step<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*for(size_t i=0; i<6ul; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(callAgain[i])
|
if(callAgain[i])
|
||||||
|
@ -214,21 +234,28 @@ pFlow::boundaryList::beforeIteration(const timeInfo& ti, bool force)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
step++;
|
step++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ForAllBoundaries(i,*this)
|
||||||
for (auto bdry : *this)
|
{
|
||||||
|
boundary(i).updataBoundaryData(1);
|
||||||
|
}
|
||||||
|
/*for (auto bdry : *this)
|
||||||
{
|
{
|
||||||
bdry->updataBoundaryData(1);
|
bdry->updataBoundaryData(1);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
for (auto bdry : *this)
|
ForAllBoundaries(i,*this)
|
||||||
|
{
|
||||||
|
boundary(i).updataBoundaryData(2);
|
||||||
|
}
|
||||||
|
/*for (auto bdry : *this)
|
||||||
{
|
{
|
||||||
bdry->updataBoundaryData(2);
|
bdry->updataBoundaryData(2);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -236,7 +263,16 @@ pFlow::boundaryList::beforeIteration(const timeInfo& ti, bool force)
|
||||||
bool
|
bool
|
||||||
pFlow::boundaryList::iterate(const timeInfo& ti, bool force)
|
pFlow::boundaryList::iterate(const timeInfo& ti, bool force)
|
||||||
{
|
{
|
||||||
for (auto& bdry : *this)
|
ForAllBoundaries(i, *this)
|
||||||
|
{
|
||||||
|
if (!boundary(i).iterate(ti))
|
||||||
|
{
|
||||||
|
fatalErrorInFunction << "Error in iterate in boundary "
|
||||||
|
<< boundary(i).name() << endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*for (auto& bdry : *this)
|
||||||
{
|
{
|
||||||
if (!bdry->iterate(ti))
|
if (!bdry->iterate(ti))
|
||||||
{
|
{
|
||||||
|
@ -244,7 +280,7 @@ pFlow::boundaryList::iterate(const timeInfo& ti, bool force)
|
||||||
<< bdry->name() << endl;
|
<< bdry->name() << endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,7 +293,7 @@ pFlow::boundaryList::afterIteration(const timeInfo& ti, bool force)
|
||||||
int step = 1;
|
int step = 1;
|
||||||
while(callAgain.anyElement(true)&& step <=10)
|
while(callAgain.anyElement(true)&& step <=10)
|
||||||
{
|
{
|
||||||
for(size_t i=0; i<6; i++)
|
ForAllBoundaries(i,*this)
|
||||||
{
|
{
|
||||||
if(callAgain[i])
|
if(callAgain[i])
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@ Licence:
|
||||||
|
|
||||||
#include "domain.hpp"
|
#include "domain.hpp"
|
||||||
#include "boundaryBase.hpp"
|
#include "boundaryBase.hpp"
|
||||||
#include "ListPtr.hpp"
|
#include "boundaryListPtr.hpp"
|
||||||
#include "timeInfo.hpp"
|
#include "timeInfo.hpp"
|
||||||
#include "boundariesMask.hpp"
|
#include "boundariesMask.hpp"
|
||||||
|
|
||||||
|
@ -34,13 +34,11 @@ class pointStructure;
|
||||||
|
|
||||||
class boundaryList
|
class boundaryList
|
||||||
:
|
:
|
||||||
public ListPtr<boundaryBase>
|
public boundaryListPtr<boundaryBase>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//// - data members
|
//// - data members
|
||||||
pointStructure& pStruct_;
|
|
||||||
|
|
||||||
uint32 neighborListUpdateInterval_;
|
uint32 neighborListUpdateInterval_;
|
||||||
|
|
||||||
uint32 updateInterval_;
|
uint32 updateInterval_;
|
||||||
|
@ -53,12 +51,14 @@ private:
|
||||||
|
|
||||||
bool iterBeforeBoundaryUpdate_;
|
bool iterBeforeBoundaryUpdate_;
|
||||||
|
|
||||||
domain extendedDomain_;
|
|
||||||
|
|
||||||
box internalDomainBox_;
|
|
||||||
|
|
||||||
bool listSet_ = false;
|
bool listSet_ = false;
|
||||||
|
|
||||||
|
pointStructure& pStruct_;
|
||||||
|
|
||||||
|
uniquePtr<domain> extendedDomain_;
|
||||||
|
|
||||||
|
box internalDomainBox_;
|
||||||
|
|
||||||
void setExtendedDomain();
|
void setExtendedDomain();
|
||||||
|
|
||||||
bool resetLists();
|
bool resetLists();
|
||||||
|
@ -94,13 +94,13 @@ public:
|
||||||
inline
|
inline
|
||||||
auto& boundary(size_t i)
|
auto& boundary(size_t i)
|
||||||
{
|
{
|
||||||
return ListPtr<boundaryBase>::operator[](i);
|
return boundaryListPtr<boundaryBase>::operator[](i);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
const auto& boundary(size_t i)const
|
const auto& boundary(size_t i)const
|
||||||
{
|
{
|
||||||
return ListPtr<boundaryBase>::operator[](i);
|
return boundaryListPtr<boundaryBase>::operator[](i);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
|
@ -112,13 +112,13 @@ public:
|
||||||
inline
|
inline
|
||||||
const auto& extendedDomain()const
|
const auto& extendedDomain()const
|
||||||
{
|
{
|
||||||
return extendedDomain_;
|
return extendedDomain_();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
const auto& extendedDomainBox()const
|
const auto& extendedDomainBox()const
|
||||||
{
|
{
|
||||||
return extendedDomain_.domainBox();
|
return extendedDomain_->domainBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
box internalDomainBox()const;
|
box internalDomainBox()const;
|
||||||
|
|
|
@ -0,0 +1,186 @@
|
||||||
|
/*------------------------------- phasicFlow ---------------------------------
|
||||||
|
O C enter of
|
||||||
|
O O E ngineering and
|
||||||
|
O O M ultiscale modeling of
|
||||||
|
OOOOOOO F luid flow
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Copyright (C): www.cemf.ir
|
||||||
|
email: hamid.r.norouzi AT gmail.com
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Licence:
|
||||||
|
This file is part of phasicFlow code. It is a free software for simulating
|
||||||
|
granular and multiphase flows. You can redistribute it and/or modify it under
|
||||||
|
the terms of GNU General Public License v3 or any other later versions.
|
||||||
|
|
||||||
|
phasicFlow is distributed to help others in their research in the field of
|
||||||
|
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
||||||
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------*/
|
||||||
|
#ifndef __boundaryListPtr_hpp__
|
||||||
|
#define __boundaryListPtr_hpp__
|
||||||
|
|
||||||
|
#include <bitset>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
|
#include "uniquePtr.hpp"
|
||||||
|
#include "error.h"
|
||||||
|
#include "iOstream.hpp"
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
{
|
||||||
|
|
||||||
|
template<typename BoundaryType>
|
||||||
|
class boundaryListPtr
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
std::array<BoundaryType*,6> boundaries_;
|
||||||
|
|
||||||
|
std::bitset<6> activeBoundaries_=0B000000;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
boundaryListPtr():
|
||||||
|
boundaries_({nullptr, nullptr, nullptr, nullptr, nullptr, nullptr})
|
||||||
|
{}
|
||||||
|
|
||||||
|
void set(size_t i, uniquePtr<BoundaryType>&& ptr )
|
||||||
|
{
|
||||||
|
if( i > boundaries_.size() )
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
"Out of range access of boundaryListPtr members. List size is "<<
|
||||||
|
size() << "and you are accessing "<< i << "\n";
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(boundaries_[i]) delete boundaries_[i];
|
||||||
|
boundaries_[i] = ptr.release();
|
||||||
|
|
||||||
|
if(boundaries_[i])
|
||||||
|
{
|
||||||
|
// query if this boundary active or not
|
||||||
|
activeBoundaries_.set(i,boundaries_[i]->isActive());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
~boundaryListPtr()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void clear()
|
||||||
|
{
|
||||||
|
for(auto& bndry:boundaries_)
|
||||||
|
{
|
||||||
|
if(bndry != nullptr)
|
||||||
|
{
|
||||||
|
delete bndry;
|
||||||
|
bndry = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
activeBoundaries_.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
// - access to ith element
|
||||||
|
inline
|
||||||
|
BoundaryType& operator[](size_t i)
|
||||||
|
{
|
||||||
|
if(boundaries_[i]== nullptr)
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<"Accessing nullptr element"<<endl;
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
return *boundaries_[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
// - const access to ith element
|
||||||
|
// fatalexit if out of range or nullptr
|
||||||
|
inline
|
||||||
|
const BoundaryType& operator[](size_t i) const
|
||||||
|
{
|
||||||
|
if(boundaries_[i]== nullptr)
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<"Accessing nullptr element"<<endl;
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
return *boundaries_[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
BoundaryType* boundaryPtr(size_t i)
|
||||||
|
{
|
||||||
|
if(boundaries_[i]== nullptr)
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<"Accessing nullptr element"<<endl;
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
return boundaries_[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
const BoundaryType* boundaryPtr(size_t i)const
|
||||||
|
{
|
||||||
|
if(boundaries_[i]== nullptr)
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<"Accessing nullptr element"<<endl;
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
return boundaries_[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline constexpr
|
||||||
|
size_t size()const
|
||||||
|
{
|
||||||
|
return 6ul;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
size_t firstActive()const
|
||||||
|
{
|
||||||
|
if(activeBoundaries_[0]) return 0ul;
|
||||||
|
if(activeBoundaries_[1]) return 1ul;
|
||||||
|
if(activeBoundaries_[2]) return 2ul;
|
||||||
|
if(activeBoundaries_[3]) return 3ul;
|
||||||
|
if(activeBoundaries_[4]) return 4ul;
|
||||||
|
if(activeBoundaries_[5]) return 5ul;
|
||||||
|
return 6ul;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
size_t nextActive(size_t i)const
|
||||||
|
{
|
||||||
|
if(i>=5ul) return 6ul;
|
||||||
|
if(activeBoundaries_[i+1])
|
||||||
|
return i+1;
|
||||||
|
else
|
||||||
|
return nextActive(i+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool allActive()const
|
||||||
|
{
|
||||||
|
return activeBoundaries_.all();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool anyActive()const
|
||||||
|
{
|
||||||
|
return activeBoundaries_.any();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool noneActive()const
|
||||||
|
{
|
||||||
|
return activeBoundaries_.none();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#define ForAllBoundaries(i,bndryList) for(size_t i = 0ul; i<(bndryList).size(); i++)
|
||||||
|
#define ForAllBoundariesPtr(i,bndryList) for(size_t i = 0ul; i<bndryList->size(); i++)
|
||||||
|
#define ForAllActiveBoundaries(i,bndryList) for(size_t i = bndryList.firstActive(); i<bndryList.size(); i=bndryList.nextActive(i))
|
||||||
|
#define ForAllActiveBoundariesPtr(i,bndryList) for(size_t i = bndryList->firstActive(); i<bndryList->size(); i=bndryList->nextActive(i))
|
||||||
|
|
||||||
|
#endif //__boundaryListPtr_hpp__
|
|
@ -277,7 +277,7 @@ equal(const uint32& s1, const uint32& s2)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Are two words equal (host only)?
|
/// Are two words equal (host only)?
|
||||||
INLINE_FUNCTION
|
inline
|
||||||
bool
|
bool
|
||||||
equal(const word& s1, const word& s2)
|
equal(const word& s1, const word& s2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,20 +29,22 @@ namespace pFlow
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef pFlow_Build_Double
|
#ifdef pFlow_Build_Double
|
||||||
#define useDouble 1
|
#define UseDouble 1
|
||||||
inline const char* floatingPointType__ = "double";
|
inline const char* floatingPointType__ = "double";
|
||||||
inline const bool usingDouble__ = true;
|
inline const bool usingDouble__ = true;
|
||||||
#else
|
#else
|
||||||
#define useDouble 0
|
#define UseDouble 0
|
||||||
inline const char* floatingPointType__ = "float";
|
inline const char* floatingPointType__ = "float";
|
||||||
inline const bool usingDouble__ = false;
|
inline const bool usingDouble__ = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// scalars
|
// scalars
|
||||||
#if useDouble
|
#if UseDouble
|
||||||
using real = double;
|
using real = double;
|
||||||
#else
|
#else
|
||||||
using real = float;
|
using real = float;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using int8 = signed char;
|
using int8 = signed char;
|
||||||
|
@ -57,21 +59,27 @@ using uint32 = unsigned int;
|
||||||
|
|
||||||
using uint64 = unsigned long long int;
|
using uint64 = unsigned long long int;
|
||||||
|
|
||||||
using id_t = uint32;
|
|
||||||
|
|
||||||
using size_t = std::size_t;
|
|
||||||
|
|
||||||
using word = std::string;
|
using word = std::string;
|
||||||
|
|
||||||
using timeValue = double;
|
using timeValue = double;
|
||||||
|
|
||||||
inline const int numBytesForReal__ = sizeof(real);
|
#ifdef pFlow_Build_Index64
|
||||||
|
#define Index64 1
|
||||||
|
using index = std::size_t;
|
||||||
|
inline const char* IndexType__ = "std::size_t";
|
||||||
|
#else
|
||||||
|
#define Index64 0
|
||||||
|
using index = uint32;
|
||||||
|
inline const char* IndexType__ = "uint32";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
inline word
|
inline word
|
||||||
floatingPointDescription()
|
floatingPointDescription()
|
||||||
{
|
{
|
||||||
return word("In this build, ") + word(floatingPointType__) +
|
return word("In this build, ") + word(floatingPointType__) +
|
||||||
word(" is used for floating point operations.");
|
word(" is used for floating point operations and ") +
|
||||||
|
IndexType__ + "for indexing.";
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end of pFlow
|
} // end of pFlow
|
||||||
|
|
|
@ -114,13 +114,13 @@ struct triple
|
||||||
triple<T>& operator=(triple<T>&& src) = default;
|
triple<T>& operator=(triple<T>&& src) = default;
|
||||||
|
|
||||||
/// clone
|
/// clone
|
||||||
INLINE_FUNCTION
|
inline
|
||||||
uniquePtr<triple<T>> clone() const
|
uniquePtr<triple<T>> clone() const
|
||||||
{
|
{
|
||||||
return makeUnique<triple<T>>(*this);
|
return makeUnique<triple<T>>(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE_FUNCTION
|
inline
|
||||||
triple<T>* clonePtr() const
|
triple<T>* clonePtr() const
|
||||||
{
|
{
|
||||||
return new triple<T>(*this);
|
return new triple<T>(*this);
|
||||||
|
|
|
@ -103,13 +103,13 @@ INLINE_FUNCTION_HD bool
|
||||||
operator>=(const triple<T>& opr1, const triple<T>& opr2);
|
operator>=(const triple<T>& opr1, const triple<T>& opr2);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
INLINE_FUNCTION iOstream&
|
inline iOstream&
|
||||||
operator<<(iOstream& str, const triple<T>& ov);
|
operator<<(iOstream& str, const triple<T>& ov);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
INLINE_FUNCTION iIstream&
|
inline iIstream&
|
||||||
operator>>(iIstream& str, triple<T>& iv);
|
operator>>(iIstream& str, triple<T>& iv);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
INLINE_FUNCTION void
|
inline void
|
||||||
readIstream(iIstream& str, triple<T>& iv);
|
readIstream(iIstream& str, triple<T>& iv);
|
|
@ -287,8 +287,8 @@ pFlow::operator>=(const triple<T>& opr1, const triple<T>& opr2)
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
INLINE_FUNCTION pFlow::iOstream&
|
inline pFlow::iOstream&
|
||||||
pFlow::operator<<(iOstream& str, const triple<T>& ov)
|
pFlow::operator<<(iOstream& str, const triple<T>& ov)
|
||||||
{
|
{
|
||||||
str << token::BEGIN_LIST << ov.x_ << token::SPACE << ov.y_ << token::SPACE
|
str << token::BEGIN_LIST << ov.x_ << token::SPACE << ov.y_ << token::SPACE
|
||||||
<< ov.z_ << token::END_LIST;
|
<< ov.z_ << token::END_LIST;
|
||||||
|
@ -299,8 +299,8 @@ INLINE_FUNCTION pFlow::iOstream&
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
INLINE_FUNCTION pFlow::iIstream&
|
inline pFlow::iIstream&
|
||||||
pFlow::operator>>(iIstream& str, triple<T>& iv)
|
pFlow::operator>>(iIstream& str, triple<T>& iv)
|
||||||
{
|
{
|
||||||
str.readBegin("triple<T>");
|
str.readBegin("triple<T>");
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ INLINE_FUNCTION pFlow::iIstream&
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
INLINE_FUNCTION void
|
inline void
|
||||||
pFlow::readIstream(iIstream& str, triple<T>& iv)
|
pFlow::readIstream(iIstream& str, triple<T>& iv)
|
||||||
{
|
{
|
||||||
str.readBegin("triple<T>");
|
str.readBegin("triple<T>");
|
||||||
|
|
Loading…
Reference in New Issue