MADNESS 0.10.1
madness::KernelRange Class Reference

#include <kernelrange.h>

Classes

struct  Data
struct  Restrictor
 restrictor function More...

Public Types

enum  Type { Hard , SoftErf }
 types of range restrictor functions More...

Public Member Functions

 KernelRange ()=default
 KernelRange (unsigned int N)
 KernelRange (unsigned int N, double sigma)
bool finite () const
bool finite_hard () const
bool finite_soft () const
hashT hash () const
int iextent_x2 (double epsilon=extent_default_epsilon) const
bool infinite () const
unsigned int N () const
 operator bool () const
double sigma () const
Type type () const
double value (double r) const

Static Public Attributes

static constexpr double extent_default_epsilon = std::numeric_limits<double>::epsilon()

Private Member Functions

const Restrictor & restrictor () const

Private Attributes

std::optional< Data > data

Friends

bool operator== (const KernelRange &r1, const KernelRange &r2)

Detailed Description

To limit the range of kernel K(x-y) it is multiplied (in user coordinates) by a restrictor function $ r(N/2 - |x-y|) $, where $ r(x) $ is identity for unrestricted kernel or one of the choices encoded by KernelRange::Type

Member Enumeration Documentation

◆ Type

types of range restrictor functions

Enumerator
Hard 

Heavyside (step) function: $ r(x) \equiv \theta(x)$.

SoftErf 

erf approximation to Heavyside function: $ r(x) \equiv \theta_\sigma(x) \equiv (1 + \erf(x/\sigma))/2 $; in the limit $\sigma\to 0$ this becomes the Heaviside function.

Constructor & Destructor Documentation

◆ KernelRange() [1/3]

madness::KernelRange::KernelRange ( )
default

constructs a null (i.e., infinite) kernel range

Postcondition
this->infinite()==true

Referenced by operator==.

◆ KernelRange() [2/3]

madness::KernelRange::KernelRange ( unsigned int N,
double sigma )
inline

constructs a finite soft (sigma > 0) or hard (sigma==0) kernel range

Parameters
sigmaregularization parameter (lengthscale in simulation [0,1] coordinate units) controls the softness of the range restrictor
Precondition
sigma>=0
Postcondition
this->soft()==true

References data, Hard, MADNESS_ASSERT, N(), sigma(), and SoftErf.

◆ KernelRange() [3/3]

madness::KernelRange::KernelRange ( unsigned int N)
inline

constructs a finite (hard) kernel range

Postcondition
this->hard()==true

References data, and N().

Member Function Documentation

◆ finite()

bool madness::KernelRange::finite ( ) const
inline
Returns
true if range is limited

References data.

Referenced by finite_hard(), finite_soft(), infinite(), operator bool(), and operator==.

◆ finite_hard()

bool madness::KernelRange::finite_hard ( ) const
inline
Returns
true if range is limited using a hard window function (Heaviside)

References finite(), Hard, and type().

◆ finite_soft()

bool madness::KernelRange::finite_soft ( ) const
inline
Returns
true if range is limited using a soft window function (sigmoid)

References finite(), Hard, and type().

◆ hash()

hashT madness::KernelRange::hash ( ) const
inline

◆ iextent_x2()

int madness::KernelRange::iextent_x2 ( double epsilon = extent_default_epsilon) const
inline
Returns
max value of |x-y| (rounded up, in units of 1/2) for which r(N/2 - |x-y|) is greater than epsilon

References data, epsilon, extent_default_epsilon, infinite(), and MADNESS_ASSERT.

◆ infinite()

bool madness::KernelRange::infinite ( ) const
inline
Returns
true if range is unlimited

References finite().

Referenced by hash(), iextent_x2(), and value().

◆ N()

unsigned int madness::KernelRange::N ( ) const
inline

References data.

Referenced by KernelRange(), KernelRange(), hash(), operator==, and value().

◆ operator bool()

madness::KernelRange::operator bool ( ) const
inlineexplicit
Returns
true if range is limited

References finite().

◆ restrictor()

const Restrictor & madness::KernelRange::restrictor ( ) const
inlineprivate

References data.

Referenced by hash(), operator==, sigma(), type(), and value().

◆ sigma()

double madness::KernelRange::sigma ( ) const
inline

◆ type()

Type madness::KernelRange::type ( ) const
inline

◆ value()

double madness::KernelRange::value ( double r) const
inline
Returns
value of restrictor function at N/2 - abs(r)

References std::abs(), infinite(), N(), restrictor(), and madness::KernelRange::Restrictor::value().

Referenced by madness::KernelRange::Data::compute_iextent_x2().

◆ operator==

bool operator== ( const KernelRange & r1,
const KernelRange & r2 )
friend
Returns
true if r1 and r2 are equal

References KernelRange(), finite(), N(), madness::r2(), and restrictor().

Member Data Documentation

◆ data

std::optional<Data> madness::KernelRange::data
private

◆ extent_default_epsilon

double madness::KernelRange::extent_default_epsilon = std::numeric_limits<double>::epsilon()
staticconstexpr

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