PeriDEM 0.2.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
material::ConstInfluenceFn Class Reference

A class to implement constant influence function. More...

#include <influenceFn.h>

Inheritance diagram for material::ConstInfluenceFn:
Collaboration diagram for material::ConstInfluenceFn:

Public Member Functions

 ConstInfluenceFn (const std::vector< double > &params, const size_t &dim)
 Constructor.
 
double getInfFn (const double &r) const override
 Returns the value of influence function.
 
double getMoment (const size_t &i) const override
 Returns the moment of influence function.
 
std::string printStr (int nt, int lvl) const override
 Returns the string containing printable information about the object.
 
void print (int nt, int lvl) const override
 Prints the information about the object.
 
void print () const override
 Prints the information about the object.
 
- Public Member Functions inherited from material::BaseInfluenceFn
 BaseInfluenceFn ()=default
 Constructor.
 

Private Attributes

double d_a0
 Constant such that J(r) = Constant.
 

Detailed Description

A class to implement constant influence function.

Definition at line 79 of file influenceFn.h.

Constructor & Destructor Documentation

◆ ConstInfluenceFn()

material::ConstInfluenceFn::ConstInfluenceFn ( const std::vector< double > &  params,
const size_t &  dim 
)

Constructor.

Parameters
paramsList of parameters
dimDimension

Definition at line 14 of file influenceFn.cpp.

16 : BaseInfluenceFn(), d_a0(0.) {
17
18 d_a0 = params.empty() ? double(dim + 1) : params[0];
19}
BaseInfluenceFn()=default
Constructor.
double d_a0
Constant such that J(r) = Constant.

References d_a0.

Member Function Documentation

◆ getInfFn()

double material::ConstInfluenceFn::getInfFn ( const double &  r) const
overridevirtual

Returns the value of influence function.

Parameters
rReference (initial) bond length
Returns
value Influence function at r

Implements material::BaseInfluenceFn.

Definition at line 21 of file influenceFn.cpp.

21 {
22 return d_a0;
23}

◆ getMoment()

double material::ConstInfluenceFn::getMoment ( const size_t &  i) const
overridevirtual

Returns the moment of influence function.

If \( J(r) \) is the influence function for \( r\in [0,1)\) then \( i^{th}\) moment is given by

\[ M_i = \int_0^1 J(r) r^i dr. \]

Parameters
iith moment
Returns
moment Moment

Implements material::BaseInfluenceFn.

Definition at line 25 of file influenceFn.cpp.

25 {
26 return d_a0 / double(i + 1);
27}

Referenced by printStr().

Here is the caller graph for this function:

◆ print() [1/2]

void material::ConstInfluenceFn::print ( ) const
inlineoverridevirtual

Prints the information about the object.

Reimplemented from material::BaseInfluenceFn.

Definition at line 140 of file influenceFn.h.

140{ print(0, 0); }
void print() const override
Prints the information about the object.

References print().

Referenced by print().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print() [2/2]

void material::ConstInfluenceFn::print ( int  nt,
int  lvl 
) const
inlineoverridevirtual

Prints the information about the object.

Parameters
ntNumber of tabs to append before printing
lvlInformation level (higher means more information)

Reimplemented from material::BaseInfluenceFn.

Definition at line 135 of file influenceFn.h.

135 {
136 std::cout << printStr(nt, lvl);
137 }
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.

References printStr().

Here is the call graph for this function:

◆ printStr()

std::string material::ConstInfluenceFn::printStr ( int  nt,
int  lvl 
) const
inlineoverridevirtual

Returns the string containing printable information about the object.

Parameters
ntNumber of tabs to append before printing
lvlInformation level (higher means more information)
Returns
string String containing printable information about the object

Reimplemented from material::BaseInfluenceFn.

Definition at line 115 of file influenceFn.h.

115 {
116
117 auto tabS = util::io::getTabS(nt);
118 std::ostringstream oss;
119 oss << tabS << "------- ConstInfluenceFn --------" << std::endl << std::endl;
120 oss << tabS << "Constant function with constant = " << d_a0 << std::endl;
121 oss << tabS << "First moment = " << getMoment(1)
122 << ", second moment = " << getMoment(2)
123 << ", third moment = " << getMoment(3) << std::endl;
124 oss << tabS << std::endl;
125
126 return oss.str();
127 }
double getMoment(const size_t &i) const override
Returns the moment of influence function.
std::string getTabS(int nt)
Returns tab spaces of given size.
Definition io.h:40

References d_a0, getMoment(), and util::io::getTabS().

Referenced by print().

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ d_a0

double material::ConstInfluenceFn::d_a0
private

Constant such that J(r) = Constant.

Definition at line 144 of file influenceFn.h.

Referenced by ConstInfluenceFn(), and printStr().


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