# PhasicFlow: src/Particles/particles/shape/shape.hpp Source File
PhasicFlow is an open-source parallel DEM (discrete element method) package for simulating granular flow. It is developed in C++ and can be exectued on both GPU (like CUDA) and CPU.

shape.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 __shape_hpp__
#define __shape_hpp__
#include "baseShapeNames.hpp"
#include "property.hpp"
namespace pFlow
{
class shape
:
public baseShapeNames
{
private:
const property& property_;
uint32Vector shapePropertyIds_;
wordVector materialNames_;
bool findPropertyIds();
bool readFromDictionary2();
protected:
bool writeToDict(dictionary& dict)const override;
public:
TypeInfo("shape");
shape(
const word& fileName,
repository* owner,
const property& prop);
~shape() override=default;
inline
const auto& properties()const
{
return property_;
}
inline
const wordVector& materialNames()const
{
return materialNames_;
}
inline
const auto& shapePropertyIds()const
{
return shapePropertyIds_;
}
inline
bool shapeNameToPropId(const word& name, int8& propId)const
{
if(uint32 index; shapeNameToIndex(name, index))
{
propId = shapePropertyIds_[index];
return true;
}
return false;
}
inline
bool propIdValid(uint32 propId)const
{
return static_cast< uint32 >(propId) < property_.numMaterials();
}
inline
bool indexToDensity(uint32 index, real& rho)const
{
if(indexValid(index))
return property_.density(shapePropertyIds_[index], rho);
return false;
}
inline
real indexToDensity(uint32 index)const
{
if(indexValid(index))
{
return property_.density(shapePropertyIds_[index]);
}
fatalExit;
return 0.0;
}
inline
uint32 propertyId(uint32 index)const
{
if(indexValid(index))
{
return shapePropertyIds_[index];
}
fatalExit;
return 0.0;
}
virtual
real maxBoundingSphere()const = 0;
virtual
real minBoundingSphere()const = 0;
virtual
bool boundingDiameter(uint32 index, real& bDiam)const =0;
virtual
real boundingDiameter(uint32 index)const = 0;
virtual
realVector boundingDiameter()const = 0;
virtual
bool mass(uint32 index, real& m)const = 0;
virtual
real mass(uint32 index) const =0;
virtual
realVector mass()const =0;
virtual
realVector density()const =0;
virtual
bool Inertia(uint32 index, real& I)const = 0;
virtual
real Inertia(uint32 index)const = 0;
virtual
realVector Inertia()const=0;
virtual
bool Inertia_xx(uint32 index, real& Ixx)const = 0;
virtual
real Inertial_xx(uint32 index)const =0;
virtual
bool Inertia_yy(uint32 index, real& Iyy)const = 0;
virtual
real Inertial_yy(uint32 index)const = 0;
virtual
bool Inertia_zz(uint32 index, real& Izz)const = 0;
virtual
real Inertial_zz(uint32 index)const = 0;
};
}
#endif //__shape_hpp__
pFlow::shape::~shape
~shape() override=default
pFlow::shape::shapePropertyIds_
uint32Vector shapePropertyIds_
list of property ids of shapes (index)
Definition: shape.hpp:40
pFlow::real
float real
Definition: builtinTypes.hpp:45
fatalExit
#define fatalExit
Fatal exit.
Definition: error.hpp:98
pFlow::shape::propIdValid
bool propIdValid(uint32 propId) const
Definition: shape.hpp:99
pFlow::shape::Inertial_yy
virtual real Inertial_yy(uint32 index) const =0
pFlow::shape::indexToDensity
real indexToDensity(uint32 index) const
Definition: shape.hpp:114
pFlow::baseShapeNames
Definition: baseShapeNames.hpp:33
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
pFlow::baseShapeNames::indexValid
bool indexValid(uint32 index) const
Definition: baseShapeNames.hpp:140
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::shape::shapePropertyIds
const auto & shapePropertyIds() const
Definition: shape.hpp:80
baseShapeNames.hpp
pFlow::shape::TypeInfo
TypeInfo("shape")
pFlow::shape::indexToDensity
bool indexToDensity(uint32 index, real &rho) const
Definition: shape.hpp:106
pFlow::shape::Inertia
virtual realVector Inertia() const =0
pFlow::shape::shape
shape(const word &fileName, repository *owner, const property &prop)
Definition: shape.cpp:41
pFlow::shape::materialNames
const wordVector & materialNames() const
Definition: shape.hpp:74
pFlow::shape::mass
virtual realVector mass() const =0
pFlow::shape::Inertia_xx
virtual bool Inertia_xx(uint32 index, real &Ixx) const =0
pFlow
Definition: demGeometry.hpp:27
pFlow::shape::writeToDict
bool writeToDict(dictionary &dict) const override
Definition: shape.cpp:65
pFlow::shape::property_
const property & property_
property of materials
Definition: shape.hpp:37
pFlow::shape::Inertia_yy
virtual bool Inertia_yy(uint32 index, real &Iyy) const =0
pFlow::shape::Inertial_xx
virtual real Inertial_xx(uint32 index) const =0
pFlow::shape
Definition: shape.hpp:30
pFlow::dictionary::dict
virtual dictionary & dict()
ref to this dictionary, if it is a dictionary
Definition: dictionary.cpp:369
pFlow::shape::Inertia_zz
virtual bool Inertia_zz(uint32 index, real &Izz) const =0
pFlow::baseShapeNames::shapeNameToIndex
bool shapeNameToIndex(const word &name, uint32 &index) const
Definition: baseShapeNames.hpp:100
pFlow::shape::maxBoundingSphere
virtual real maxBoundingSphere() const =0
pFlow::IOobject::owner
const repository * owner() const override
Definition: IOobject.hpp:76
pFlow::shape::minBoundingSphere
virtual real minBoundingSphere() const =0
pFlow::property::numMaterials
auto numMaterials() const
Return number of materials.
Definition: property.hpp:111
pFlow::shape::findPropertyIds
bool findPropertyIds()
Definition: shape.cpp:4
pFlow::iEntry::name
virtual word name() const
name/keyword of entry
Definition: iEntry.hpp:100
pFlow::property
property holds the pure properties of materials.
Definition: property.hpp:37
pFlow::shape::propertyId
uint32 propertyId(uint32 index) const
Definition: shape.hpp:126
pFlow::shape::materialNames_
wordVector materialNames_
list of material names
Definition: shape.hpp:43
pFlow::shape::density
virtual realVector density() const =0
pFlow::int8
signed char int8
Definition: builtinTypes.hpp:48
pFlow::repository
Definition: repository.hpp:34
pFlow::property::density
real density(uint32 i) const
Return density of material i.
Definition: property.hpp:149
pFlow::shape::properties
const auto & properties() const
Definition: shape.hpp:67
property.hpp
pFlow::Vector< uint32 >
m
uint32 m
Definition: NBSLoop.hpp:22
pFlow::shape::shapeNameToPropId
bool shapeNameToPropId(const word &name, int8 &propId) const
Definition: shape.hpp:88
pFlow::shape::Inertial_zz
virtual real Inertial_zz(uint32 index) const =0
pFlow::shape::boundingDiameter
virtual realVector boundingDiameter() const =0
pFlow::dictionary
Dictionary holds a set of data entries or sub-dictionaries that are enclosed in a curely braces or ar...
Definition: dictionary.hpp:67
pFlow::shape::readFromDictionary2
bool readFromDictionary2()
Definition: shape.cpp:24