Advanced Multi-Physics (AMP)
On-Line Documentation
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
AMP::LinearAlgebra::DataChangeFirer Class Reference

Interface for managing classes that need to know when managed data has changed. More...

#include <DataChangeFirer.h>

Inheritance diagram for AMP::LinearAlgebra::DataChangeFirer:
Inheritance graph
[legend]

Public Member Functions

 DataChangeFirer ()
 Cosntruct the DataChangeFirer.
 
virtual void deregisterListener (DataChangeListener *listener)
 Deregister a listener with this DataChangeFirer.
 
virtual void fireDataChange ()
 Notify all listeners of a data change event.
 
virtual void registerListener (DataChangeListener *listener)
 Register a listener with this DataChangeFirer.
 
virtual void registerListener (std::shared_ptr< DataChangeListener > listener)
 Register a listener with this DataChangeFirer.
 
virtual ~DataChangeFirer ()
 Destroy the DataChangeFirer.
 

Protected Member Functions

 DataChangeFirer (const DataChangeFirer &)
 Overload copy constructor (will not copy)
 
DataChangeFireroperator= (const DataChangeFirer &)
 Overload assignment operator (will not copy)
 

Private Attributes

std::vector< DataChangeListener * > d_listeners
 

Detailed Description

Interface for managing classes that need to know when managed data has changed.

Some linear algebra packages, such as PETSc, use sophisticated caching schemes to reduce the amount of communication necessary to perform some computations. For instance, unless the values of a vector change, the L1 norm will remain constant. Since computing the L1 norm requires communication for parallel vectors, communication can be reduced by caching this value and invalidating the cache when the data changes. To pass these messages around, a set of classes are provided which allow for the invalidation of the cache. These classes are used when AMP managed data is changed by some linear algebra packages to inform other packages that their cache needs to be invalidated. These classes implement a callback mechansim in an environment of reference counted pointers.

The DataChangeFirer provides a mechanism to register and de-register itself with a DataChangeFirer. It is a list of DataChangeFirers with which it is registered. It implements a receiveDataChanged() method used by the DataChangeFirer to indicate managed data has changed.

Definition at line 32 of file DataChangeFirer.h.

Constructor & Destructor Documentation

◆ DataChangeFirer() [1/2]

AMP::LinearAlgebra::DataChangeFirer::DataChangeFirer ( )

Cosntruct the DataChangeFirer.

When constrcuted, a DataChangeFirer object is empty. It has no default listeners.

◆ ~DataChangeFirer()

virtual AMP::LinearAlgebra::DataChangeFirer::~DataChangeFirer ( )
virtual

Destroy the DataChangeFirer.

On destruction, the DataChangeFirer will deregister itself with all DataChangeListeners it has.

◆ DataChangeFirer() [2/2]

AMP::LinearAlgebra::DataChangeFirer::DataChangeFirer ( const DataChangeFirer )
inlineprotected

Overload copy constructor (will not copy)

Definition at line 83 of file DataChangeFirer.h.

Member Function Documentation

◆ deregisterListener()

virtual void AMP::LinearAlgebra::DataChangeFirer::deregisterListener ( DataChangeListener listener)
virtual

Deregister a listener with this DataChangeFirer.

Parameters
[in]listenerThe listener to remove from the list

Removes a listener from itself.

◆ fireDataChange()

virtual void AMP::LinearAlgebra::DataChangeFirer::fireDataChange ( )
virtual

Notify all listeners of a data change event.

Iterates through the list of DataChangeListeners and invokes the receiveDataChanged() method.

Referenced by AMP::LinearAlgebra::ManagedVectorData::receiveDataChanged(), and AMP::LinearAlgebra::MultiVectorData::receiveDataChanged().

◆ operator=()

DataChangeFirer & AMP::LinearAlgebra::DataChangeFirer::operator= ( const DataChangeFirer )
inlineprotected

Overload assignment operator (will not copy)

Definition at line 86 of file DataChangeFirer.h.

◆ registerListener() [1/2]

virtual void AMP::LinearAlgebra::DataChangeFirer::registerListener ( DataChangeListener listener)
virtual

Register a listener with this DataChangeFirer.

Parameters
[in]listenerThe listener to be alerted to data change events

Adds a listener to itself.

◆ registerListener() [2/2]

virtual void AMP::LinearAlgebra::DataChangeFirer::registerListener ( std::shared_ptr< DataChangeListener listener)
virtual

Register a listener with this DataChangeFirer.

Parameters
[in]listenerThe listener to be alerted to data change events

Adds a listener to itself.

Member Data Documentation

◆ d_listeners

std::vector<DataChangeListener *> AMP::LinearAlgebra::DataChangeFirer::d_listeners
private

Definition at line 89 of file DataChangeFirer.h.


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



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:42.
Comments on this page