MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
maia::filter::slope::detail_ Namespace Reference

Functions

template<typename T , typename F >
f2way (const T a, const T b, const T c, const T d, const T x, F &&f)
 Auxiliary function to create two-way slope filters. More...
 
template<MInt nDim, typename T , typename F >
fbox (const T *const boxmin, const T *const boxmax, const T width, const T *const x, F &&f)
 Auxiliary function to create a box slope filter (constant slope width) More...
 
template<MInt nDim, typename T , typename F >
fmultibox (const T *const boxmin, const T *const boxmax, const T *const width, const T *const x, F &&f)
 Auxiliary function to create a box slope filter (variable slope width) More...
 
template<MInt nDim, typename T , typename F >
fsphere (const T *const center, const T radius, const T width, const T *const x, F &&f)
 Auxiliary function to create a sphere slope filter. More...
 

Function Documentation

◆ f2way()

template<typename T , typename F >
T maia::filter::slope::detail_::f2way ( const T  a,
const T  b,
const T  c,
const T  d,
const T  x,
F &&  f 
)

Definition at line 27 of file filter.h.

27 {
28 if(x < c) {
29 return f(a, b, x);
30 } else {
31 return 1.0 - f(c, d, x);
32 }
33}
Definition: contexttypes.h:19

◆ fbox()

template<MInt nDim, typename T , typename F >
T maia::filter::slope::detail_::fbox ( const T *const  boxmin,
const T *const  boxmax,
const T  width,
const T *const  x,
F &&  f 
)

Definition at line 37 of file filter.h.

37 {
38 T r = 0.0;
39 for(MInt i = 0; i < nDim; i++) {
40 if(boxmin[i] - x[i] > 0.0) {
41 r += (boxmin[i] - x[i]) * (boxmin[i] - x[i]);
42 } else if(x[i] - boxmax[i] > 0.0) {
43 r += (x[i] - boxmax[i]) * (x[i] - boxmax[i]);
44 }
45 }
46 return 1.0 - f(0.0, width, std::sqrt(r));
47}
int32_t MInt
Definition: maiatypes.h:62

◆ fmultibox()

template<MInt nDim, typename T , typename F >
T maia::filter::slope::detail_::fmultibox ( const T *const  boxmin,
const T *const  boxmax,
const T *const  width,
const T *const  x,
F &&  f 
)

Definition at line 51 of file filter.h.

51 {
52 T filter = 1.0;
53 for(MInt i = 0; i < nDim; i++) {
54 filter *= f2way(boxmin[i] - width[2 * i], boxmin[i], boxmax[i], boxmax[i] + width[2 * i + 1], x[i], f);
55 }
56 return filter;
57}
T f2way(const T a, const T b, const T c, const T d, const T x, F &&f)
Auxiliary function to create two-way slope filters.
Definition: filter.h:27

◆ fsphere()

template<MInt nDim, typename T , typename F >
T maia::filter::slope::detail_::fsphere ( const T *const  center,
const T  radius,
const T  width,
const T *const  x,
F &&  f 
)

Definition at line 61 of file filter.h.

61 {
62 T r = 0.0;
63 for(MInt i = 0; i < nDim; i++) {
64 r += (x[i] - center[i]) * (x[i] - center[i]);
65 }
66 return 1.0 - f(0.0, width, std::sqrt(r) - radius);
67}