mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-07-08 03:07:03 +00:00
Interaction folder is finalized with adjustable box and tested for rotating drum
This commit is contained in:
@ -22,16 +22,17 @@ Licence:
|
||||
#ifndef __ContactSearch_hpp__
|
||||
#define __ContactSearch_hpp__
|
||||
|
||||
|
||||
#include "contactSearchGlobals.hpp"
|
||||
#include "contactSearch.hpp"
|
||||
#include "box.hpp"
|
||||
#include "particles.hpp"
|
||||
#include "geometry.hpp"
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
template<
|
||||
template<class> class BaseMethod,
|
||||
template<class> class WallMapping
|
||||
class searchMethod
|
||||
>
|
||||
class ContactSearch
|
||||
:
|
||||
@ -39,32 +40,19 @@ class ContactSearch
|
||||
{
|
||||
public:
|
||||
|
||||
using IdType = typename contactSearch::IdType;
|
||||
using IdType = uint32;
|
||||
|
||||
using IndexType = typename contactSearch::IndexType;
|
||||
using ExecutionSpace = DefaultExecutionSpace;
|
||||
|
||||
using ExecutionSpace = typename contactSearch::ExecutionSpace;
|
||||
using SearchMethodType = searchMethod;
|
||||
|
||||
using PairContainerType = typename contactSearch::PairContainerType;
|
||||
|
||||
using ParticleContactSearchType =
|
||||
BaseMethod<
|
||||
ExecutionSpace>;
|
||||
|
||||
using WallMappingType =
|
||||
WallMapping<
|
||||
ExecutionSpace>;
|
||||
|
||||
protected:
|
||||
private:
|
||||
|
||||
|
||||
uniquePtr<ParticleContactSearchType> particleContactSearch_ = nullptr;
|
||||
|
||||
uniquePtr<WallMappingType> wallMapping_ = nullptr;
|
||||
uniquePtr<SearchMethodType> ppwContactSearch_ = nullptr;
|
||||
|
||||
public:
|
||||
|
||||
TypeInfoTemplate2("ContactSearch", ParticleContactSearchType, WallMappingType);
|
||||
TypeInfoTemplate11("ContactSearch", SearchMethodType);
|
||||
|
||||
ContactSearch(
|
||||
const dictionary& csDict,
|
||||
@ -74,54 +62,41 @@ public:
|
||||
Timers& timers)
|
||||
:
|
||||
contactSearch(csDict, domain, prtcl, geom, timers)
|
||||
|
||||
{
|
||||
|
||||
auto method = dict().getVal<word>("method");
|
||||
auto wmMethod = dict().getVal<word>("wallMapping");
|
||||
|
||||
|
||||
auto nbDict = dict().subDict(method+"Info");
|
||||
|
||||
real minD, maxD;
|
||||
this->Particles().boundingSphereMinMax(minD, maxD);
|
||||
|
||||
const auto& position = this->Particles().pointPosition().deviceVectorAll();
|
||||
const auto& diam = this->Particles().boundingSphere().deviceVectorAll();
|
||||
const auto& position = this->Particles().pointPosition().deviceViewAll();
|
||||
const auto& flags = this->Particles().dynPointStruct().activePointsMaskDevice();
|
||||
const auto& diam = this->Particles().boundingSphere().deviceViewAll();
|
||||
|
||||
particleContactSearch_ =
|
||||
makeUnique<ParticleContactSearchType>
|
||||
uint32 wnPoints = this->Geometry().numPoints();
|
||||
uint32 wnTri = this->Geometry().size();
|
||||
const auto& wPoints = this->Geometry().points().deviceViewAll();
|
||||
const auto& wVertices = this->Geometry().vertices().deviceViewAll();
|
||||
|
||||
ppwContactSearch_ =
|
||||
makeUnique<SearchMethodType>
|
||||
(
|
||||
nbDict,
|
||||
this->domain(),
|
||||
this->domainBox(),
|
||||
minD,
|
||||
maxD,
|
||||
position,
|
||||
diam
|
||||
);
|
||||
REPORT(2)<<"Contact search algorithm for particle-particle is "<<
|
||||
greenText(particleContactSearch_().typeName())<<endREPORT;
|
||||
|
||||
|
||||
auto wmDict = dict().subDict(wmMethod+"Info");
|
||||
|
||||
int32 wnPoints = this->Geometry().numPoints();
|
||||
int32 wnTri = this->Geometry().size();
|
||||
|
||||
const auto& wPoints = this->Geometry().points().deviceVectorAll();
|
||||
const auto& wVertices = this->Geometry().vertices().deviceVectorAll();
|
||||
|
||||
wallMapping_ =
|
||||
makeUnique<WallMappingType>(
|
||||
wmDict,
|
||||
particleContactSearch_().numLevels(),
|
||||
particleContactSearch_().getCellsLevels(),
|
||||
flags,
|
||||
diam,
|
||||
wnPoints,
|
||||
wnTri,
|
||||
wnTri,
|
||||
wPoints,
|
||||
wVertices
|
||||
);
|
||||
REPORT(2)<<"Wall mapping algorithm for particle-wall is "<<
|
||||
greenText(wallMapping_().typeName())<< endREPORT;
|
||||
);
|
||||
REPORT(2)<<"Contact search algorithm for particle-particle is "<<
|
||||
Green_Text(ppwContactSearch_().typeName())<<END_REPORT;
|
||||
|
||||
}
|
||||
|
||||
@ -130,116 +105,60 @@ public:
|
||||
contactSearch,
|
||||
ContactSearch,
|
||||
dictionary);
|
||||
|
||||
|
||||
bool broadSearch(
|
||||
PairContainerType& ppPairs,
|
||||
PairContainerType& pwPairs,
|
||||
uint32 iter,
|
||||
real t,
|
||||
real dt,
|
||||
csPairContainerType& ppPairs,
|
||||
csPairContainerType& pwPairs,
|
||||
bool force = false) override
|
||||
{
|
||||
|
||||
ppTimer().start();
|
||||
|
||||
const auto& position = Particles().pointPosition().deviceViewAll();
|
||||
const auto& flags = Particles().dynPointStruct().activePointsMaskDevice();
|
||||
const auto& diam = Particles().boundingSphere().deviceViewAll();
|
||||
|
||||
if(particleContactSearch_)
|
||||
|
||||
if( !ppwContactSearch_().broadSearch(
|
||||
iter,
|
||||
t,
|
||||
dt,
|
||||
ppPairs,
|
||||
pwPairs,
|
||||
position,
|
||||
flags,
|
||||
diam,
|
||||
force) )
|
||||
{
|
||||
auto activeRange = this->Particles().activeRange();
|
||||
|
||||
sphereSphereTimer_.start();
|
||||
|
||||
if(this->Particles().allActive())
|
||||
{
|
||||
particleContactSearch_().broadSearch(ppPairs, activeRange, force);
|
||||
}
|
||||
else
|
||||
{
|
||||
particleContactSearch_().broadSearch(ppPairs, activeRange, this->Particles().activePointsMaskD(), force);
|
||||
}
|
||||
|
||||
sphereSphereTimer_.end();
|
||||
|
||||
}
|
||||
else
|
||||
fatalErrorInFunction;
|
||||
return false;
|
||||
|
||||
if(wallMapping_)
|
||||
{
|
||||
sphereWallTimer_.start();
|
||||
wallMapping_().broadSearch(pwPairs, particleContactSearch_(), force);
|
||||
sphereWallTimer_.end();
|
||||
}
|
||||
else
|
||||
return false;
|
||||
ppTimer().end();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ppEnterBroadSearch()const override
|
||||
bool enterBroadSearch(uint32 iter, real t, real dt)const override
|
||||
{
|
||||
if(particleContactSearch_)
|
||||
if(ppwContactSearch_)
|
||||
{
|
||||
return particleContactSearch_().enterBoadSearch();
|
||||
return ppwContactSearch_().performSearch(iter);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool pwEnterBroadSearch()const override
|
||||
bool performedBroadSearch()const override
|
||||
{
|
||||
if(wallMapping_)
|
||||
{
|
||||
return wallMapping_().enterBoadSearch();
|
||||
}
|
||||
return false;
|
||||
return ppwContactSearch_().performedSearch();
|
||||
}
|
||||
|
||||
|
||||
bool ppPerformedBroadSearch()const override
|
||||
{
|
||||
if(particleContactSearch_)
|
||||
{
|
||||
return particleContactSearch_().performedSearch();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool pwPerformedBroadSearch()const override
|
||||
{
|
||||
if(wallMapping_)
|
||||
{
|
||||
return wallMapping_().performedSearch();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*bool update(const eventMessage& msg)
|
||||
{
|
||||
if(msg.isSizeChanged() )
|
||||
{
|
||||
auto newSize = this->prtcl().size();
|
||||
if(!particleContactSearch_().objectSizeChanged(newSize))
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"erro in changing the size for particleContactSearch_ \n";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(msg.isCapacityChanged() )
|
||||
{
|
||||
auto newSize = this->prtcl().capacity();
|
||||
if(!particleContactSearch_().objectSizeChanged(newSize))
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"erro in changing the capacity for particleContactSearch_ \n";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}*/
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user