ls1-MarDyn
ls1-MarDyn molecular dynamics code
Public Member Functions | List of all members
ParticlePairsHandler Class Referenceabstract

interface for defining the action performed when processing a pair More...

#include <ParticlePairsHandler.h>

Inheritance diagram for ParticlePairsHandler:
ParticlePairs2LoadCalcAdapter ParticlePairs2PotForceAdapter

Public Member Functions

 ParticlePairsHandler ()
 Constructor.
 
virtual ~ParticlePairsHandler ()
 Destructor.
 
virtual void init ()=0
 things to be done before particle pairs are processed More...
 
virtual void finish ()=0
 things to be done after particle pairs are processed More...
 
virtual double processPair (Molecule &particle1, Molecule &particle2, double distanceVector[3], PairType pairType, double dd, bool calculateLJ)=0
 things to be done for each particle pair More...
 

Detailed Description

interface for defining the action performed when processing a pair

Author
Martin Buchholz

The idea of a ParticleContainer is, that the container itself only knows about how to efficiently store and access Particles (or neighbouring pairs of Particles) It doesn't know anything (exception follows) about the internal structure of a Particle, or what action should be performed for a pair of particles (an action could e.g. be to calculate the force). The only thing that has to be known from a particle is it's position.

An application e.g. wants to find all neighbouring particle pairs and calculate the forces between them. The retrieval of the pairs has to be done by the ParticleContainer, but the force calculation has to be performed somewhere else. That's where this interface comes into play. There are typically three things to be done:

The ParticleContainer has an instance of a class implementing this interface as a member variable. When the method of the ParticleContainer that traverses the pairs is called, it first has to call the method "init()" of it's ParticlePairsHandler, then for each pair "processPair(...)" and at the end "finish()". A class implementing this interface now serves as an adapter between the particleContainer an some other part of the programm (e.g. force calculation)

Member Function Documentation

◆ finish()

virtual void ParticlePairsHandler::finish ( )
pure virtual

things to be done after particle pairs are processed

Implemented in ParticlePairs2LoadCalcAdapter, and ParticlePairs2PotForceAdapter.

◆ init()

virtual void ParticlePairsHandler::init ( )
pure virtual

things to be done before particle pairs are processed

Implemented in ParticlePairs2LoadCalcAdapter, and ParticlePairs2PotForceAdapter.

◆ processPair()

virtual double ParticlePairsHandler::processPair ( Molecule particle1,
Molecule particle2,
double  distanceVector[3],
PairType  pairType,
double  dd,
bool  calculateLJ 
)
pure virtual

things to be done for each particle pair

Parameters
particle1first particle
particle2second particle
distanceVector[3]distance between the two particles
pairTypedescribes whether the pair is a original pair(0) or a duplicated pair(1) for details about pair types see comments on traversePairs() in ParticleContainer

Implemented in ParticlePairs2PotForceAdapter, and ParticlePairs2LoadCalcAdapter.


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