Gromacs  2022.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes
gmx::ObservablesReducer::Impl Class Reference

Description

Impl class for ObservablesReducer.

Public Member Functions

 Impl (std::vector< double > &&communicationBuffer, std::vector< ObservablesReducerBuilder::CallbackAfterReduction > &&registeredCallbacks)
 Constructor.
 
ObservablesReducerStatus requireReduction (int callbackIndex, ReductionRequirement requirement)
 May be called by any subscribed module, via the callback supplied by ObservablesReducerBuilder::build(). More...
 

Public Attributes

std::vector< double > communicationBuffer_
 Storage for communication buffer. More...
 
std::vector
< ObservablesReducerBuilder::CallbackAfterReduction
registeredCallbacks_
 Registered callbacks that might be used after communication.
 
std::vector< int > callbacksAfterReduction_
 Indices into registeredCallbacks_ of callbacks to use after the next reduction.
 
bool reduceSoon_ = false
 Whether the reduction will occur soon because a module required it. More...
 
ObservablesReducerStatus status_ = ObservablesReducerStatus::ReadyToReduce
 Whether reduction has taken place this step.
 

Member Function Documentation

ObservablesReducerStatus gmx::ObservablesReducer::Impl::requireReduction ( int  callbackIndex,
ReductionRequirement  requirement 
)
inline

May be called by any subscribed module, via the callback supplied by ObservablesReducerBuilder::build().

If this method has been called on this rank since the last call to reduceComplete() with a requirement to communicate soon, then it will make the communication buffer available via communicationBuffer() to compute_globals(), so it can copy it to the buffer it uses for MPI communication.

It is the subscribers' responsibility to coordinate so that all subscribers on all ranks agree on the need to communicate, e.g. by orchestating communication based on the current step number or a previous message.

Does not check that the callback corresponds to a module that subscribed to the builder().

Returns the status of the ObservablesReducer about whether reduction has already been called on this step.

Member Data Documentation

std::vector<double> gmx::ObservablesReducer::Impl::communicationBuffer_

Storage for communication buffer.

Must never be resized, because that would potentially invalidate views of it held by the subscribers.

bool gmx::ObservablesReducer::Impl::reduceSoon_ = false

Whether the reduction will occur soon because a module required it.

"Soon" means this step or next, depending when during the step it was required, as there is only one point during a normal simulator step where observables reduction might occur.


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