Gromacs  2025-dev-20240614-602a366
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
gmx::ThreadedForceBuffer< ForceBufferElementType > Class Template Reference

#include <gromacs/mdtypes/threaded_force_buffer.h>


template<typename ForceBufferElementType>
class gmx::ThreadedForceBuffer< ForceBufferElementType >

Class for accumulating and reducing forces and energies on threads in parallel.

Template Parameters
ForceBufferElementTypeThe type for components of the normal force buffer: rvec or rvec4

Public Member Functions

 ThreadedForceBuffer (int numThreads, bool useEnergyTerms, int numEnergyGroups)
 Constructor. More...
int numThreadBuffers () const
 Returns the number of thread buffers.
< ForceBufferElementType > & 
threadForceBuffer (int bufferIndex)
 Returns a reference to the buffer object for the thread with index bufferIndex.
void setupReduction ()
 Sets up the reduction, should be called after generating the masks on each thread.
void reduce (gmx::ForceWithShiftForces *forceWithShiftForces, real *ener, gmx_grppairener_t *grpp, gmx::ArrayRef< real > dvdl, const gmx::StepWorkload &stepWork, int reductionBeginIndex)
 Reduces forces and energies, as requested by stepWork. More...

Constructor & Destructor Documentation

template<typename ForceBufferElementType >
gmx::ThreadedForceBuffer< ForceBufferElementType >::ThreadedForceBuffer ( int  numThreads,
bool  useEnergyTerms,
int  numEnergyGroups 


[in]numThreadsThe number of threads that will use the buffers and reduce
[in]useEnergyTermsWhether the list of energy terms will be used
[in]numEnergyGroupsThe number of non-bonded energy groups

Member Function Documentation

template<typename ForceBufferElementType >
void gmx::ThreadedForceBuffer< ForceBufferElementType >::reduce ( gmx::ForceWithShiftForces forceWithShiftForces,
real ener,
gmx_grppairener_t *  grpp,
gmx::ArrayRef< real dvdl,
const gmx::StepWorkload stepWork,
int  reductionBeginIndex 

Reduces forces and energies, as requested by stepWork.

The reduction of all output starts at the output from thread reductionBeginIndex, except for the normal force buffer, which always starts at 0.

Buffers that will not be used as indicated by the flags in stepWork are allowed to be nullptr or empty.

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