# PhasicFlow: observer 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.

observer Class Referenceabstract
Inheritance diagram for observer:
[legend]
Collaboration diagram for observer:
[legend]

## Public Member Functions

| 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)
virtual bool | hearChanges (real t, real dt, uint32 iter, const message &msg, const anyList &varList)=0

## Static Public Member Functions

static constexpr auto | numEvents ()

## Private Member Functions

const subscriber * | changeSubscriber (const subscriber *newSub)
void | invalidateSubscriber ()

## Private Attributes

const subscriber * | subscriber_ = nullptr
| pointer to subscriber More...
message | message_
| list of events in the message More...
friend | subscriber

## Detailed Description

Definition at line 33 of file observer.hpp.

## Constructor & Destructor Documentation

## observer() [1/2]

observer | ( | message | msg | ) |

Definition at line 31 of file observer.cpp.

## observer() [2/2]

observer | ( | const subscriber * | subscrbr,
|  | message | msg
| ) |  |

Definition at line 36 of file observer.cpp.

## ~observer()

~observer | ( |  | ) |

virtual

Definition at line 44 of file observer.cpp.

## Member Function Documentation

## changeSubscriber()

const pFlow::subscriber * changeSubscriber | ( | const subscriber * | newSub | ) |

private

Definition at line 24 of file observer.cpp.

References observer::subscriber_.

## invalidateSubscriber()

void invalidateSubscriber | ( |  | ) |

inlineprivate

Definition at line 48 of file observer.hpp.

References observer::subscriber_.

## subscribe()

void subscribe | ( | const subscriber * | subscrbr,
|  | message | msg
| ) |  |

## addEvent()

pFlow::observer & addEvent | ( | message::EVENT | event | ) |

Definition at line 51 of file observer.cpp.

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

Referenced by periodicBoundaryField< T, MemorySpace >::periodicBoundaryField().

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

## subscribed()

bool subscribed | ( |  | ) | const

inline

Definition at line 71 of file observer.hpp.

References observer::subscriber_.

## addToSubscriber() [1/2]

void addToSubscriber | ( | const subscriber * | subscrbr,
|  | message | msg
| ) |  |

Definition at line 67 of file observer.cpp.

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

Referenced by particles::particles().

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

## addToSubscriber() [2/2]

bool addToSubscriber | ( | const subscriber & | subscriber | ) |

Definition at line 90 of file observer.cpp.

References subscriber::subscribe().

Here is the call graph for this function:

## numEvents()

static constexpr auto numEvents | ( |  | ) |

inlinestaticconstexpr

Definition at line 85 of file observer.hpp.

References message::numEvents().

Here is the call graph for this function:

## hearChanges()

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

pure virtual

Implemented in internalField< T, MemorySpace >, internalField< pFlow::VectorSingle, pFlow::AB5History >, internalField< pFlow::VectorSingle, pFlow::AB4History >, internalField< real, void >, internalField< uint32, void >, internalField< T, void >, internalField< pFlow::VectorSingle, pFlow::AB3History >, internalField< realx3, void >, sphereParticles, grainParticles, triSurfaceField< T, MemorySpace >, triSurfaceField< realx3 >, triSurfaceField< uint32 >, boundaryGrainInteraction< contactForceModel, geometryMotionModel >, boundarySphereInteraction< contactForceModel, geometryMotionModel >, grainInteraction< contactForceModel, geometryMotionModel, contactListType >, sphereInteraction< contactForceModel, geometryMotionModel, contactListType >, boundaryField< T, MemorySpace >, boundaryField< T, void >, boundaryContactSearch, particleIdHandler, exitBoundaryField< T, MemorySpace >, periodicBoundaryField< T, MemorySpace >, reflectiveBoundaryField< T, MemorySpace >, boundaryIntegration, boundaryGrainParticles, and boundarySphereParticles.

## Member Data Documentation

## subscriber_

const subscriber* subscriber_ = nullptr

private

pointer to subscriber

Definition at line 39 of file observer.hpp.

Referenced by observer::changeSubscriber(), observer::invalidateSubscriber(), and observer::subscribed().

## message_

message message_

private

list of events in the message

Definition at line 42 of file observer.hpp.

## subscriber

friend subscriber

private

Definition at line 44 of file observer.hpp.

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

- src/phasicFlow/eventManagement/observer.hpp
- src/phasicFlow/eventManagement/observer.cpp