9 #ifndef MATERIAL_PD_INFLUENCEFN_H
10 #define MATERIAL_PD_INFLUENCEFN_H
15 #include "util/utilIO.h"
34 virtual double getInfFn(
const double &r)
const = 0;
45 virtual double getMoment(
const size_t &i)
const = 0;
56 virtual std::string
printStr(
int nt,
int lvl)
const {
59 std::ostringstream oss;
60 oss << tabS <<
"------- BaseInfluenceFn --------" << std::endl << std::endl;
61 oss << tabS <<
"Provides abstraction for different influence function "
63 oss << tabS << std::endl;
75 virtual void print(
int nt,
int lvl)
const { std::cout <<
printStr(nt, lvl); }
95 d_a0 = params.empty() ? double(dim + 1) : params[0];
118 return d_a0 / double(i + 1);
130 std::string
printStr(
int nt,
int lvl)
const override {
133 std::ostringstream oss;
134 oss << tabS <<
"------- ConstInfluenceFn --------" << std::endl << std::endl;
135 oss << tabS <<
"Constant function with constant = " <<
d_a0 << std::endl;
136 oss << tabS <<
"First moment = " <<
getMoment(1)
138 <<
", third moment = " <<
getMoment(3) << std::endl;
139 oss << tabS << std::endl;
151 void print(
int nt,
int lvl)
const override {
180 if (params.empty()) {
186 }
else if (dim == 2) {
189 }
else if (dim == 3) {
195 if (params.size() < 2)
222 return (
d_a0 /
double(i + 1)) + (
d_a1 / double(i + 2));
234 std::string
printStr(
int nt,
int lvl)
const override {
237 std::ostringstream oss;
238 oss << tabS <<
"------- LinearInfluenceFn --------" << std::endl << std::endl;
239 oss << tabS <<
"Linear function a0 + a1*r with constants: a0 = "
240 <<
d_a0 <<
", a1 = " <<
d_a1 << std::endl;
241 oss << tabS <<
"First moment = " <<
getMoment(1)
243 <<
", third moment = " <<
getMoment(3) << std::endl;
244 oss << tabS << std::endl;
256 void print(
int nt,
int lvl)
const override {
288 if (params.empty()) {
296 (std::sqrt(M_PI *
d_beta) * std::erf(1.0 / std::sqrt(
d_beta)) -
297 2.0 * std::exp(-1.0 /
d_beta));
328 double sq1 = std::sqrt(
d_beta);
329 double sq2 = std::sqrt(M_PI);
335 return 0.5 *
d_alpha * sq1 * sq2 * std::erf(1. / sq1);
345 (0.5 * sq2 * std::erf(1. / sq1) -
346 (1. / sq1) * std::exp(-1. /
d_beta));
364 std::string
printStr(
int nt,
int lvl)
const override {
367 std::ostringstream oss;
368 oss << tabS <<
"------- GaussianInfluenceFn --------" << std::endl << std::endl;
369 oss << tabS <<
"Gaussian function a0 * exp(-r*r / a1) with constants: a0 = "
371 oss << tabS <<
"First moment = " <<
getMoment(1)
373 <<
", third moment = " <<
getMoment(3) << std::endl;
374 oss << tabS << std::endl;
386 void print(
int nt,
int lvl)
const override {
A base class for computing influence function.
Definition: influenceFn.h:22
virtual void print(int nt, int lvl) const
Prints the information about the instance of the object.
Definition: influenceFn.h:75
BaseInfluenceFn()=default
Constructor.
virtual void print() const
Prints the information about the instance of the object.
Definition: influenceFn.h:81
virtual std::string printStr(int nt, int lvl) const
Returns the string containing information about the instance of the object.
Definition: influenceFn.h:56
virtual double getInfFn(const double &r) const =0
Returns the value of influence function.
virtual double getMoment(const size_t &i) const =0
Returns the moment of influence function.
A class to implement constant influence function.
Definition: influenceFn.h:85
std::string printStr(int nt, int lvl) const override
Returns the string containing information about the instance of the object.
Definition: influenceFn.h:130
double getMoment(const size_t &i) const override
Returns the moment of influence function.
Definition: influenceFn.h:117
double getInfFn(const double &r) const override
Returns the value of influence function.
Definition: influenceFn.h:104
void print() const override
Prints the information about the instance of the object.
Definition: influenceFn.h:159
double d_a0
Constant such that J(r) = Constant.
Definition: influenceFn.h:163
ConstInfluenceFn(const std::vector< double > ¶ms, const size_t &dim)
Constructor.
Definition: influenceFn.h:93
void print(int nt, int lvl) const override
Prints the information about the instance of the object.
Definition: influenceFn.h:151
A class to implement Gaussian influence function.
Definition: influenceFn.h:278
double getInfFn(const double &r) const override
Returns the value of influence function.
Definition: influenceFn.h:313
double getMoment(const size_t &i) const override
Returns the moment of influence function.
Definition: influenceFn.h:326
void print(int nt, int lvl) const override
Prints the information about the instance of the object.
Definition: influenceFn.h:386
void print() const override
Prints the information about the instance of the object.
Definition: influenceFn.h:394
double d_beta
Constants.
Definition: influenceFn.h:401
std::string printStr(int nt, int lvl) const override
Returns the string containing information about the instance of the object.
Definition: influenceFn.h:364
double d_alpha
Constants.
Definition: influenceFn.h:398
GaussianInfluenceFn(const std::vector< double > ¶ms, const size_t &dim)
Constructor.
Definition: influenceFn.h:286
A class to implement linear influence function.
Definition: influenceFn.h:170
LinearInfluenceFn(const std::vector< double > ¶ms, const size_t &dim)
Constructor.
Definition: influenceFn.h:178
double d_a0
Constants such that J(r) = d_a0 + d_a1 * r.
Definition: influenceFn.h:268
double getMoment(const size_t &i) const override
Returns the moment of influence function.
Definition: influenceFn.h:221
double getInfFn(const double &r) const override
Returns the value of influence function.
Definition: influenceFn.h:208
void print() const override
Prints the information about the instance of the object.
Definition: influenceFn.h:264
std::string printStr(int nt, int lvl) const override
Returns the string containing information about the instance of the object.
Definition: influenceFn.h:234
double d_a1
Constants such that J(r) = d_a0 + d_a1 * r.
Definition: influenceFn.h:271
void print(int nt, int lvl) const override
Prints the information about the instance of the object.
Definition: influenceFn.h:256
std::string getTabS(int nt)
Generate a string contaning nt tabs.
Definition: utilIO.h:26