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

Base class for all Profile outputs used by KartesianProfile. More...

#include <ProfileBase.h>

Inheritance diagram for ProfileBase:
DOFProfile DensityProfile KineticProfile TemperatureProfile Velocity3dProfile VelocityAbsProfile Virial2DProfile VirialProfile

Public Member Functions

virtual void init (SamplingInformation &samplingInformation)
 Init function is given a pointer to the KartesianProfile object handling this profile. Same for all profiles. More...
 
virtual void record (Molecule &mol, unsigned long uID)=0
 The recording step defines what kind of data needs to be recorded for a single molecule with a corresponding uID. More...
 
virtual void collectAppend (DomainDecompBase *domainDecomp, unsigned long uID)=0
 Append all necessary communication per bin to the DomainDecomposition. Append from e.g. _localProfile. More...
 
virtual void collectRetrieve (DomainDecompBase *domainDecomp, unsigned long uID)=0
 Get global values after AllReduceSum per bin. Write to e.g. _globalProfile. More...
 
virtual void output (string prefix, long unsigned accumulatedDatasets)=0
 Whatever is necessary to output for this profile. More...
 
virtual void reset (unsigned long uID)=0
 Used to reset all array contents for a specific uID in order to start the next recording timeframe. More...
 
virtual int comms ()=0
 1D profiles like a number density profile should return 1 here. 3D profiles that have 3 entries per bin that need to be communicated would need to return 3. Adjust as needed. Same number as commAppends in collectAppend. More...
 

Protected Member Functions

virtual void writeDataEntry (unsigned long uID, ofstream &outfile) const =0
 Write Single Data Entry for Matrix with given uID to outfile. More...
 
void writeMatrix (ofstream &outfile)
 Matrix writing routine to avoid code duplication. More...
 
void writeKartMatrix (ofstream &outfile)
 
void writeSimpleMatrix (ofstream &outfile)
 STUB for simple Matrix output without headers. More...
 
void writeCylMatrix (ofstream &outfile)
 cylinder Matrix output More...
 

Protected Attributes

string _profilePrefix
 
SamplingInformation _samplInfo
 
long _accumulatedDatasets = -1
 

Detailed Description

Base class for all Profile outputs used by KartesianProfile.

The major steps for all profiles are recording the profile data, communication, writing the output file and resetting everything for the next recording period. Each of these steps has a function associated with it that needs to be implemented by all profiles inheriting this class to be able to work with KartesianProfile. KartesianProfile also needs to know the number of items added to the communication per Molecule. So a DensityProfile should return 1 via Profile::comms(). A Velocity3dProfile should return 3.
A very simple example of how to use this class is the DensityProfile.

Member Function Documentation

◆ collectAppend()

virtual void ProfileBase::collectAppend ( DomainDecompBase domainDecomp,
unsigned long  uID 
)
pure virtual

Append all necessary communication per bin to the DomainDecomposition. Append from e.g. _localProfile.

Parameters
domainDecompDomainDecomposition handling the communication.
uIDuID of molecule in sampling grid, needed to put data in right spot in the profile arrays.

Implemented in DensityProfile, DOFProfile, KineticProfile, TemperatureProfile, Velocity3dProfile, VelocityAbsProfile, Virial2DProfile, and VirialProfile.

◆ collectRetrieve()

virtual void ProfileBase::collectRetrieve ( DomainDecompBase domainDecomp,
unsigned long  uID 
)
pure virtual

Get global values after AllReduceSum per bin. Write to e.g. _globalProfile.

Parameters
domainDecompDomainDecomposition handling the communication.
uIDuID of molecule in sampling grid, needed to put data in right spot in the profile arrays.

Implemented in DensityProfile, DOFProfile, KineticProfile, TemperatureProfile, Velocity3dProfile, VelocityAbsProfile, Virial2DProfile, and VirialProfile.

◆ comms()

virtual int ProfileBase::comms ( )
pure virtual

1D profiles like a number density profile should return 1 here. 3D profiles that have 3 entries per bin that need to be communicated would need to return 3. Adjust as needed. Same number as commAppends in collectAppend.

Returns
Number of nedded communications per bin so the communicator can be setup correctly.

Implemented in DensityProfile, DOFProfile, KineticProfile, TemperatureProfile, Velocity3dProfile, VelocityAbsProfile, Virial2DProfile, and VirialProfile.

◆ init()

virtual void ProfileBase::init ( SamplingInformation samplingInformation)
inlinevirtual

Init function is given a pointer to the KartesianProfile object handling this profile. Same for all profiles.

Parameters
kartProfPointer to KartesianProfile. Grants access to necessary global params.

◆ output()

virtual void ProfileBase::output ( string  prefix,
long unsigned  accumulatedDatasets 
)
pure virtual

Whatever is necessary to output for this profile.

This function varies wildly between profiles. The Profile should output to its desired format here and handle all file IO for one profile writing step.

Parameters
prefixFile prefix including the global _outputPrefix for all profiles and the current timestep. Should be appended by some specific file ending for this specific profile.

Implemented in DensityProfile, DOFProfile, KineticProfile, TemperatureProfile, Velocity3dProfile, VelocityAbsProfile, Virial2DProfile, and VirialProfile.

◆ record()

virtual void ProfileBase::record ( Molecule mol,
unsigned long  uID 
)
pure virtual

The recording step defines what kind of data needs to be recorded for a single molecule with a corresponding uID.

Parameters
molReference to Molecule, needed to extract info such as velocity or Virial.
uIDuID of molecule in sampling grid, needed to put data in right spot in the profile arrays.

Implemented in DensityProfile, DOFProfile, KineticProfile, TemperatureProfile, Velocity3dProfile, VelocityAbsProfile, Virial2DProfile, and VirialProfile.

◆ reset()

virtual void ProfileBase::reset ( unsigned long  uID)
pure virtual

Used to reset all array contents for a specific uID in order to start the next recording timeframe.

Parameters
uIDuID of molecule in sampling grid, needed to put data in right spot in the profile arrays.

Implemented in DensityProfile, DOFProfile, KineticProfile, TemperatureProfile, Velocity3dProfile, VelocityAbsProfile, Virial2DProfile, and VirialProfile.

◆ writeCylMatrix()

void ProfileBase::writeCylMatrix ( ofstream &  outfile)
protected

cylinder Matrix output

Parameters
outfileopened filestream from Profile

◆ writeDataEntry()

virtual void ProfileBase::writeDataEntry ( unsigned long  uID,
ofstream &  outfile 
) const
protectedpure virtual

Write Single Data Entry for Matrix with given uID to outfile.

Parameters
uIDunique ID of bin
outfileoutfile to write to

◆ writeMatrix()

void ProfileBase::writeMatrix ( ofstream &  outfile)
protected

Matrix writing routine to avoid code duplication.

Parameters
outfileopened filestream from Profile

◆ writeSimpleMatrix()

void ProfileBase::writeSimpleMatrix ( ofstream &  outfile)
protected

STUB for simple Matrix output without headers.

Parameters
outfileopened filestream from Profile

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