OpenMD  2.5
Molecular Dynamics in the Open
OpenMD::DataStorage Class Reference

#include <DataStorage.hpp>

Public Types

enum  {
  dslPosition = 1, dslVelocity = 2, dslForce = 4, dslAmat = 8,
  dslAngularMomentum = 16, dslTorque = 32, dslParticlePot = 64, dslDensity = 128,
  dslFunctional = 256, dslFunctionalDerivative = 512, dslDipole = 1024, dslQuadrupole = 2048,
  dslElectricField = 4096, dslSkippedCharge = 8192, dslFlucQPosition = 16384, dslFlucQVelocity = 32768,
  dslFlucQForce = 65536, dslSitePotential = 131072
}
 

Public Member Functions

 DataStorage ()
 
 DataStorage (std::size_t size, int storageLayout=0)
 
std::size_t getSize ()
 
void resize (std::size_t newSize)
 
void reserve (std::size_t size)
 
void copy (int source, std::size_t num, std::size_t target)
 
int getStorageLayout ()
 
void setStorageLayout (int layout)
 
RealType * getArrayPointer (int whichArray)
 

Static Public Member Functions

static std::size_t getBytesPerStuntDouble (int layout)
 

Public Attributes

vector< Vector3dposition
 
vector< Vector3dvelocity
 
vector< Vector3dforce
 
vector< RotMat3x3daMat
 
vector< Vector3dangularMomentum
 
vector< Vector3dtorque
 
vector< RealType > particlePot
 
vector< RealType > density
 
vector< RealType > functional
 
vector< RealType > functionalDerivative
 
vector< Vector3ddipole
 
vector< Mat3x3dquadrupole
 
vector< Vector3delectricField
 
vector< RealType > skippedCharge
 
vector< RealType > flucQPos
 
vector< RealType > flucQVel
 
vector< RealType > flucQFrc
 
vector< RealType > sitePotential
 

Private Member Functions

RealType * internalGetArrayPointer (vector< Vector3d > &v)
 
RealType * internalGetArrayPointer (vector< Mat3x3d > &v)
 
RealType * internalGetArrayPointer (vector< RealType > &v)
 
template<typename T >
void internalResize (std::vector< T > &v, std::size_t newSize)
 
template<typename T >
void internalCopy (std::vector< T > &v, int source, std::size_t num, std::size_t target)
 

Private Attributes

std::size_t size_
 
int storageLayout_
 

Detailed Description

Warning
do not try to insert element into (or ease element from) private member data of DataStorage directly.
Todo:
DataStorage may need refactoring. Every vector can inherit from the same base class which will make it easy to maintain

Definition at line 66 of file DataStorage.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
dslPosition 
dslVelocity 
dslForce 
dslAmat 
dslAngularMomentum 
dslTorque 
dslParticlePot 
dslDensity 
dslFunctional 
dslFunctionalDerivative 
dslDipole 
dslQuadrupole 
dslElectricField 
dslSkippedCharge 
dslFlucQPosition 
dslFlucQVelocity 
dslFlucQForce 
dslSitePotential 

Definition at line 69 of file DataStorage.hpp.

Constructor & Destructor Documentation

◆ DataStorage() [1/2]

OpenMD::DataStorage::DataStorage ( )

Definition at line 54 of file DataStorage.cpp.

◆ DataStorage() [2/2]

OpenMD::DataStorage::DataStorage ( std::size_t  size,
int  storageLayout = 0 
)

Definition at line 58 of file DataStorage.cpp.

References resize(), and setStorageLayout().

Member Function Documentation

◆ copy()

void OpenMD::DataStorage::copy ( int  source,
std::size_t  num,
std::size_t  target 
)

Copies data inside DataStorage class.

Copy function actually calls copy for every vector in DataStorage class. One Precondition of copy is that target is not within the range [source, soruce + num]

Parameters
source
numnumber of element to be moved
target

Definition at line 310 of file DataStorage.cpp.

References aMat, angularMomentum, density, dipole, dslAmat, dslAngularMomentum, dslDensity, dslDipole, dslElectricField, dslFlucQForce, dslFlucQPosition, dslFlucQVelocity, dslForce, dslFunctional, dslFunctionalDerivative, dslParticlePot, dslPosition, dslQuadrupole, dslSitePotential, dslSkippedCharge, dslTorque, dslVelocity, electricField, flucQFrc, flucQPos, flucQVel, force, functional, functionalDerivative, internalCopy(), particlePot, position, quadrupole, sitePotential, size_, skippedCharge, storageLayout_, torque, and velocity.

◆ getArrayPointer()

◆ getBytesPerStuntDouble()

std::size_t OpenMD::DataStorage::getBytesPerStuntDouble ( int  layout)
static

◆ getSize()

◆ getStorageLayout()

int OpenMD::DataStorage::getStorageLayout ( )

Returns the storage layout

Definition at line 387 of file DataStorage.cpp.

References storageLayout_.

Referenced by OpenMD::CutoffGroup::updateCOM().

◆ internalCopy()

template<typename T >
void OpenMD::DataStorage::internalCopy ( std::vector< T > &  v,
int  source,
std::size_t  num,
std::size_t  target 
)
private

Definition at line 502 of file DataStorage.cpp.

References OpenMD::first.

Referenced by copy().

◆ internalGetArrayPointer() [1/3]

RealType * OpenMD::DataStorage::internalGetArrayPointer ( std::vector< Vector3d > &  v)
private

Definition at line 459 of file DataStorage.cpp.

Referenced by getArrayPointer().

◆ internalGetArrayPointer() [2/3]

RealType * OpenMD::DataStorage::internalGetArrayPointer ( std::vector< Mat3x3d > &  v)
private

Definition at line 467 of file DataStorage.cpp.

◆ internalGetArrayPointer() [3/3]

RealType * OpenMD::DataStorage::internalGetArrayPointer ( std::vector< RealType > &  v)
private

Definition at line 476 of file DataStorage.cpp.

◆ internalResize()

template<typename T >
void OpenMD::DataStorage::internalResize ( std::vector< T > &  v,
std::size_t  newSize 
)
private

Definition at line 486 of file DataStorage.cpp.

Referenced by resize().

◆ reserve()

void OpenMD::DataStorage::reserve ( std::size_t  size)

Reallocates memory manually.

The main reason for using reserve() is efficiency if you know the capacity to which your vector must eventually grow, then it is usually more efficient to allocate that memory all at once.

Definition at line 236 of file DataStorage.cpp.

References aMat, angularMomentum, density, dipole, dslAmat, dslAngularMomentum, dslDensity, dslDipole, dslElectricField, dslFlucQForce, dslFlucQPosition, dslFlucQVelocity, dslForce, dslFunctional, dslFunctionalDerivative, dslParticlePot, dslPosition, dslQuadrupole, dslSitePotential, dslSkippedCharge, dslTorque, dslVelocity, electricField, flucQFrc, flucQPos, flucQVel, force, functional, functionalDerivative, particlePot, position, quadrupole, sitePotential, skippedCharge, storageLayout_, torque, and velocity.

◆ resize()

◆ setStorageLayout()

void OpenMD::DataStorage::setStorageLayout ( int  layout)

Member Data Documentation

◆ aMat

◆ angularMomentum

vector<Vector3d> OpenMD::DataStorage::angularMomentum

rotation matrix array

Definition at line 131 of file DataStorage.hpp.

Referenced by copy(), getArrayPointer(), getSize(), reserve(), and resize().

◆ density

◆ dipole

◆ electricField

◆ flucQFrc

◆ flucQPos

vector<RealType> OpenMD::DataStorage::flucQPos

◆ flucQVel

vector<RealType> OpenMD::DataStorage::flucQVel

fluctuating charges

Definition at line 142 of file DataStorage.hpp.

Referenced by copy(), getArrayPointer(), getSize(), reserve(), and resize().

◆ force

◆ functional

◆ functionalDerivative

◆ particlePot

◆ position

◆ quadrupole

◆ sitePotential

◆ size_

std::size_t OpenMD::DataStorage::size_
private

Definition at line 160 of file DataStorage.hpp.

Referenced by copy(), getSize(), resize(), and setStorageLayout().

◆ skippedCharge

◆ storageLayout_

int OpenMD::DataStorage::storageLayout_
private

Definition at line 161 of file DataStorage.hpp.

Referenced by copy(), getSize(), getStorageLayout(), reserve(), resize(), and setStorageLayout().

◆ torque

◆ velocity


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