MDStressLab++
Loading...
Searching...
No Matches
Method< TMethod > Class Template Reference

#include <Method.h>

Public Member Functions

virtual ~Method ()
 
double operator() (const Vector3d &vec) const
 The weighting function \(w\) used to compute stress.
 
double bondFunction (const Vector3d &vec1, const Vector3d &vec2) const
 The bond function \(b(\boldsymbol v^1, \boldsymbol v^2)\) gives the weight associated to a bond formed by two atoms.
 
double getAveragingDomainSize () const
 Gets the spatial size of the averaging domain, i.e. the support of the weighting function.
 

Protected Attributes

double averagingDomainSize
 

Detailed Description

template<typename TMethod>
class Method< TMethod >

This class provides a polymorphic interface for defining a method, which constitutes a weighting function and its associated bond function, to compute atomistic stress.

It is intended to be used as a CRTP (Curiously Recurring Template Pattern) base class: the actual implementation of the method should be provided in the derived class TMethod, which will override the weighting function call operator and bondFunction.

Template Parameters
TMethodThe derived class implementing specific method logic. Examples of derived classes include MethodSphere, MethodLdad<Constant>, and MethodLdad<Trigonometric>.

Definition at line 25 of file Method.h.

Constructor & Destructor Documentation

◆ ~Method()

template<typename TMethod >
Method< TMethod >::~Method ( )
virtual

Definition at line 45 of file Method.cpp.

Member Function Documentation

◆ bondFunction()

template<typename TMethod >
double Method< TMethod >::bondFunction ( const Vector3d vec1,
const Vector3d vec2 
) const

The bond function \(b(\boldsymbol v^1, \boldsymbol v^2)\) gives the weight associated to a bond formed by two atoms.

See also
calculateStress() to see how bondfunction is used in stress computation

The function delegates the actual implementation to TMethod::bondFunction(vec1, vec2).

The bond function is defined as

\[ \begin{equation} b(\boldsymbol v^1, \boldsymbol v^2)= \int_{s=0}^1 w((1-s)\boldsymbol v^1 + s\boldsymbol v^2) \, ds \end{equation} \]

The actual implementation of the bondFunction is delegated to TMethod::bondFunction(vec1, vec2).

Parameters
vec1first atomic position vector relative to a grid point
vec2second atomic position vector relative to a grid point
Returns
The scalar output of the bond function.

Definition at line 33 of file Method.cpp.

◆ getAveragingDomainSize()

template<typename TMethod >
double Method< TMethod >::getAveragingDomainSize ( ) const

Gets the spatial size of the averaging domain, i.e. the support of the weighting function.

Returns
Averaging domain radius or cutoff, as a double.

Definition at line 40 of file Method.cpp.

◆ operator()()

template<typename TMethod >
double Method< TMethod >::operator() ( const Vector3d vec) const

The weighting function \(w\) used to compute stress.

See also
bondFunction() and calculateStress to see its usage in stress calculation.

This weighting function operator delegates the implementation to the derived TMethod class.

Parameters
vecA 3D vector
Returns
The scalar (non-negative) output of the weighting function.

Definition at line 26 of file Method.cpp.

Member Data Documentation

◆ averagingDomainSize

template<typename TMethod >
double Method< TMethod >::averagingDomainSize
protected

Definition at line 76 of file Method.h.


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