mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-06-12 16:26:23 +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:
@ -18,11 +18,9 @@ Licence:
|
||||
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
#include "positionOrdered.hpp"
|
||||
#include "error.hpp"
|
||||
|
||||
|
||||
#include "streams.hpp"
|
||||
#include "dictionary.hpp"
|
||||
#include "positionOrdered.hpp"
|
||||
|
||||
|
||||
bool pFlow::positionOrdered::findAxisIndex()
|
||||
@ -45,9 +43,9 @@ bool pFlow::positionOrdered::findAxisIndex()
|
||||
return false;
|
||||
}
|
||||
|
||||
realx3 uV[3];
|
||||
std::array<realx3,3> uV;
|
||||
size_t i=0;
|
||||
for(auto& ca: axisOrder_)
|
||||
for(const auto& ca: axisOrder_)
|
||||
{
|
||||
if(ca == "x")
|
||||
{
|
||||
@ -82,15 +80,16 @@ bool pFlow::positionOrdered::positionPointsOrdered()
|
||||
position_.clear();
|
||||
|
||||
realx3 dl(diameter_);
|
||||
auto minP = region_->minPoint();
|
||||
auto maxP = region_->maxPoint();
|
||||
const auto& region = pRegion();
|
||||
auto minP = region.minPoint();
|
||||
auto maxP = region.maxPoint();
|
||||
|
||||
auto cntr = minP;
|
||||
|
||||
size_t n = 0;
|
||||
while( n < numPoints_ )
|
||||
{
|
||||
if(region_->isInside(cntr))
|
||||
if(region.isInside(cntr))
|
||||
{
|
||||
position_.push_back(cntr);
|
||||
n++;
|
||||
@ -130,7 +129,7 @@ pFlow::positionOrdered::positionOrdered
|
||||
positionParticles(control, dict),
|
||||
poDict_
|
||||
(
|
||||
dict.subDict("positionOrderedInfo")
|
||||
dict.subDict("orderedInfo")
|
||||
),
|
||||
diameter_
|
||||
(
|
||||
@ -146,7 +145,10 @@ pFlow::positionOrdered::positionOrdered
|
||||
),
|
||||
position_
|
||||
(
|
||||
"positionOrdered", maxNumberOfParticles_, numPoints_ ,RESERVE()
|
||||
"positionOrdered",
|
||||
max(maxNumberOfParticles(), numPoints_),
|
||||
numPoints_ ,
|
||||
RESERVE()
|
||||
)
|
||||
{
|
||||
|
||||
@ -155,13 +157,6 @@ pFlow::positionOrdered::positionOrdered
|
||||
fatalExit;
|
||||
}
|
||||
|
||||
if(!region_)
|
||||
{
|
||||
fatalErrorInFunction<<"You must provided a region (box, cylinder, ...) for positioning particles in dictionary "<<
|
||||
dict.globalName()<<endl;
|
||||
fatalExit;
|
||||
}
|
||||
|
||||
if(!positionPointsOrdered())
|
||||
{
|
||||
fatalExit;
|
||||
|
@ -31,13 +31,13 @@ class positionOrdered
|
||||
:
|
||||
public positionParticles
|
||||
{
|
||||
protected:
|
||||
private:
|
||||
|
||||
dictionary poDict_;
|
||||
|
||||
real diameter_;
|
||||
|
||||
size_t numPoints_;
|
||||
uint32 numPoints_;
|
||||
|
||||
wordList axisOrder_;
|
||||
|
||||
@ -60,7 +60,7 @@ protected:
|
||||
public:
|
||||
|
||||
// - type Info
|
||||
TypeInfo("positionOrdered");
|
||||
TypeInfo("ordered");
|
||||
|
||||
positionOrdered(
|
||||
systemControl& control,
|
||||
@ -72,33 +72,33 @@ public:
|
||||
positionOrdered,
|
||||
dictionary);
|
||||
|
||||
virtual ~positionOrdered() = default;
|
||||
~positionOrdered() final = default;
|
||||
|
||||
//// - Methods
|
||||
|
||||
virtual uint64 numPoints()const
|
||||
uint32 numPoints()const final
|
||||
{
|
||||
return position_.size();
|
||||
return static_cast<uint32>(position_.size());
|
||||
}
|
||||
|
||||
virtual uint64 size()const
|
||||
uint32 size()const final
|
||||
{
|
||||
return position_.size();
|
||||
return static_cast<uint32>(position_.size());
|
||||
}
|
||||
|
||||
real maxDiameter() const override
|
||||
real maxDiameter() const final
|
||||
{
|
||||
return diameter_;
|
||||
}
|
||||
|
||||
// - const access to position
|
||||
virtual const realx3Vector& position()const
|
||||
const realx3Vector& position()const final
|
||||
{
|
||||
return position_;
|
||||
}
|
||||
|
||||
// - access to position
|
||||
virtual realx3Vector& position()
|
||||
realx3Vector& position() final
|
||||
{
|
||||
return position_;
|
||||
}
|
||||
|
Reference in New Issue
Block a user