# PhasicFlow: utilities/particlesPhasicFlow/positionParticles/positionParticles.hpp Source File

positionParticles.hpp
Go to the documentation of this file.
/*------------------------------- 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 __positionParticles_hpp__
#define __positionParticles_hpp__
#include "virtualConstructor.hpp"
#include "Vectors.hpp"
#include "dictionary.hpp"
namespace pFlow
{
class regionBase
{
public:
regionBase() = default;
regionBase(const regionBase&) = default;
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:
uniquePtr<regionBase> region_ = nullptr;
size_t maxNumberOfParticles_ = 10000;
Logical mortonSorting_;
static const size_t numReports_ = 40;
realx3Vector sortByMortonCode(realx3Vector& position)const;
public:
// - type Info
TypeInfo("positionParticles");
positionParticles(const dictionary& dict);
create_vCtor
(
positionParticles,
dictionary,
(const dictionary& dict),
(dict)
);
virtual ~positionParticles() = default;
virtual label numPoints()const = 0;
virtual label size()const = 0;
virtual real maxDiameter() const = 0;
// - const access to position
virtual const realx3Vector& position()const = 0;
// - access to position
virtual realx3Vector& position() = 0;
virtual realx3Vector getFinalPosition();
static
uniquePtr<positionParticles> create(const dictionary & dict);
};
}
#endif // __positionParticles_hpp__
pFlow::positionParticles::create_vCtor
create_vCtor(positionParticles, dictionary,(const dictionary &dict),(dict))
pFlow::region::region
region(const T &rgn)
Definition: positionParticles.hpp:64
pFlow::real
float real
Definition: builtinTypes.hpp:46
pFlow::regionBase::minPoint
virtual realx3 minPoint() const =0
pFlow::regionBase::regionBase
regionBase()=default
pFlow::positionParticles::create
static uniquePtr< positionParticles > create(const dictionary &dict)
Definition: positionParticles.cpp:117
pFlow::positionParticles::numPoints
virtual label numPoints() const =0
pFlow::regionBase::maxPoint
virtual realx3 maxPoint() const =0
pFlow::regionBase
Definition: positionParticles.hpp:31
pFlow::word
std::string word
Definition: builtinTypes.hpp:63
pFlow::region::region_
T region_
Definition: positionParticles.hpp:60
pFlow::positionParticles::~positionParticles
virtual ~positionParticles()=default
Vectors.hpp
pFlow::region
Definition: positionParticles.hpp:54
pFlow::positionParticles::region_
uniquePtr< regionBase > region_
Definition: positionParticles.hpp:106
pFlow::region::region
region(const dictionary &dict)
Definition: positionParticles.hpp:69
pFlow::region::operator=
region & operator=(const region &)=default
pFlow::positionParticles::size
virtual label size() const =0
pFlow::region::name
word name() const override
Definition: positionParticles.hpp:95
pFlow::regionBase::~regionBase
virtual ~regionBase()=default
pFlow::region::maxPoint
realx3 maxPoint() const override
Definition: positionParticles.hpp:90
pFlow
Definition: demComponent.hpp:28
pFlow::positionParticles::numReports_
static const size_t numReports_
Definition: positionParticles.hpp:112
pFlow::regionBase::name
virtual word name() const =0
pFlow::positionParticles::positionParticles
positionParticles(const dictionary &dict)
Definition: positionParticles.cpp:78
dictionary.hpp
pFlow::positionParticles::position
virtual const realx3Vector & position() const =0
pFlow::positionParticles::maxDiameter
virtual real maxDiameter() const =0
virtualConstructor.hpp
pFlow::positionParticles::mortonSorting_
Logical mortonSorting_
Definition: positionParticles.hpp:110
pFlow::positionParticles::TypeInfo
TypeInfo("positionParticles")
pFlow::Logical
Definition: Logical.hpp:35
pFlow::uniquePtr
Definition: uniquePtr.hpp:44
pFlow::positionParticles
Definition: positionParticles.hpp:102
pFlow::region::isInside
bool isInside(const realx3 point) const override
Definition: positionParticles.hpp:80
pFlow::positionParticles::getFinalPosition
virtual realx3Vector getFinalPosition()
Definition: positionParticles.cpp:101
pFlow::positionParticles::maxNumberOfParticles_
size_t maxNumberOfParticles_
Definition: positionParticles.hpp:108
pFlow::label
std::size_t label
Definition: builtinTypes.hpp:61
pFlow::positionParticles::sortByMortonCode
realx3Vector sortByMortonCode(realx3Vector &position) const
Definition: positionParticles.cpp:31
pFlow::regionBase::operator=
regionBase & operator=(const regionBase &)=default
pFlow::triple< real >
pFlow::region::minPoint
realx3 minPoint() const override
Definition: positionParticles.hpp:85
pFlow::Vector< realx3 >
pFlow::regionBase::isInside
virtual bool isInside(const realx3 point) const =0
pFlow::dictionary
Definition: dictionary.hpp:38
pFlow::region::~region
virtual ~region()=default