v0.9.1
Static Public Member Functions | List of all members
ApproxFunction Struct Reference

Static Public Member Functions

static double fun (double x, double y, double z)
 
static VectorDouble3 diff_fun (double x, double y, double z)
 
static double fun (double x, double y)
 
static VectorDouble3 diff_fun (double x, double y)
 

Detailed Description

Examples
prism_polynomial_approximation.cpp, and quad_polynomial_approximation.cpp.

Definition at line 28 of file prism_polynomial_approximation.cpp.

Member Function Documentation

◆ diff_fun() [1/2]

static VectorDouble3 ApproxFunction::diff_fun ( double  x,
double  y,
double  z 
)
static
Examples
prism_polynomial_approximation.cpp, and quad_polynomial_approximation.cpp.

Definition at line 44 of file prism_polynomial_approximation.cpp.

44  {
45  VectorDouble3 r(3);
46  r.clear();
47  for (int o = 1; o <= approx_order; ++o) {
48  for (int i = 0; i <= o; ++i) {
49  for (int j = 0; j <= (o - i); ++j) {
50  int k = o - i - j;
51  if (k >= 0) {
52  r[0] += i > 0 ? i * pow(x, i - 1) * pow(y, j) * pow(z, k) : 0;
53  r[1] += j > 0 ? j * pow(x, i) * pow(y, j - 1) * pow(z, k) : 0;
54  r[2] += k > 0 ? k * pow(x, i) * pow(y, j) * pow(z, k - 1) : 0;
55  }
56  }
57  }
58  }
59  return r;
60  }
static constexpr int approx_order
FTensor::Index< 'k', 2 > k
Definition: ContactOps.hpp:28
VectorBoundedArray< double, 3 > VectorDouble3
Definition: Types.hpp:87
FTensor::Index< 'j', 2 > j
Definition: ContactOps.hpp:27
FTensor::Index< 'i', 2 > i
[Common data]
Definition: ContactOps.hpp:26

◆ diff_fun() [2/2]

static VectorDouble3 ApproxFunction::diff_fun ( double  x,
double  y 
)
static

Definition at line 45 of file quad_polynomial_approximation.cpp.

45  {
46  VectorDouble3 r(2);
47  r.clear();
48  for (int o = 1; o <= approx_order; ++o) {
49  for (int i = 0; i <= o; ++i) {
50  int j = o - i;
51  if (j >= 0) {
52  r[0] += i > 0 ? i * pow(x, i - 1) * pow(y, j) : 0;
53  r[1] += j > 0 ? j * pow(x, i) * pow(y, j - 1) : 0;
54  }
55  }
56  }
57  return r;
58  }
static constexpr int approx_order
VectorBoundedArray< double, 3 > VectorDouble3
Definition: Types.hpp:87
FTensor::Index< 'j', 2 > j
Definition: ContactOps.hpp:27
FTensor::Index< 'i', 2 > i
[Common data]
Definition: ContactOps.hpp:26

◆ fun() [1/2]

static double ApproxFunction::fun ( double  x,
double  y,
double  z 
)
static
Examples
prism_polynomial_approximation.cpp, and quad_polynomial_approximation.cpp.

Definition at line 29 of file prism_polynomial_approximation.cpp.

29  {
30  double r = 1;
31  for (int o = 1; o <= approx_order; ++o) {
32  for (int i = 0; i <= o; ++i) {
33  for (int j = 0; j <= (o - i); ++j) {
34  int k = o - i - j;
35  if (k >= 0) {
36  r += pow(x, i) * pow(y, j) * pow(z, k);
37  }
38  }
39  }
40  }
41  return r;
42  }
static constexpr int approx_order
FTensor::Index< 'k', 2 > k
Definition: ContactOps.hpp:28
FTensor::Index< 'j', 2 > j
Definition: ContactOps.hpp:27
FTensor::Index< 'i', 2 > i
[Common data]
Definition: ContactOps.hpp:26

◆ fun() [2/2]

static double ApproxFunction::fun ( double  x,
double  y 
)
static

Definition at line 33 of file quad_polynomial_approximation.cpp.

33  {
34  double r = 1;
35  for (int o = 1; o <= approx_order; ++o) {
36  for (int i = 0; i <= o; ++i) {
37  int j = o - i;
38  if (j >= 0)
39  r += pow(x, i) * pow(y, j);
40  }
41  }
42  return r;
43  }
static constexpr int approx_order
FTensor::Index< 'j', 2 > j
Definition: ContactOps.hpp:27
FTensor::Index< 'i', 2 > i
[Common data]
Definition: ContactOps.hpp:26

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