code recovery regular part

This commit is contained in:
HRN
2024-10-18 23:13:20 +03:30
parent 173d3c4917
commit d3ccf354b7
54 changed files with 1108 additions and 695 deletions

View File

@ -53,6 +53,47 @@ private:
boundaryContactSearchList csBoundaries_;
bool BroadSearch(
const timeInfo& ti,
csPairContainerType& ppPairs,
csPairContainerType& pwPairs,
bool force = false) override
{
const auto& position = Particles().pointPosition().deviceViewAll();
const auto& flags = Particles().dynPointStruct().activePointsMaskDevice();
const auto& diam = Particles().boundingSphere().deviceViewAll();
return ppwContactSearch_().broadSearch(
ti.iter(),
ti.t(),
ti.dt(),
ppPairs,
pwPairs,
position,
flags,
diam,
force
);
}
bool BoundaryBroadSearch(
uint32 bndryIndex,
const timeInfo& ti,
csPairContainerType& ppPairs,
csPairContainerType& pwPairs,
bool force = false)override
{
return csBoundaries_[bndryIndex].broadSearch(
ti.iter(),
ti.t(),
ti.dt(),
ppPairs,
pwPairs,
force
);
}
public:
TypeInfoTemplate11("ContactSearch", SearchMethodType);
@ -108,87 +149,14 @@ public:
);
}
add_vCtor(
contactSearch,
ContactSearch,
dictionary);
bool broadSearch(
uint32 iter,
real t,
real dt,
csPairContainerType& ppPairs,
csPairContainerType& pwPairs,
bool force = false) override
bool enterBroadSearchBoundary(const timeInfo& ti, bool force=false)const override
{
ppTimer().start();
const auto& position = Particles().pointPosition().deviceViewAll();
const auto& flags = Particles().dynPointStruct().activePointsMaskDevice();
const auto& diam = Particles().boundingSphere().deviceViewAll();
if( !ppwContactSearch_().broadSearch(
iter,
t,
dt,
ppPairs,
pwPairs,
position,
flags,
diam,
force) )
{
fatalErrorInFunction;
return false;
}
ppTimer().end();
return true;
}
bool boundaryBroadSearch(
uint32 i,
uint32 iter,
real t,
real dt,
csPairContainerType& ppPairs,
csPairContainerType& pwPairs,
bool force = false)override
{
if(i==0u)
Particles().boundingSphere().updateBoundaries(DataDirection::SlaveToMaster);
return csBoundaries_[i].broadSearch(
iter,
t,
dt,
ppPairs,
pwPairs,
force);
}
bool enterBroadSearch(uint32 iter, real t, real dt)const override
{
if(ppwContactSearch_)
{
return ppwContactSearch_().performSearch(iter);
}
return false;
}
bool performedBroadSearch()const override
{
return ppwContactSearch_().performedSearch();
}
uint32 updateInterval()const override
{
return ppwContactSearch_().updateInterval();
return enterBroadSearch(ti, force) || csBoundaries_.boundariesUpdated();
}
real sizeRatio()const override
@ -196,7 +164,6 @@ public:
return ppwContactSearch_().sizeRatio();
}
real cellExtent()const override
{
return ppwContactSearch_().cellExtent();

View File

@ -26,4 +26,7 @@ pFlow::boundaryContactSearchList::boundaryContactSearchList(
setList(dict, cSearch);
}
bool pFlow::boundaryContactSearchList::boundariesUpdated() const
{
return boundaries_.boundariesUpdated();
}

View File

@ -28,6 +28,14 @@ public:
const contactSearch& cSearch);
~boundaryContactSearchList()=default;
inline
const boundaryList& boundaries()const
{
return boundaries_;
}
bool boundariesUpdated()const;
};

View File

@ -33,8 +33,8 @@ pFlow::contactSearch::contactSearch(
extendedDomainBox_(extDomain),
particles_(prtcl),
geometry_(geom),
ppTimer_("particle-particle contact search", &timers),
pwTimer_("particle-wall contact search", &timers),
bTimer_("Boundary particles contact search", &timers),
ppTimer_("Internal particles contact search", &timers),
dict_(dict)
{
@ -45,6 +45,76 @@ const pFlow::pointStructure &pFlow::contactSearch::pStruct() const
return particles_.pStruct();
}
bool pFlow::contactSearch::broadSearch
(
const timeInfo &ti,
csPairContainerType &ppPairs,
csPairContainerType &pwPairs,
bool force
)
{
if(enterBroadSearch(ti, force))
{
ppTimer_.start();
if( !BroadSearch(
ti,
ppPairs,
pwPairs,
force ) )
{
fatalErrorInFunction;
performedSearch_ = false;
return false;
}
ppTimer_.end();
performedSearch_ = true;
}
else
{
performedSearch_ = false;
}
return true;
}
bool pFlow::contactSearch::boundaryBroadSearch
(
uint32 bndryIndex,
const timeInfo &ti,
csPairContainerType &ppPairs,
csPairContainerType &pwPairs,
bool force
)
{
if(enterBroadSearchBoundary(ti, force))
{
bTimer_.start();
for(uint32 i=0u; i<6u; i++)
{
if(!BoundaryBroadSearch(
i,
ti,
ppPairs,
pwPairs,
force))
{
performedSearchBoundary_ = false;
return false;
}
}
bTimer_.end();
performedSearchBoundary_ = true;
}
else
{
performedSearchBoundary_ = false;
}
return true;
}
pFlow::uniquePtr<pFlow::contactSearch> pFlow::contactSearch::create(
const dictionary &dict,
const box &extDomain,

View File

@ -26,6 +26,7 @@ Licence:
#include "contactSearchGlobals.hpp"
#include "dictionary.hpp"
#include "virtualConstructor.hpp"
#include "timeInfo.hpp"
#include "Timer.hpp"
namespace pFlow
@ -44,16 +45,47 @@ private:
const box& extendedDomainBox_;
/// @brief update interval in terms of iteration numebr
uint32 updateInterval_= 1;
/// @brief last iteration number which contact search has been performed
uint32 lastUpdated_ = 0;
/// @brief performed search?
bool performedSearch_ = false;
/// @brief performed search in boundaries
bool performedSearchBoundary_ = false;
/// const ref to particles
const particles& particles_;
/// const ref to geometry
const geometry& geometry_;
Timer bTimer_;
Timer ppTimer_;
Timer pwTimer_;
dictionary dict_;
virtual
bool BroadSearch(
const timeInfo& ti,
csPairContainerType& ppPairs,
csPairContainerType& pwPairs,
bool force
)=0;
virtual
bool BoundaryBroadSearch(
uint32 bndryIndex,
const timeInfo& ti,
csPairContainerType& ppPairs,
csPairContainerType& pwPairs,
bool force = false
)=0;
public:
TypeInfo("contactSearch");
@ -82,66 +114,92 @@ public:
(dict, domain, prtcl, geom, timers)
);
const auto& dict()const
inline
bool performedSearch()const
{
return performedSearch_;
}
inline
bool performedSearchBoundary()const
{
return performedSearchBoundary_;
}
inline
bool performSearch(uint32 iter, bool force = false)const
{
if((iter-lastUpdated_) % updateInterval_ == 0 || iter == 0 || force )
{
return true;
}
return false;
}
bool enterBroadSearch(const timeInfo& ti, bool force = false)const
{
return performSearch(ti.iter(), force);
}
virtual
bool enterBroadSearchBoundary(const timeInfo& ti, bool force=false)const = 0;
inline
uint32 updateInterval()const
{
return updateInterval_;
}
inline
const dictionary& dict()const
{
return dict_;
}
const auto& extendedDomainBox()const
inline
const box& extendedDomainBox()const
{
return extendedDomainBox_;
}
const auto& Particles()const
inline
const particles& Particles()const
{
return particles_;
}
const pointStructure& pStruct()const;
const auto& Geometry()const
inline
const geometry& Geometry()const
{
return geometry_;
}
auto& ppTimer()
inline
Timer& ppTimer()
{
return ppTimer_;
}
auto& pwTimer()
inline
Timer& bTimer()
{
return pwTimer_;
return bTimer_;
}
virtual
bool broadSearch(
uint32 iter,
real t,
real dt,
const timeInfo& ti,
csPairContainerType& ppPairs,
csPairContainerType& pwPairs,
bool force = false) = 0;
bool force = false);
virtual
bool boundaryBroadSearch(
uint32 i,
uint32 iter,
real t,
real dt,
uint32 bndryIndex,
const timeInfo& ti,
csPairContainerType& ppPairs,
csPairContainerType& pwPairs,
bool force = false)=0;
virtual
bool enterBroadSearch(uint32 iter, real t, real dt)const = 0;
virtual
bool performedBroadSearch()const = 0;
virtual
uint32 updateInterval()const = 0;
bool force = false);
virtual
real sizeRatio()const = 0;

View File

@ -31,48 +31,36 @@ pFlow::particleWallContactSearchs<method>::particleWallContactSearchs
const ViewType1D<real, memory_space> &diam
)
:
domainBox_(domain),
updateInterval_
(
max(dict.getValOrSet<uint32>("updateInterval", 1),1u)
)
{
}
domainBox_(domain)
{}
template <typename method>
bool pFlow::particleWallContactSearchs<method>::broadSearch
(
uint32 iter,
real t,
real dt,
csPairContainerType& ppPairs,
csPairContainerType& pwPairs,
const deviceViewType1D<realx3>& pointPos,
const pFlagTypeDevice& flags,
const deviceViewType1D<real>& diameter,
bool force
)
(
uint32 iter,
real t,
real dt,
csPairContainerType& ppPairs,
csPairContainerType& pwPairs,
const deviceViewType1D<realx3>& pointPos,
const pFlagTypeDevice& flags,
const deviceViewType1D<real>& diameter,
bool force
)
{
if(!getMethod().impl_broadSearch(
ppPairs,
pwPairs,
pointPos,
flags,
diameter))
{
performedSearch_ = false;
if( !performSearch(iter, force) ) return true;
if(!getMethod().impl_broadSearch(
ppPairs,
pwPairs,
pointPos,
flags,
diameter))
{
fatalErrorInFunction<<
"Error in performing particle-particle broadSearch in method"<<
getMethod().typeName()<<endl;
return false;
}
lastUpdated_ = iter;
performedSearch_ = true;
return true;
}
fatalErrorInFunction<<
"Error in performing particle-particle broadSearch in method"<<
getMethod().typeName()<<endl;
return false;
}
return true;
}

View File

@ -48,18 +48,6 @@ private:
/// @brief box enclosing the simulation domain (local to processor)
box domainBox_;
/*/// @brief box enclosing the area for contact search (region with points)
box searchBox_;*/
/// @brief update interval in terms of iteration numebr
uint32 updateInterval_= 1;
/// @brief last iteration number which contact search has been performed
uint32 lastUpdated_ = 0;
/// @brief performed search?
bool performedSearch_ = false;
protected:
inline
@ -98,25 +86,6 @@ public:
const deviceViewType1D<real>& diameter,
bool force = false
);
bool performedSearch()const
{
return performedSearch_;
}
bool performSearch(uint32 iter, bool force = false)const
{
if((iter-lastUpdated_) % updateInterval_ == 0 || iter == 0 || force )
{
return true;
}
return false;
}
uint32 updateInterval()const
{
return updateInterval_;
}
real sizeRatio()const
{