#include <SmoothAbsoluteValue.H>
max(f, g) = (a + b + |a - b|)/2 We need to make abs(a-b) smooth.
We take the convolution of the absolute value with cos^4(pi w/(2 delta))
Public Member Functions | |
SmoothAbsoluteValue (const BaseIF *a_f, const BaseIF *a_g, const Real &a_delta) | |
virtual | ~SmoothAbsoluteValue () |
virtual Real | smoothAbsFMinusG (const IntVect &a_deriv, const RealVect &a_point) const |
void | getWCase (int &a_case, Real &a_wval, const RealVect &a_point) const |
Static Public Member Functions | |
static void | setKnownFunction (int a_whichfunc) |
Protected Member Functions | |
virtual Real | valueAem (const RealVect &a_point) const |
virtual Real | firstDerivAem (const IntVect &a_deriv, const RealVect &a_point) const |
virtual Real | secondDerivAem (const IntVect &a_deriv, const RealVect &a_point) const |
virtual Real | thirdDerivAem (const IntVect &a_deriv, const RealVect &a_point) const |
virtual Real | fourthDerivAem (const IntVect &a_deriv, const RealVect &a_point) const |
bool | isBogus (const Real &a_number) const |
just checks nan | |
void | checkAgainstKnown (const Real &a_myAnswer, const IntVect &a_deriv, const RealVect &a_point) const |
if s_knownFunc is set, check against known answer | |
Protected Attributes | |
const BaseIF * | m_f |
const BaseIF * | m_g |
Real | m_d |
Real | m_pi |
Static Protected Attributes | |
static int | s_knownFunc |
for debugging against known functions | |
Private Member Functions | |
SmoothAbsoluteValue (const SmoothAbsoluteValue &a_inputIF) | |
SmoothAbsoluteValue () | |
void | operator= (const SmoothAbsoluteValue &a_inputIF) |
virtual SmoothAbsoluteValue::~SmoothAbsoluteValue | ( | ) | [inline, virtual] |
SmoothAbsoluteValue::SmoothAbsoluteValue | ( | const SmoothAbsoluteValue & | a_inputIF | ) | [inline, private] |
References MayDay::Abort().
SmoothAbsoluteValue::SmoothAbsoluteValue | ( | ) | [inline, private] |
References MayDay::Abort().
static void SmoothAbsoluteValue::setKnownFunction | ( | int | a_whichfunc | ) | [inline, static] |
Set a known f and g (from short list I have programmed) to check answer against 1 = double ramp with ramp_normal_0 = 2. 1. 0. ramp_normal_1 = -2. 1. 0. ramp_point_0 = 0. 1. 0. ramp_point_1 = 1. 1. 0.
2 = double sphere with sphere_center_0 = 0 0 0 sphere_center_1 = 1 0 0 sphere_radius_0 = 0.75 sphere_radius_1 = 0.75
References s_knownFunc.
virtual Real SmoothAbsoluteValue::smoothAbsFMinusG | ( | const IntVect & | a_deriv, | |
const RealVect & | a_point | |||
) | const [virtual] |
returns -1 if w < -delta, 1 if w > delta, 0 otherwise reduces to regular |f-g| unless case == 0
Here is the logic of this stuff. We have three cases that reduce to two cases. w = f(x) - g(x) case 1: (w > delta): ---- whole integral is above zero answer = abs(w) case -1: (w < - delta): ---- whole integral is below zero answer = abs(w) case 0: (-delta <= w <= delta) --- have to split integral into above and below answer = functionAem();
virtual Real SmoothAbsoluteValue::firstDerivAem | ( | const IntVect & | a_deriv, | |
const RealVect & | a_point | |||
) | const [protected, virtual] |
virtual Real SmoothAbsoluteValue::secondDerivAem | ( | const IntVect & | a_deriv, | |
const RealVect & | a_point | |||
) | const [protected, virtual] |
virtual Real SmoothAbsoluteValue::thirdDerivAem | ( | const IntVect & | a_deriv, | |
const RealVect & | a_point | |||
) | const [protected, virtual] |
virtual Real SmoothAbsoluteValue::fourthDerivAem | ( | const IntVect & | a_deriv, | |
const RealVect & | a_point | |||
) | const [protected, virtual] |
bool SmoothAbsoluteValue::isBogus | ( | const Real & | a_number | ) | const [protected] |
just checks nan
void SmoothAbsoluteValue::checkAgainstKnown | ( | const Real & | a_myAnswer, | |
const IntVect & | a_deriv, | |||
const RealVect & | a_point | |||
) | const [protected] |
if s_knownFunc is set, check against known answer
void SmoothAbsoluteValue::operator= | ( | const SmoothAbsoluteValue & | a_inputIF | ) | [inline, private] |
References MayDay::Abort().
const BaseIF* SmoothAbsoluteValue::m_f [protected] |
Referenced by SmoothAbsoluteValue().
const BaseIF* SmoothAbsoluteValue::m_g [protected] |
Referenced by SmoothAbsoluteValue().
Real SmoothAbsoluteValue::m_d [protected] |
Referenced by SmoothAbsoluteValue().
Real SmoothAbsoluteValue::m_pi [protected] |
Referenced by SmoothAbsoluteValue().
int SmoothAbsoluteValue::s_knownFunc [static, protected] |