Chombo + EB  3.2
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | List of all members
SmoothAbsoluteValue Class Reference

#include <SmoothAbsoluteValue.H>

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 More...
 
void checkAgainstKnown (const Real &a_myAnswer, const IntVect &a_deriv, const RealVect &a_point) const
 if s_knownFunc is set, check against known answer More...
 

Protected Attributes

const BaseIFm_f
 
const BaseIFm_g
 
Real m_d
 
Real m_pi
 

Static Protected Attributes

static int s_knownFunc
 for debugging against known functions More...
 

Private Member Functions

 SmoothAbsoluteValue (const SmoothAbsoluteValue &a_inputIF)
 
 SmoothAbsoluteValue ()
 
void operator= (const SmoothAbsoluteValue &a_inputIF)
 

Detailed Description

Functions to take a smooth absolute value of the difference between two functions A_e(a,b) = |a-b|

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))

Constructor & Destructor Documentation

◆ SmoothAbsoluteValue() [1/3]

SmoothAbsoluteValue::SmoothAbsoluteValue ( const BaseIF a_f,
const BaseIF a_g,
const Real a_delta 
)
inline

References m_d, m_f, m_g, and m_pi.

◆ ~SmoothAbsoluteValue()

virtual SmoothAbsoluteValue::~SmoothAbsoluteValue ( )
inlinevirtual

◆ SmoothAbsoluteValue() [2/3]

SmoothAbsoluteValue::SmoothAbsoluteValue ( const SmoothAbsoluteValue a_inputIF)
inlineprivate

References MayDay::Abort().

◆ SmoothAbsoluteValue() [3/3]

SmoothAbsoluteValue::SmoothAbsoluteValue ( )
inlineprivate

References MayDay::Abort().

Member Function Documentation

◆ setKnownFunction()

static void SmoothAbsoluteValue::setKnownFunction ( int  a_whichfunc)
inlinestatic

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.

◆ smoothAbsFMinusG()

virtual Real SmoothAbsoluteValue::smoothAbsFMinusG ( const IntVect a_deriv,
const RealVect a_point 
) const
virtual

Referenced by ~SmoothAbsoluteValue().

◆ getWCase()

void SmoothAbsoluteValue::getWCase ( int &  a_case,
Real a_wval,
const RealVect a_point 
) const

returns -1 if w < -delta, 1 if w > delta, 0 otherwise reduces to regular |f-g| unless case == 0

Referenced by ~SmoothAbsoluteValue().

◆ valueAem()

virtual Real SmoothAbsoluteValue::valueAem ( const RealVect a_point) const
protectedvirtual

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();

Referenced by DoubleRampExact::~DoubleRampExact(), DoubleSphereExact::~DoubleSphereExact(), OffsetSphereExact::~OffsetSphereExact(), and ~SmoothAbsoluteValue().

◆ firstDerivAem()

virtual Real SmoothAbsoluteValue::firstDerivAem ( const IntVect a_deriv,
const RealVect a_point 
) const
protectedvirtual

◆ secondDerivAem()

virtual Real SmoothAbsoluteValue::secondDerivAem ( const IntVect a_deriv,
const RealVect a_point 
) const
protectedvirtual

◆ thirdDerivAem()

virtual Real SmoothAbsoluteValue::thirdDerivAem ( const IntVect a_deriv,
const RealVect a_point 
) const
protectedvirtual

◆ fourthDerivAem()

virtual Real SmoothAbsoluteValue::fourthDerivAem ( const IntVect a_deriv,
const RealVect a_point 
) const
protectedvirtual

◆ isBogus()

bool SmoothAbsoluteValue::isBogus ( const Real a_number) const
protected

just checks nan

Referenced by ~SmoothAbsoluteValue().

◆ checkAgainstKnown()

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

Referenced by ~SmoothAbsoluteValue().

◆ operator=()

void SmoothAbsoluteValue::operator= ( const SmoothAbsoluteValue a_inputIF)
inlineprivate

References MayDay::Abort().

Member Data Documentation

◆ m_f

const BaseIF* SmoothAbsoluteValue::m_f
protected

Referenced by SmoothAbsoluteValue().

◆ m_g

const BaseIF* SmoothAbsoluteValue::m_g
protected

Referenced by SmoothAbsoluteValue().

◆ m_d

Real SmoothAbsoluteValue::m_d
protected

◆ m_pi

Real SmoothAbsoluteValue::m_pi
protected

◆ s_knownFunc

int SmoothAbsoluteValue::s_knownFunc
staticprotected

for debugging against known functions

Referenced by setKnownFunction().


The documentation for this class was generated from the following file: