v0.13.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 16 of file prism_polynomial_approximation.cpp.

Member Function Documentation

◆ diff_fun() [1/2]

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

Definition at line 33 of file quad_polynomial_approximation.cpp.

33 {
35 r.clear();
36 for (int o = 1; o <= approx_order; ++o) {
37 for (int i = 0; i <= o; ++i) {
38 int j = o - i;
39 if (j >= 0) {
40 r[0] += i > 0 ? i * pow(x, i - 1) * pow(y, j) : 0;
41 r[1] += j > 0 ? j * pow(x, i) * pow(y, j - 1) : 0;
42 }
43 }
44 }
45 return r;
46 }
static Index< 'o', 3 > o
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'j', 3 > j
VectorBoundedArray< double, 3 > VectorDouble3
Definition: Types.hpp:92
const double r
rate factor
static constexpr int approx_order

◆ diff_fun() [2/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 32 of file prism_polynomial_approximation.cpp.

32 {
34 r.clear();
35 for (int o = 1; o <= approx_order; ++o) {
36 for (int i = 0; i <= o; ++i) {
37 for (int j = 0; j <= (o - i); ++j) {
38 int k = o - i - j;
39 if (k >= 0) {
40 r[0] += i > 0 ? i * pow(x, i - 1) * pow(y, j) * pow(z, k) : 0;
41 r[1] += j > 0 ? j * pow(x, i) * pow(y, j - 1) * pow(z, k) : 0;
42 r[2] += k > 0 ? k * pow(x, i) * pow(y, j) * pow(z, k - 1) : 0;
43 }
44 }
45 }
46 }
47 return r;
48 }
FTensor::Index< 'k', 3 > k
static constexpr int approx_order

◆ fun() [1/2]

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

Definition at line 21 of file quad_polynomial_approximation.cpp.

21 {
22 double r = 1;
23 for (int o = 1; o <= approx_order; ++o) {
24 for (int i = 0; i <= o; ++i) {
25 int j = o - i;
26 if (j >= 0)
27 r += pow(x, i) * pow(y, j);
28 }
29 }
30 return r;
31 }

◆ fun() [2/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 17 of file prism_polynomial_approximation.cpp.

17 {
18 double r = 1;
19 for (int o = 1; o <= approx_order; ++o) {
20 for (int i = 0; i <= o; ++i) {
21 for (int j = 0; j <= (o - i); ++j) {
22 int k = o - i - j;
23 if (k >= 0) {
24 r += pow(x, i) * pow(y, j) * pow(z, k);
25 }
26 }
27 }
28 }
29 return r;
30 }

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