Gromacs  2025-dev-20241008-cf8b9ef
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes | Static Public Attributes
gmx::test::anonymous_namespace{observablesreducer.cpp}::Subscriber Class Reference
+ Collaboration diagram for gmx::test::anonymous_namespace{observablesreducer.cpp}::Subscriber:

Description

Helper class that models an MD module that needs to make a subscription to ObservablesReducer.

Public Member Functions

 Subscriber (int subscriberIndex, int numRanks)
 Constructor.
 
void makeSubscription (ObservablesReducerBuilder *observablesReducerBuilder)
 Make the subscription via the observablesReducerBuilder.
 
void callbackWhenBufferAvailable (ObservablesReducerBuilder::CallbackToRequireReduction &&callbackToRequireReduction, ArrayRef< double > bufferView)
 Callback to receive data from the builder.
 
void doSimulationWork (Step step, ReductionRequirement reductionRequirement) const
 Pretend to do some simulation work characteristic of step.
 
void callbackAfterReduction (Step step)
 After the reduction, check the values for this subscriber are as expected.
 

Public Attributes

int sizeRequired_
 The number of doubles required to reduce.
 
ObservablesReducerBuilder::CallbackToRequireReduction callbackToRequireReduction_
 The callback used to require reduction.
 
ArrayRef< double > communicationBuffer_
 The buffer used for communication, supplied by an ObservablesReducer.
 
double valueOffset_
 Offset that differentiates the values reduced by each subscriber.
 
int numRanks_
 Number of ranks, used in constructing test expectations.
 
int subscriberIndex_
 Index within the group of subscribers.
 

Static Public Attributes

static constexpr int s_subscriberBufferMinimumSize = 3
 Ensure that each subscriber sends an interesting amount of data.
 
static constexpr double s_subscriberOffset = 1000
 Base value used to ensure the data reduced by each subscriber is distinct, to help diagnose bugs. More...
 

Member Data Documentation

constexpr double gmx::test::anonymous_namespace{observablesreducer.cpp}::Subscriber::s_subscriberOffset = 1000
static

Base value used to ensure the data reduced by each subscriber is distinct, to help diagnose bugs.

Also contributes to ensuring that the reduced total is never zero.

Note that in a real use case, the subscribers will generally be located in multiple modules.


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