# PhasicFlow: sphereInteraction< contactForceModel, geometryMotionModel, contactListType > Class Template 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.

sphereInteraction< contactForceModel, geometryMotionModel, contactListType > Class Template Reference
Inheritance diagram for sphereInteraction< contactForceModel, geometryMotionModel, contactListType >:
[legend]
Collaboration diagram for sphereInteraction< contactForceModel, geometryMotionModel, contactListType >:
[legend]

## Public Types

using | GeometryMotionModel = geometryMotionModel
using | ContactForceModel = contactForceModel
using | MotionModel = typename geometryMotionModel::MotionModel
using | ModelStorage = typename ContactForceModel::contactForceStorage
using | BoundaryListType = boundarySphereInteractionList< ContactForceModel, GeometryMotionModel >
using | IdType = uint32
using | IndexType = uint32
using | ContactListType = contactListType< ModelStorage, DefaultExecutionSpace, IdType >
Public Types inherited from objectFile
enum | readFlag { READ_ALWAYS, READ_NEVER, READ_IF_PRESENT }
enum | writeFlag { WRITE_ALWAYS, WRITE_NEVER }

## Public Member Functions

| TypeInfoTemplate13 ("sphereInteraction", ContactForceModel, MotionModel, ContactListType)
| sphereInteraction (systemControl &control, const particles &prtcl, const geometry &geom)
| Constructor from components. More...
| add_vCtor (interaction, sphereInteraction, systemControl)
| Add virtual constructor. More...
bool | beforeIteration () override
| This is called in time loop, before iterate. (overriden from demComponent) More...
bool | iterate () override
| This is called in time loop. More...
bool | afterIteration () override
| This is called in time loop, after iterate. (overriden from demComponent) More...
bool | hearChanges (real t, real dt, uint32 iter, const message &msg, const anyList &varList) override
| Check for changes in the point structures. (overriden from observer) More...
Public Member Functions inherited from interaction
| TypeInfo ("interaction")
| interaction (systemControl &control, const particles &prtcl, const geometry &geom)
| ~interaction () override=default
| create_vCtor (interaction, systemControl,(systemControl &control, const particles &prtcl, const geometry &geom),(control, prtcl, geom))
const auto & | Particles () const
const auto & | Geometry () const
Public Member Functions inherited from property
| TypeInfo ("property")
| Type info. More...
| property (const word &fileName, repository *owner=nullptr)
| property (const word &fileName, const fileSystem &dir)
| property (const word &fileName, const wordVector &materials, const realVector &densities, repository *owner=nullptr)
| property (const property &)=default
| Default copy. More...
| property (property &&)=default
| Default move. More...
property & | operator= (const property &)=default
| Default copy assignment. More...
property & | operator= (property &&)=default
| Default move assignment. More...
| ~property () override=default
| Default destructor. More...
auto | numMaterials () const
| Return number of materials. More...
const auto & | materials () const
| Return list of material names. More...
const auto & | densities () const
| Return the list of densities. More...
const word & | material (uint32 i) const
| Return the material name of material i. More...
bool | material (uint32 i, word &name) const
| Get the name of material i. More...
real | density (uint32 i) const
| Return density of material i. More...
bool | density (uint32 i, real &rho) const
| Get the density of material i. More...
bool | nameToIndex (const word &name, uint32 &idx) const
| Get the name of material in index idx Return true, if the name found, otherwise false. 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...
Public Member Functions inherited from observer
| observer (message msg)
| observer (const subscriber *subscrbr, message msg)
virtual | ~observer ()
void | subscribe (const subscriber *subscrbr, message msg)
observer & | addEvent (message::EVENT event)
bool | subscribed () const
void | addToSubscriber (const subscriber *subscrbr, message msg)
bool | addToSubscriber (const subscriber &subscriber)
Public Member Functions inherited from demComponent
| TypeInfo ("demComponent")
| Type info. More...
| demComponent (const word &name, systemControl &control)
| construct from components More...
| demComponent (const demComponent &)=delete
| No copy constructor. More...
| demComponent (demComponent &&)=delete
| No move constructor. More...
demComponent & | operator= (const demComponent &)=delete
| No copy assignment. More...
demComponent & | operator= (demComponent &&)=delete
| No move assignment. More...
virtual | ~demComponent ()=default
| destructor More...
const auto & | control () const
| Const ref to systemControl. More...
auto & | control ()
| Ref to systemControl. More...
real | dt () const
| Time step of integration. More...
real | currentTime () const
| Current simulation time. More...
uint32 | currentIter () const
| return current iteration number More...
timeInfo | TimeInfo () const
| return time info of the simulaiton More...
const auto & | time () const
auto & | time ()
const auto & | timers () const
| Const ref to timers. More...
auto & | timers ()
| Ref to timers. More...
virtual bool | beforeTimeLoop ()
| This is called before the start of time loop. More...
virtual bool | afterTimeLoop ()
| This is called after the time loop. More...

## Private Types

using | rpPPInteraction = Kokkos::RangePolicy< Kokkos::IndexType< uint32 >, Kokkos::Schedule< Kokkos::Dynamic > >
| range policy for p-p interaction execution More...
using | rpPWInteraction = rpPPInteraction
| range policy for p-w interaction execution More...

## Private Member Functions

bool | createSphereInteraction ()
bool | sphereSphereInteraction ()
bool | sphereWallInteraction ()

## Private Attributes

const GeometryMotionModel & | geometryMotion_
| const reference to geometry More...
const sphereParticles & | sphParticles_
| const reference to particles More...
BoundaryListType | boundaryInteraction_
| particle-particle and particle-wall interactions at boundaries More...
boundariesMask< 6 > | activeBoundaries_
| a mask for active boundaries (boundaries with intreaction) More...
uniquePtr< contactSearch > | contactSearch_ = nullptr
| contact search object for pp and pw interactions More...
uniquePtr< ContactForceModel > | forceModel_ = nullptr
| contact force model More...
uniquePtr< ContactListType > | ppContactList_ = nullptr
| contact list for particle-particle interactoins (keeps the history) More...
uniquePtr< ContactListType > | pwContactList_ = nullptr
| contact list for particle-wall interactions (keeps the history) More...
Timer | ppInteractionTimer_
| timer for particle-particle interaction computations More...
Timer | pwInteractionTimer_
| timer for particle-wall interaction computations More...
Timer | boundaryInteractionTimer_
| timer for boundary interaction time More...
Timer | contactListMangementTimer_
| timer for managing contact lists (only inernal points) More...
Timer | contactListMangementBoundaryTimer_

## Additional Inherited Members

Static Public Member Functions inherited from interaction
static uniquePtr< interaction > | create (systemControl &control, const particles &prtcl, const geometry &geom)
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 Member Functions inherited from observer
static constexpr auto | numEvents ()
Static Public Attributes inherited from dictionary
static dictionary | nullDict
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
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

### template<typename contactForceModel, typename geometryMotionModel, template< class, class, class > class contactListType>
class pFlow::sphereInteraction< contactForceModel, geometryMotionModel, contactListType >

Definition at line 41 of file sphereInteraction.hpp.

## Member Typedef Documentation

## GeometryMotionModel

using GeometryMotionModel = geometryMotionModel

Definition at line 47 of file sphereInteraction.hpp.

## ContactForceModel

using ContactForceModel = contactForceModel

Definition at line 49 of file sphereInteraction.hpp.

## MotionModel

using MotionModel = typename geometryMotionModel::MotionModel

Definition at line 51 of file sphereInteraction.hpp.

## ModelStorage

using ModelStorage = typename ContactForceModel::contactForceStorage

Definition at line 53 of file sphereInteraction.hpp.

## BoundaryListType

using BoundaryListType = boundarySphereInteractionList<ContactForceModel,GeometryMotionModel>

Definition at line 55 of file sphereInteraction.hpp.

## IdType

using IdType = uint32

Definition at line 57 of file sphereInteraction.hpp.

## IndexType

using IndexType = uint32

Definition at line 59 of file sphereInteraction.hpp.

## ContactListType

using ContactListType = contactListType<ModelStorage, DefaultExecutionSpace, IdType>

Definition at line 62 of file sphereInteraction.hpp.

## rpPPInteraction

using rpPPInteraction = Kokkos::RangePolicy<Kokkos::IndexType<uint32>, Kokkos::Schedule<Kokkos::Dynamic> >

private

range policy for p-p interaction execution

Definition at line 119 of file sphereInteraction.hpp.

## rpPWInteraction

using rpPWInteraction = rpPPInteraction

private

range policy for p-w interaction execution

Definition at line 122 of file sphereInteraction.hpp.

## Constructor & Destructor Documentation

## sphereInteraction()

sphereInteraction | ( | systemControl & | control,
|  | const particles & | prtcl,
|  | const geometry & | geom
| ) |  |

Constructor from components.

Definition at line 127 of file sphereInteraction.cpp.

References fatalExit.

## Member Function Documentation

## createSphereInteraction()

bool createSphereInteraction

private

Definition at line 22 of file sphereInteraction.cpp.

References VectorSingle< T, MemorySpace >::deviceView().

Here is the call graph for this function:

## sphereSphereInteraction()

bool sphereSphereInteraction

private

Definition at line 53 of file sphereInteraction.cpp.

## sphereWallInteraction()

bool sphereWallInteraction

private

Definition at line 85 of file sphereInteraction.cpp.

## TypeInfoTemplate13()

TypeInfoTemplate13 | ( | "sphereInteraction< contactForceModel, geometryMotionModel, contactListType >" | ,
|  | ContactForceModel | ,
|  | MotionModel | ,
|  | ContactListType |
| ) |  |

## add_vCtor()

add_vCtor | ( | interaction | ,
|  | sphereInteraction< contactForceModel, geometryMotionModel, contactListType > | ,
|  | systemControl |
| ) |  |

Add virtual constructor.

## beforeIteration()

bool beforeIteration

overridevirtual

This is called in time loop, before iterate. (overriden from demComponent)

Implements demComponent.

Definition at line 156 of file sphereInteraction.cpp.

## iterate()

bool iterate

overridevirtual

This is called in time loop.

Perform the main calculations when the component should evolve along time. (overriden from demComponent)

update boundaries of the fields that are being used by inreaction

lists

peform contact search on boundareis with active contact search (master boundaries)

Implements demComponent.

Definition at line 162 of file sphereInteraction.cpp.

References pFlow::ComputationTimer(), timeInfo::dt(), Timer::end(), pFlow::endl(), fatalErrorInFunction, fatalExit, timeInfo::iter(), pFlow::periodicBoundarySIKernels::sphereSphereInteraction(), Timer::start(), and timeInfo::t().

Here is the call graph for this function:

## afterIteration()

bool afterIteration

overridevirtual

This is called in time loop, after iterate. (overriden from demComponent)

Implements demComponent.

Definition at line 337 of file sphereInteraction.cpp.

## hearChanges()

bool hearChanges | ( | real | t,
|  | real | dt,
|  | uint32 | iter,
|  | const message & | msg,
|  | const anyList & | varList
| ) |  |

overridevirtual

Check for changes in the point structures. (overriden from observer)

Implements observer.

Definition at line 344 of file sphereInteraction.cpp.

References message::equivalentTo(), and notImplementedFunction.

Here is the call graph for this function:

## Member Data Documentation

## geometryMotion_

const GeometryMotionModel& geometryMotion_

private

const reference to geometry

Definition at line 71 of file sphereInteraction.hpp.

## sphParticles_

const sphereParticles& sphParticles_

private

const reference to particles

Definition at line 74 of file sphereInteraction.hpp.

## boundaryInteraction_

BoundaryListType boundaryInteraction_

private

particle-particle and particle-wall interactions at boundaries

Definition at line 77 of file sphereInteraction.hpp.

## activeBoundaries_

boundariesMask<6> activeBoundaries_

private

a mask for active boundaries (boundaries with intreaction)

Definition at line 80 of file sphereInteraction.hpp.

## contactSearch_

uniquePtr<contactSearch> contactSearch_ = nullptr

private

contact search object for pp and pw interactions

Definition at line 83 of file sphereInteraction.hpp.

## forceModel_

uniquePtr<ContactForceModel> forceModel_ = nullptr

private

contact force model

Definition at line 86 of file sphereInteraction.hpp.

## ppContactList_

uniquePtr<ContactListType> ppContactList_ = nullptr

private

contact list for particle-particle interactoins (keeps the history)

Definition at line 89 of file sphereInteraction.hpp.

## pwContactList_

uniquePtr<ContactListType> pwContactList_ = nullptr

private

contact list for particle-wall interactions (keeps the history)

Definition at line 92 of file sphereInteraction.hpp.

## ppInteractionTimer_

Timer ppInteractionTimer_

private

timer for particle-particle interaction computations

Definition at line 96 of file sphereInteraction.hpp.

## pwInteractionTimer_

Timer pwInteractionTimer_

private

timer for particle-wall interaction computations

Definition at line 99 of file sphereInteraction.hpp.

## boundaryInteractionTimer_

Timer boundaryInteractionTimer_

private

timer for boundary interaction time

Definition at line 102 of file sphereInteraction.hpp.

## contactListMangementTimer_

Timer contactListMangementTimer_

private

timer for managing contact lists (only inernal points)

Definition at line 105 of file sphereInteraction.hpp.

## contactListMangementBoundaryTimer_

Timer contactListMangementBoundaryTimer_

private

Definition at line 107 of file sphereInteraction.hpp.

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

- src/Interaction/sphereInteraction/sphereInteraction/sphereInteraction.hpp
- src/Interaction/sphereInteraction/sphereInteraction/sphereInteraction.cpp