libfbm  0.3
Simulation of multi-dimensional stationary Gaussian processes and fractional Brownian motion.
 All Classes Namespaces Functions Variables Friends
Public Member Functions | Protected Member Functions | Friends
libfbm::SGPContext Class Reference

Abstract stationary Gaussian process context. More...

#include <libfbm.hpp>

Inheritance diagram for libfbm::SGPContext:
libfbm::FBMSteinContext libfbm::FGNContext libfbm::PowerLawContext libfbm::FWSContext

List of all members.

Public Member Functions

 SGPContext (const zvec &fieldDim, const zvec &userDim, const std::string &cacheName)
 Constructor.
virtual ~SGPContext ()
virtual double cov (const zvec &p)=0
 Covariance function.
const zvecgetDim () const
 Get the usable dimension of the generated field.
const zvecgetFieldDim () const
 Get the physical dimension of the generated field.
void setCacheDir (const std::string &cacheDir)
 Set the cache directory.
size_t badEigenCount () const
 Return the number of bad eigenvalues encountered.
bool initCache (bool forceRecalc=false)
 Initialize the cache.

Protected Member Functions

virtual void postProcess (Field &field, GaussianGenerator &rng)
 Postprocessor called after field generation.
void setScaleResult (double f)
 Scale the output values by factor f.

Friends

class Field

Detailed Description

Abstract stationary Gaussian process context.

Used by the Field. This class provides random number generation and filesystem based caching. To define your own covariance function, you must create a class that extends this. Word of warning: if you have enabled caching, but change cov(), the results from the old version are loaded. To overcome this you must manually delete the old cache. To overcome this you should incorporate paramters affecting cov() into the constructor's cacheName argument.

Definition at line 630 of file libfbm.hpp.


Constructor & Destructor Documentation

libfbm::SGPContext::SGPContext ( const zvec fieldDim,
const zvec userDim,
const std::string &  cacheName 
)

Constructor.

The cacheName is the cache identifier used to distinct between cache files on the HD. So if your extension of this class has some paramters affecting cov(), they should be incorporated into cacheName. It is used in the file system path so must be sane in that regard.

virtual libfbm::SGPContext::~SGPContext ( )
virtual

Member Function Documentation

size_t libfbm::SGPContext::badEigenCount ( ) const
inline

Return the number of bad eigenvalues encountered.

Definition at line 653 of file libfbm.hpp.

virtual double libfbm::SGPContext::cov ( const zvec p)
pure virtual

Covariance function.

Implemented in libfbm::PowerLawContext, libfbm::FBMSteinContext, and libfbm::FGNContext.

const zvec& libfbm::SGPContext::getDim ( ) const
inline

Get the usable dimension of the generated field.

Definition at line 645 of file libfbm.hpp.

const zvec& libfbm::SGPContext::getFieldDim ( ) const
inline

Get the physical dimension of the generated field.

It may be greater than the usable dimension returned by getDim().

Definition at line 647 of file libfbm.hpp.

bool libfbm::SGPContext::initCache ( bool  forceRecalc = false)

Initialize the cache.

Either loads from cache (quick) or generates (slow). This is called automatically by Field::generate().

Parameters:
forceRecalcForce recalculation and rewriting of the cache.
Returns:
Returns false in case negative eigenvalues were found. Otherwise returns true.
virtual void libfbm::SGPContext::postProcess ( Field field,
GaussianGenerator rng 
)
protectedvirtual

Postprocessor called after field generation.

This is called automatically by Field::generate().

Reimplemented in libfbm::FBMSteinContext, and libfbm::FWSContext.

void libfbm::SGPContext::setCacheDir ( const std::string &  cacheDir)

Set the cache directory.

Must be called before construction of Field-s.

void libfbm::SGPContext::setScaleResult ( double  f)
inlineprotected

Scale the output values by factor f.

This is assembled into the cached FFT matrix so must be called before initCache or Field::generate(). If you change the value, you must either erase the cache or incorporate it into cacheName.

Definition at line 673 of file libfbm.hpp.


Friends And Related Function Documentation

friend class Field
friend

Definition at line 684 of file libfbm.hpp.


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