mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-06-22 16:28:30 +00:00
Collision check and particlePosition -> random
- A new class is added for simple collision check - position particles in utility is upgraded - morton sorting is not active yet for particlesPhasicFlow
This commit is contained in:
@ -20,16 +20,11 @@ Licence:
|
||||
|
||||
#include "positionParticles.hpp"
|
||||
#include "vocabs.hpp"
|
||||
#include "box.hpp"
|
||||
#include "cylinder.hpp"
|
||||
#include "sphere.hpp"
|
||||
#include "cells.hpp"
|
||||
//#include "contactSearchFunctions.hpp"
|
||||
#include "dictionary.hpp"
|
||||
#include "systemControl.hpp"
|
||||
|
||||
#include "streams.hpp"
|
||||
|
||||
|
||||
pFlow::realx3Vector pFlow::positionParticles::sortByMortonCode(realx3Vector& position)const
|
||||
pFlow::realx3Vector pFlow::positionParticles::sortByMortonCode(
|
||||
const realx3Vector& position)const
|
||||
{
|
||||
struct indexMorton
|
||||
{
|
||||
@ -81,25 +76,20 @@ pFlow::positionParticles::positionParticles
|
||||
systemControl& control,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
regionType_(dict.getValOrSet<word>("regionType", "domain")),
|
||||
maxNumberOfParticles_(dict.getValOrSet(
|
||||
"maxNumberOfParticles",
|
||||
static_cast<uint32>(10000))),
|
||||
mortonSorting_(dict.getValOrSet("mortonSorting", Logical("Yes")))
|
||||
{
|
||||
maxNumberOfParticles_ = dict.getValOrSet("maxNumberOfParticles", static_cast<uint64>(10000));
|
||||
|
||||
mortonSorting_ = dict.getValOrSet("mortonSorting", Logical("Yes"));
|
||||
|
||||
if( dict.containsDictionay("box") )
|
||||
if( regionType_ != "domain" )
|
||||
{
|
||||
region_ = makeUnique<region<box>>(dict.subDict("box"));
|
||||
}
|
||||
else if(dict.containsDictionay("cylinder"))
|
||||
{
|
||||
WARNING<<"cylinder region is not set!"<<END_WARNING;
|
||||
//region_ = makeUnique<region<cylinder>>(dict.subDict("cylinder"));
|
||||
}
|
||||
else if(dict.containsDictionay("sphere"))
|
||||
{
|
||||
WARNING<<"sphere region is not set!"<<END_WARNING;
|
||||
//region_ = makeUnique<region<sphere>>(dict.subDict("sphere"));
|
||||
}
|
||||
pRegion_ = peakableRegion::create(
|
||||
regionType_,
|
||||
dict.subDict(regionType_+"Info"));
|
||||
}
|
||||
else
|
||||
{
|
||||
fileDictionary domainDict
|
||||
@ -113,7 +103,7 @@ pFlow::positionParticles::positionParticles
|
||||
},
|
||||
&control.settings()
|
||||
);
|
||||
region_ = makeUnique<region<box>>( domainDict.subDict("globalBox"));
|
||||
pRegion_ = peakableRegion::create(regionType_,domainDict.subDict("globalBox"));
|
||||
}
|
||||
|
||||
}
|
||||
@ -128,9 +118,8 @@ pFlow::realx3Vector pFlow::positionParticles::getFinalPosition()
|
||||
else
|
||||
{
|
||||
realx3Vector vec("final position",position().capacity(), 0 , RESERVE());
|
||||
vec.assign( position().begin(), position().end());
|
||||
|
||||
return std::move(vec);
|
||||
vec.assign( position().begin(), position().end());
|
||||
return vec;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,96 +23,39 @@ Licence:
|
||||
|
||||
#include "virtualConstructor.hpp"
|
||||
#include "Vectors.hpp"
|
||||
#include "dictionary.hpp"
|
||||
#include "systemControl.hpp"
|
||||
#include "peakableRegion.hpp"
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
class regionBase
|
||||
{
|
||||
public:
|
||||
|
||||
regionBase() = default;
|
||||
|
||||
regionBase(const regionBase&) = default;
|
||||
class dictionary;
|
||||
class systemControl;
|
||||
|
||||
regionBase& operator =(const regionBase&) = default;
|
||||
|
||||
virtual ~regionBase() = default;
|
||||
|
||||
virtual bool isInside(const realx3 point)const = 0;
|
||||
|
||||
virtual realx3 minPoint()const =0;
|
||||
|
||||
virtual realx3 maxPoint()const =0;
|
||||
|
||||
virtual word name()const =0;
|
||||
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class region
|
||||
:
|
||||
public regionBase
|
||||
{
|
||||
protected:
|
||||
|
||||
T region_;
|
||||
|
||||
public:
|
||||
|
||||
region(const T& rgn)
|
||||
:
|
||||
region_(rgn)
|
||||
{}
|
||||
|
||||
region(const dictionary& dict)
|
||||
:
|
||||
region_(dict)
|
||||
{}
|
||||
|
||||
region(const region&) = default;
|
||||
|
||||
region& operator =(const region&) = default;
|
||||
|
||||
virtual ~region()=default;
|
||||
|
||||
bool isInside(const realx3 point) const override
|
||||
{
|
||||
return region_.isInside(point);
|
||||
}
|
||||
|
||||
realx3 minPoint()const override
|
||||
{
|
||||
return region_.minPoint();
|
||||
}
|
||||
|
||||
realx3 maxPoint()const override
|
||||
{
|
||||
return region_.maxPoint();
|
||||
}
|
||||
|
||||
word name()const override
|
||||
{
|
||||
return region_.typeName();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class positionParticles
|
||||
{
|
||||
protected:
|
||||
private:
|
||||
|
||||
uniquePtr<regionBase> region_ = nullptr;
|
||||
uniquePtr<peakableRegion> pRegion_ = nullptr;
|
||||
|
||||
size_t maxNumberOfParticles_ = 10000;
|
||||
word regionType_;
|
||||
|
||||
uint32 maxNumberOfParticles_ = 10000;
|
||||
|
||||
Logical mortonSorting_;
|
||||
|
||||
static const size_t numReports_ = 40;
|
||||
|
||||
|
||||
realx3Vector sortByMortonCode(realx3Vector& position)const;
|
||||
realx3Vector sortByMortonCode(const realx3Vector& position)const;
|
||||
|
||||
protected:
|
||||
|
||||
static const uint32 numReports_ = 40;
|
||||
|
||||
const auto& pRegion()const
|
||||
{
|
||||
return pRegion_();
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@ -133,11 +76,22 @@ public:
|
||||
|
||||
virtual ~positionParticles() = default;
|
||||
|
||||
//// - Methods
|
||||
//// - Methods
|
||||
|
||||
virtual uint64 numPoints()const = 0;
|
||||
bool mortonSorting()const
|
||||
{
|
||||
return mortonSorting_();
|
||||
}
|
||||
|
||||
virtual uint64 size()const = 0;
|
||||
inline
|
||||
auto maxNumberOfParticles()const
|
||||
{
|
||||
return maxNumberOfParticles_;
|
||||
}
|
||||
|
||||
virtual uint32 numPoints()const = 0;
|
||||
|
||||
virtual uint32 size()const = 0;
|
||||
|
||||
virtual real maxDiameter() const = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user