OpenMPCD
Public Member Functions | List of all members
OpenMPCD::DensityProfile Class Reference

Represents a density profile. More...

#include <DensityProfile.hpp>

Public Member Functions

 DensityProfile (const unsigned int mpcBoxSizeX, const unsigned int mpcBoxSizeY, const unsigned int mpcBoxSizeZ, const Configuration::Setting &settings)
 The constructor. More...
 
unsigned int getCellSubdivisionsX () const
 Returns the number of times collision cells are subdivided along the \( x \) direction. More...
 
unsigned int getCellSubdivisionsY () const
 Returns the number of times collision cells are subdivided along the \( y \) direction. More...
 
unsigned int getCellSubdivisionsZ () const
 Returns the number of times collision cells are subdivided along the \( z \) direction. More...
 
void incrementFillCount ()
 Increments the fill count. More...
 
void add (const std::vector< std::vector< std::vector< FP > > >::size_type x, const std::vector< std::vector< FP > >::size_type y, const std::vector< FP >::size_type z, const FP m)
 Adds mass to the given point. More...
 
void saveToFile (const std::string &path) const
 Saves the data into a file with the given path. More...
 

Detailed Description

Represents a density profile.

This class can be configured via the instrumentation.densityProfile configuration group. If it is not present, this class will not be active. Otherwise, the following sub-settings are allowed:

Definition at line 33 of file DensityProfile.hpp.

Constructor & Destructor Documentation

◆ DensityProfile()

OpenMPCD::DensityProfile::DensityProfile ( const unsigned int  mpcBoxSizeX,
const unsigned int  mpcBoxSizeY,
const unsigned int  mpcBoxSizeZ,
const Configuration::Setting settings 
)

The constructor.

Parameters
[in]mpcBoxSizeXThe MPC simulation box size along the \( x \) direction.
[in]mpcBoxSizeYThe MPC simulation box size along the \( y \) direction.
[in]mpcBoxSizeZThe MPC simulation box size along the \( z \) direction.
[in]settingsThe settings for this instance.
Exceptions
OpenMPCD::InvalidArgumentExceptionIf OPENMPCD_DEBUG is defined, throws if any of the numerical arguments is 0.
OpenMPCD::InvalidConfigurationExceptionThrows if the configuration is invalid.

Definition at line 9 of file DensityProfile.cpp.

Member Function Documentation

◆ add()

void OpenMPCD::DensityProfile::add ( const std::vector< std::vector< std::vector< FP > > >::size_type  x,
const std::vector< std::vector< FP > >::size_type  y,
const std::vector< FP >::size_type  z,
const FP  m 
)
inline

Adds mass to the given point.

The coordinates given to this function are the index of the cell and its subdivisions.

Exceptions
OutOfBoundsExceptionIf OPENMPCD_DEBUG is defined, throws if x, y, or z are too large.
Parameters
[in]xThe x coordinate of the point.
[in]yThe y coordinate of the point.
[in]zThe z coordinate of the point.
[in]mThe mass to add.

Definition at line 109 of file DensityProfile.hpp.

◆ getCellSubdivisionsX()

unsigned int OpenMPCD::DensityProfile::getCellSubdivisionsX ( ) const
inline

Returns the number of times collision cells are subdivided along the \( x \) direction.

Definition at line 69 of file DensityProfile.hpp.

◆ getCellSubdivisionsY()

unsigned int OpenMPCD::DensityProfile::getCellSubdivisionsY ( ) const
inline

Returns the number of times collision cells are subdivided along the \( y \) direction.

Definition at line 78 of file DensityProfile.hpp.

◆ getCellSubdivisionsZ()

unsigned int OpenMPCD::DensityProfile::getCellSubdivisionsZ ( ) const
inline

Returns the number of times collision cells are subdivided along the \( z \) direction.

Definition at line 87 of file DensityProfile.hpp.

◆ incrementFillCount()

void OpenMPCD::DensityProfile::incrementFillCount ( )
inline

Increments the fill count.

Definition at line 95 of file DensityProfile.hpp.

◆ saveToFile()

void OpenMPCD::DensityProfile::saveToFile ( const std::string &  path) const

Saves the data into a file with the given path.

Each line represents one point in the density profile. The first three columns are the x, y, and z coordinates of the point, respectively. The last column shows the averaged mass density at that point.

Parameters
[in]pathThe path to save to.
Exceptions
IOExceptionThrows on an IO error.

Definition at line 47 of file DensityProfile.cpp.


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