# PhasicFlow: sphereShape Class Reference
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.

sphereShape Class Reference
Inheritance diagram for sphereShape:
[legend]
Collaboration diagram for sphereShape:
[legend]

## Public Member Functions

| TypeInfo ("shape<sphere>")
| sphereShape (const word &fileName, repository *owner, const property &prop)
| ~sphereShape () override=default
real | maxBoundingSphere () const override
real | minBoundingSphere () const override
bool | boundingDiameter (uint32 index, real &bDiam) const override
real | boundingDiameter (uint32 index) const override
realVector | boundingDiameter () const override
bool | mass (uint32 index, real &m) const override
real | mass (uint32 index) const override
realVector | mass () const override
realVector | density () const override
bool | Inertia (uint32 index, real &I) const override
real | Inertia (uint32 index) const override
realVector | Inertia () const override
bool | Inertia_xx (uint32 index, real &Ixx) const override
real | Inertial_xx (uint32 index) const override
bool | Inertia_yy (uint32 index, real &Iyy) const override
real | Inertial_yy (uint32 index) const override
bool | Inertia_zz (uint32 index, real &Izz) const override
real | Inertial_zz (uint32 index) const override
Public Member Functions inherited from shape
| TypeInfo ("shape")
| shape (const word &fileName, repository *owner, const property &prop)
| ~shape () override=default
const auto & | properties () const
const wordVector & | materialNames () const
const auto & | shapePropertyIds () const
bool | shapeNameToPropId (const word &name, int8 &propId) const
bool | propIdValid (uint32 propId) const
bool | indexToDensity (uint32 index, real &rho) const
real | indexToDensity (uint32 index) const
uint32 | propertyId (uint32 index) const
Public Member Functions inherited from baseShapeNames
| TypeInfo ("baseShapeNames")
| baseShapeNames (const word &fileName, repository *owner)
| ~baseShapeNames () override=default
const wordVector & | shapeNames () const
wordList | shapeNameList () const
const auto & | hashes () const
size_t | numShapes () const
bool | shapeNameToIndex (const word &name, uint32 &index) const
bool | indexToShapeName (uint32 i, word &name) const
bool | hashToIndex (const size_t &hs, uint32 &idx)
bool | indexValid (uint32 index) const
bool | write (iOstream &os) const override
| write to stream More...
bool | write (iOstream &os, const IOPattern &iop) const override
| write to stream More...
Public Member Functions inherited from fileDictionary
| TypeInfo ("fileDictionary")
| fileDictionary (const objectFile &of, repository *owner=nullptr)
| construct an empty dictionary with keyword and make it global/fileDictionary More...
| fileDictionary (const word &keyword, const fileSystem &file)
| construct a dictionary with name and read it from file More...
| fileDictionary (const objectFile &objf, const dictionary &dict, repository *owner=nullptr)
bool | read (iIstream &is, const IOPattern &iop) override
| read from stream More...
bool | write (iOstream &os, const IOPattern &iop) const override
| write to stream More...
bool | read (iIstream &is) override
| read from stream More...
bool | write (iOstream &os) const override
| write to stream More...
Public Member Functions inherited from IOobject
virtual word | typeName () const =0
| IOobject (const objectFile &objf, const IOPattern &iop, repository *owner)
| ~IOobject () override
| IOobject (const IOobject &src)=delete
| IOobject (IOobject &&src)=delete
const IOPattern & | ioPattern () const
const repository * | owner () const override
repository * | owner ()
repository * | releaseOwner (bool fromOwner=false)
bool | isIncluded (const word &objName) const override
bool | isExcluded (const word &objName) const override
bool | readObject (bool rdHdr=true)
bool | writeObject () const
bool | readObject (iIstream &is, bool rdHdr=true)
bool | writeObject (iOstream &os) const
Public Member Functions inherited from IOfileHeader
| IOfileHeader (const objectFile &objf)
const word & | objectName () const
const word & | objectType () const
fileSystem | path () const
bool | outFileBinary () const
bool | inFileBinary () const
bool | headerOk (bool silent=false)
bool | implyRead () const
| Imply read. More...
bool | implyWrite () const
| Imply write. More...
bool | fileExist () const
| Check if file exists. More...
bool | readIfPresent () const
| Check read if present. More...
bool | writeHeader () const
| Check if the header should be written to file True: on master + implyWrite + readWriteHeader = true False: otherwise. More...
bool | writeHeader (iOstream &os, const word &typeName, bool forceWrite=false) const
| Write the header to the file , typeName comes from caller. More...
bool | writeHeader (iOstream &os, bool forceWrite=false) const
| Write the header to the file, typeName comes from the one read from file. More...
bool | readHeader () const
| Check if header should be read from file. More...
bool | readHeader (iIstream &is, bool silent=false)
| Read the header in the file. More...
bool | writeBanner (iOstream &os) const
| write the banner More...
bool | writeSeparator (iOstream &os) const
| wirte a separator line More...
Public Member Functions inherited from objectFile
| objectFile (const word &name)
| objectFile (const word &name, const fileSystem &localPath, const readFlag &rf=readFlag::READ_NEVER, const writeFlag &wf=writeFlag::WRITE_NEVER, bool rwHeader=true)
| objectFile (const objectFile &src)=default
| objectFile (objectFile &&src)=default
objectFile & | operator= (const objectFile &rhs)=default
objectFile & | operator= (objectFile &&rhs)=default
virtual | ~objectFile ()=default
virtual const word & | name () const
virtual const fileSystem & | localPath () const
readFlag | rFlag () const
writeFlag | wFlag () const
bool | isReadAlways () const
bool | isReadNever () const
bool | isReadIfPresent () const
bool | isWriteAlways () const
bool | isWriteNever () const
bool | readWriteHeader () const
Public Member Functions inherited from dictionary
| TypeInfo ("dictionary")
| dictionary (const word &keyword, bool global)
| construct an empty dictionary with keyword and make it global/fileDictionary (if true) More...
| dictionary (const word &keyword, const fileSystem &file)
| construct a dictionary with name and read it from file More...
| dictionary ()
| cunstructs a null dictionary More...
| dictionary (const word &keyword)
| construct an empty dictionary with keyword More...
| dictionary (const word &keyword, const dictionary &parDict)
| cunstruct an empty dictionary with keyword and parDict More...
| dictionary (const word &keyword, const dictionary &parDict, iIstream &is)
| cunstruct a dictionary with keyword and parDict and from stream More...
| dictionary (const word &keyword, const dictionary &parDict, const dictionary &dict)
| copy construct with keyword and new parrent dict discard the keyword and parDict of dict More...
| dictionary (const dictionary &)
| copy construct as default behavior entries_ are copied smoothly. More...
| dictionary (const dictionary &src, bool global)
dictionary & | operator= (const dictionary &rhs)
| assignment preserve name of this dictionary only entries are transfered with ownership More...
virtual dictionary * | dictPtr ()
| pointer to this dictionary More...
virtual const dictionary * | dictPtr () const
| pointer to this dictionary More...
virtual bool | isDictionary () const
| if this is a dictionary More...
virtual word | globalName () const
| global name of entry, separated with dots More...
virtual const dictionary & | parrentDict () const
| const ref to parrent dictionary More...
virtual dictionary & | dict ()
| ref to this dictionary, if it is a dictionary More...
virtual const dictionary & | dict () const
| const ref to this dictionary, if it is a dictionary More...
virtual bool | isFileDict () const
| if dictionary is file dictionary, return false More...
bool | addPtr (const word &keyword, uniquePtr< iEntry > &etry, bool warning=true)
| add a pointer entry (dictionary/dataEntry) replaces this entry with existing one and issue a warning More...
bool | add (const word &keyword, const float &v)
| add a float dataEntry More...
bool | add (const word &keyword, const double &v)
| add a double dataEntry More...
bool | add (const word &keyword, const word &v)
| add a word dataEntry More...
bool | add (const word &keyword, const int64 &v)
| add a int64 dataEntry More...
bool | add (const word &keyword, const int32 &v)
| add a int32 dataEntry More...
bool | add (const word &keyword, const int8 &v)
| add a int8 dataEntry More...
bool | add (const word &keyword, const uint64 &v)
| add a uint64 dataEntry More...
bool | add (const word &keyword, const uint32 &v)
| add a uint32 dataEntry More...
bool | add (const word &keyword, const uint8 &v)
| add a uint8 dataEntry More...
bool | addDict (const word &keyword, const dictionary &dict)
| add a dictionary with the specifiedd keyword, if it exists, replace it. More...
template<typename T >
bool | add (const word &keyword, const T &v)
| add a dataEntry of type T More...
template<typename T >
bool | addOrKeep (const word &keyword, const T &v)
template<typename T >
bool | addOrReplace (const word &keyword, const T &v)
void | clear ()
dictionary * | subDictPtr (const word &keyword)
| pointer to a subdictionary fatalExit if not found More...
dictionary & | subDict (const word &keyword)
| ref to a subdictioanry fatalExit if not found More...
const dictionary & | subDict (const word &keyword) const
| const ref to a subdictioanry fatalExit if not found More...
dataEntry * | dataEntryPtr (const word &keyword)
| pointer to a dataEntry fatalExit if not found/not a dataEntry More...
dataEntry & | dataEntryRef (const word &keyword)
| ref to a subdictioanry fatalExit if not found/not a dataEntry More...
const dataEntry & | dataEntryRef (const word &keyword) const
| const ref to a subdictioanry fatalExit if not found/not a dataEntry More...
dictionary & | subDictOrCreate (const word &keyword)
| search for a sub-dict with keyword create a new sub-dict if not found and return a ref to it fatalExit if fails More...
template<typename T >
T | getVal (const word &keyword) const
| get the value of data entry More...
template<typename T >
T | getValMax (const word &keyword, const T &maxVal) const
| get the value of data entry and return max(value, maxVal) More...
template<typename T >
T | getValMin (const word &keyword, const T &minVal) const
| get the value of data entry and return min(value, minVal) More...
template<typename T >
T | getValOrSet (const word &keyword, const T &setVal) const
| get the value of data entry or if not found, set the value to setVal More...
template<typename T >
T | getValOrSetMax (const word &keyword, const T &setMaxVal) const
| get the value of data entry anf return max(setMaxVal, value) if not found, set the value to setMaxVal More...
template<typename T >
T | getValOrSetMin (const word &keyword, const T &setMinVal) const
| get the value of data entry anf return max(setMinVal, value) if not found, set the value to setMinVal More...
size_t | numEntries () const
| return number of entris in this dictionary More...
size_t | numDataEntries () const
| return number of non-nullptr dataEntries More...
size_t | numDictionaries () const
| return number of non-nullptr dictionaries More...
wordList | allKeywords () const
| return all keywords (non-nullptr) in this dictionary More...
wordList | dataEntryKeywords () const
| return a list of all dataEntries (non-nullptr) keywords More...
wordList | dictionaryKeywords () const
| return a list of all dictionary (non-null) keywords More...
bool | containsDictionay (const word &name) const
| check if a sub-dictionary exists More...
bool | containsDataEntry (const word &name) const
| check if a data entry exist More...
virtual uniquePtr< iEntry > | clone () const
| clone polymorphic object (here dictionary) More...
virtual iEntry * | clonePtr () const
| clone the object More...
virtual uniquePtr< iEntry > | clone (const dictionary &parDict) const
| clone the polymorhpic object with parDict as the new parrent dictionary More...
virtual iEntry * | clonePtr (const dictionary &parDict) const
| clone the object and change its ownership to parDict More...
bool | read (iIstream &is) override
| read from stream More...
bool | write (iOstream &os) const override
| write to stream More...
Public Member Functions inherited from iEntry
| TypeInfo ("iEntry")
| Type info. More...
| iEntry ()
| empty constructor More...
| iEntry (const word &key)
| construct with a keyword More...
virtual | ~iEntry ()
| destructor More...
virtual const word & | keyword () const
| return keyword More...
virtual word & | keyword ()
| return keyword More...
virtual word | name () const
| name/keyword of entry More...

## Protected Member Functions

bool | writeToDict (dictionary &dict) const override
Protected Member Functions inherited from IOfileHeader
uniquePtr< iFstream > | inStream () const
uniquePtr< oFstream > | outStream () const
uniquePtr< oFstream > | dummyOutStream () const
Protected Member Functions inherited from dictionary
iEntry * | findEntry (const word &keyword)
| find an entry based on keyword return nullptr if not found More...
iEntry * | findEntry (const word &keyword) const
| find and entry based on keyword return nullptr if not found More...
template<typename T >
bool | readDataEntry (const word &keyword, T &val) const
| reads a dataEntry with keyword from dictionary More...
bool | readDictionary (iIstream &is)
| read dictionary from stream - without keyword More...
bool | writeDictionary (iOstream &os, bool withBlock=true) const
| write dictionary to stream - with keyword More...
Protected Member Functions inherited from iEntry
bool | writeKeyword (iOstream &os) const

## Private Member Functions

bool | readFromDictionary3 ()

## Private Attributes

realVector | diameters_

## Additional Inherited Members

Public Types inherited from objectFile
enum | readFlag { READ_ALWAYS, READ_NEVER, READ_IF_PRESENT }
enum | writeFlag { WRITE_ALWAYS, WRITE_NEVER }
Static Public Member Functions inherited from iEntry
static bool | readKeyword (iIstream &is, word &keyword, token &tok)
| read a keyword from stream More...
static bool | createEntry (dictionary &parDict, iIstream &is, bool hasBlockToken=false)
| create an entry (dataEntry or dictionary) from stream More...
Static Public Attributes inherited from dictionary
static dictionary | nullDict
Protected Attributes inherited from IOfileHeader
word | objectName_
word | objectType_
word | fileFormat_ = "ASCII"
| file format read from file More...
Protected Attributes inherited from dictionary
word | name_
| global name of dictionary, separated with dots More...
wordOrderedMapPtr< iEntry > | entries_
| all the entries (data and dictionary) of the current dictionary More...
List< iEntry * > | orderedEntries_
| entries in order of insertion More...
const dictionary & | parDict_
| ref to parrent dictionary More...
bool | isGlobal_ = false
Protected Attributes inherited from iEntry
word | keyword_

## Detailed Description

Definition at line 29 of file sphereShape.hpp.

## Constructor & Destructor Documentation

## sphereShape()

sphereShape | ( | const word & | fileName,
|  | repository * | owner,
|  | const property & | prop
| ) |  |

Definition at line 55 of file sphereShape.cpp.

References fatalErrorInFunction, and fatalExit.

## ~sphereShape()

~sphereShape | ( |  | ) |

overridedefault

## Member Function Documentation

## readFromDictionary3()

bool readFromDictionary3 | ( |  | ) |

private

Definition at line 24 of file sphereShape.cpp.

References sphereShape::diameters_, pFlow::endl(), fatalErrorInFunction, dictionary::globalName(), baseShapeNames::numShapes(), and Vector< T, Allocator >::size().

Here is the call graph for this function:

## writeToDict()

bool writeToDict | ( | dictionary & | dict | ) | const

overrideprotectedvirtual

Reimplemented from shape.

Definition at line 39 of file sphereShape.cpp.

References dictionary::add(), pFlow::endl(), fatalErrorInFunction, dictionary::globalName(), and shape::writeToDict().

Here is the call graph for this function:

## TypeInfo()

TypeInfo | ( | "shape<sphere>" |  | ) |

## maxBoundingSphere()

pFlow::real maxBoundingSphere | ( |  | ) | const

overridevirtual

Implements shape.

Definition at line 71 of file sphereShape.cpp.

References pFlow::max().

Here is the call graph for this function:

## minBoundingSphere()

pFlow::real minBoundingSphere | ( |  | ) | const

overridevirtual

Implements shape.

Definition at line 76 of file sphereShape.cpp.

References pFlow::min().

Here is the call graph for this function:

## boundingDiameter() [1/3]

bool boundingDiameter | ( | uint32 | index,
|  | real & | bDiam
| ) |  | const

overridevirtual

Implements shape.

Definition at line 81 of file sphereShape.cpp.

Referenced by sphereParticles::initializeParticles().

Here is the caller graph for this function:

## boundingDiameter() [2/3]

pFlow::real boundingDiameter | ( | uint32 | index | ) | const

overridevirtual

Implements shape.

Definition at line 91 of file sphereShape.cpp.

References pFlow::endl(), fatalErrorInFunction, and fatalExit.

Here is the call graph for this function:

## boundingDiameter() [3/3]

pFlow::realVector boundingDiameter | ( |  | ) | const

overridevirtual

Implements shape.

Definition at line 103 of file sphereShape.cpp.

## mass() [1/3]

bool mass | ( | uint32 | index,
|  | real & | m
| ) |  | const

overridevirtual

Implements shape.

Definition at line 108 of file sphereShape.cpp.

References m, pFlow::Pi, and pFlow::pow().

Referenced by sphereParticles::initializeParticles().

Here is the call graph for this function:
Here is the caller graph for this function:

## mass() [2/3]

pFlow::real mass | ( | uint32 | index | ) | const

overridevirtual

Implements shape.

Definition at line 120 of file sphereShape.cpp.

References pFlow::endl(), fatalErrorInFunction, fatalExit, and m.

Here is the call graph for this function:

## mass() [3/3]

pFlow::realVector mass | ( |  | ) | const

overridevirtual

Implements shape.

Definition at line 131 of file sphereShape.cpp.

References pFlow::Pi, and pFlow::pow().

Here is the call graph for this function:

## density()

pFlow::realVector density | ( |  | ) | const

overridevirtual

Implements shape.

Definition at line 136 of file sphereShape.cpp.

References ForAll.

## Inertia() [1/3]

bool Inertia | ( | uint32 | index,
|  | real & | I
| ) |  | const

overridevirtual

Implements shape.

Definition at line 147 of file sphereShape.cpp.

References pFlow::pow().

Referenced by sphereParticles::initializeParticles().

Here is the call graph for this function:
Here is the caller graph for this function:

## Inertia() [2/3]

pFlow::real Inertia | ( | uint32 | index | ) | const

overridevirtual

Implements shape.

Definition at line 157 of file sphereShape.cpp.

References fatalExit.

## Inertia() [3/3]

pFlow::realVector Inertia | ( |  | ) | const

overridevirtual

Implements shape.

Definition at line 167 of file sphereShape.cpp.

References pFlow::pow().

Here is the call graph for this function:

## Inertia_xx()

bool Inertia_xx | ( | uint32 | index,
|  | real & | Ixx
| ) |  | const

overridevirtual

Implements shape.

Definition at line 172 of file sphereShape.cpp.

## Inertial_xx()

pFlow::real Inertial_xx | ( | uint32 | index | ) | const

overridevirtual

Implements shape.

Definition at line 177 of file sphereShape.cpp.

## Inertia_yy()

bool Inertia_yy | ( | uint32 | index,
|  | real & | Iyy
| ) |  | const

overridevirtual

Implements shape.

Definition at line 182 of file sphereShape.cpp.

## Inertial_yy()

pFlow::real Inertial_yy | ( | uint32 | index | ) | const

overridevirtual

Implements shape.

Definition at line 187 of file sphereShape.cpp.

## Inertia_zz()

bool Inertia_zz | ( | uint32 | index,
|  | real & | Izz
| ) |  | const

overridevirtual

Implements shape.

Definition at line 192 of file sphereShape.cpp.

## Inertial_zz()

pFlow::real Inertial_zz | ( | uint32 | index | ) | const

overridevirtual

Implements shape.

Definition at line 197 of file sphereShape.cpp.

## Member Data Documentation

## diameters_

realVector diameters_

private

Definition at line 36 of file sphereShape.hpp.

Referenced by sphereShape::readFromDictionary3().

The documentation for this class was generated from the following files:

- src/Particles/SphereParticles/sphereShape/sphereShape.hpp
- src/Particles/SphereParticles/sphereShape/sphereShape.cpp