Chaste Commit::8b5d759ac2eb95e67ae57699734101efccb0a0a9
OffLatticeRandomFieldGenerator< SPACE_DIM > Class Template Reference

#include <OffLatticeRandomFieldGenerator.hpp>

+ Collaboration diagram for OffLatticeRandomFieldGenerator< SPACE_DIM >:

Public Member Functions

 OffLatticeRandomFieldGenerator (std::array< double, SPACE_DIM > lowerCorner, std::array< double, SPACE_DIM > upperCorner, std::array< bool, SPACE_DIM > periodicity, double lengthScale, double boxWidth=DOUBLE_UNSET)
 
virtual ~OffLatticeRandomFieldGenerator ()=default
 
std::vector< doubleSampleRandomField (const std::vector< Node< SPACE_DIM > * > &rNodes)
 
std::vector< doubleSampleRandomFieldAtTime (const std::vector< Node< SPACE_DIM > * > &rNodes, double time)
 
void SetRandomSeed (const unsigned seed)
 

Private Member Functions

template<class Archive >
void serialize (Archive &archive, const unsigned int version)
 

Private Attributes

std::array< double, SPACE_DIM > mLowerCorner
 
std::array< double, SPACE_DIM > mUpperCorner
 
std::array< bool, SPACE_DIM > mPeriodicity
 
double mLengthScale
 
std::unique_ptr< ObsoleteBoxCollection< SPACE_DIM > > mpBoxCollection
 
unsigned mNumNodesAtLastUpdate
 
OpenSimplex2S mOpenSimplex
 

Friends

class boost::serialization::access
 
class TestOffLatticeRandomFieldGenerator
 

Detailed Description

template<unsigned SPACE_DIM>
class OffLatticeRandomFieldGenerator< SPACE_DIM >

An OffLatticeRandomFieldGenerator for adding spatially-correlated noise to a mesh with off-lattice nodes.

Definition at line 54 of file OffLatticeRandomFieldGenerator.hpp.

Constructor & Destructor Documentation

◆ OffLatticeRandomFieldGenerator()

template<unsigned SPACE_DIM>
OffLatticeRandomFieldGenerator< SPACE_DIM >::OffLatticeRandomFieldGenerator ( std::array< double, SPACE_DIM >  lowerCorner,
std::array< double, SPACE_DIM >  upperCorner,
std::array< bool, SPACE_DIM >  periodicity,
double  lengthScale,
double  boxWidth = DOUBLE_UNSET 
)

Constructor that takes all parameters as arguments, and sets up an appropriate box collection.

Parameters
lowerCornerthe lower corner of the rectangular grid
upperCornerthe upper corner of the rectangular grid
periodicitywhether the grid is periodic in each dimension
lengthScalethe length scale of the correlation when calculating the covariance matrix
boxWidththe box size for the box collection. Defaults to DOUBLE_UNSET in which case it is reset appropriately.
Todo:
: Obsolete box collection should take a std::array<bool, DIM>

Definition at line 49 of file OffLatticeRandomFieldGenerator.cpp.

References DOUBLE_UNSET, OffLatticeRandomFieldGenerator< SPACE_DIM >::mOpenSimplex, and OffLatticeRandomFieldGenerator< SPACE_DIM >::mpBoxCollection.

◆ ~OffLatticeRandomFieldGenerator()

template<unsigned SPACE_DIM>
virtual OffLatticeRandomFieldGenerator< SPACE_DIM >::~OffLatticeRandomFieldGenerator ( )
virtualdefault

Default constructor.

Member Function Documentation

◆ SampleRandomField()

template<unsigned SPACE_DIM>
std::vector< double > OffLatticeRandomFieldGenerator< SPACE_DIM >::SampleRandomField ( const std::vector< Node< SPACE_DIM > * > &  rNodes)

Sample an instance of the random field.

Calls SampleRandomFieldAtTime() at a time chosen uniformly at random from 0 to 100 * lengthScale.

Parameters
rNodesa vector of nodes at which to sample the random field
Returns
A vector representing an instance of the random field.

Definition at line 101 of file OffLatticeRandomFieldGenerator.cpp.

References RandomNumberGenerator::Instance().

◆ SampleRandomFieldAtTime()

template<unsigned SPACE_DIM>
std::vector< double > OffLatticeRandomFieldGenerator< SPACE_DIM >::SampleRandomFieldAtTime ( const std::vector< Node< SPACE_DIM > * > &  rNodes,
double  time 
)

Sample an instance of the random field at a given time. First, draw mNumTotalGridPts random numbers from N(0,1), and then create an appropriate linear combination of the eigenvectors.

Parameters
rNodesa vector nodes at which to sample the random field
timetime at which to sample the random field
Returns
A vector representing an instance of the random field.

Definition at line 108 of file OffLatticeRandomFieldGenerator.cpp.

References NEVER_REACHED.

◆ serialize()

template<unsigned SPACE_DIM>
template<class Archive >
void OffLatticeRandomFieldGenerator< SPACE_DIM >::serialize ( Archive &  archive,
const unsigned int  version 
)
inlineprivate

◆ SetRandomSeed()

template<unsigned SPACE_DIM>
void OffLatticeRandomFieldGenerator< SPACE_DIM >::SetRandomSeed ( const unsigned  seed)

Set the random seed used for the generator.

Parameters
seedthe new seed

Definition at line 94 of file OffLatticeRandomFieldGenerator.cpp.

Friends And Related Symbol Documentation

◆ boost::serialization::access

template<unsigned SPACE_DIM>
friend class boost::serialization::access
friend

Definition at line 58 of file OffLatticeRandomFieldGenerator.hpp.

◆ TestOffLatticeRandomFieldGenerator

template<unsigned SPACE_DIM>
friend class TestOffLatticeRandomFieldGenerator
friend

Definition at line 59 of file OffLatticeRandomFieldGenerator.hpp.

Member Data Documentation

◆ mLengthScale

template<unsigned SPACE_DIM>
double OffLatticeRandomFieldGenerator< SPACE_DIM >::mLengthScale
private

Length scale over which the noise is to be correlated.

Definition at line 71 of file OffLatticeRandomFieldGenerator.hpp.

Referenced by OffLatticeRandomFieldGenerator< SPACE_DIM >::serialize().

◆ mLowerCorner

template<unsigned SPACE_DIM>
std::array<double, SPACE_DIM> OffLatticeRandomFieldGenerator< SPACE_DIM >::mLowerCorner
private

Coordinates of the lower corner of the grid.

Definition at line 62 of file OffLatticeRandomFieldGenerator.hpp.

Referenced by OffLatticeRandomFieldGenerator< SPACE_DIM >::serialize().

◆ mNumNodesAtLastUpdate

template<unsigned SPACE_DIM>
unsigned OffLatticeRandomFieldGenerator< SPACE_DIM >::mNumNodesAtLastUpdate
private

The number of nodes passed in at the most recent Update().

Definition at line 80 of file OffLatticeRandomFieldGenerator.hpp.

◆ mOpenSimplex

template<unsigned SPACE_DIM>
OpenSimplex2S OffLatticeRandomFieldGenerator< SPACE_DIM >::mOpenSimplex
private

◆ mpBoxCollection

template<unsigned SPACE_DIM>
std::unique_ptr<ObsoleteBoxCollection<SPACE_DIM> > OffLatticeRandomFieldGenerator< SPACE_DIM >::mpBoxCollection
private

An owning pointer to a box collection for efficiently keeping track of nearby nodes.

Definition at line 77 of file OffLatticeRandomFieldGenerator.hpp.

Referenced by OffLatticeRandomFieldGenerator< SPACE_DIM >::OffLatticeRandomFieldGenerator().

◆ mPeriodicity

template<unsigned SPACE_DIM>
std::array<bool, SPACE_DIM> OffLatticeRandomFieldGenerator< SPACE_DIM >::mPeriodicity
private

Whether the grid is periodic in each dimension.

Definition at line 68 of file OffLatticeRandomFieldGenerator.hpp.

Referenced by OffLatticeRandomFieldGenerator< SPACE_DIM >::serialize().

◆ mUpperCorner

template<unsigned SPACE_DIM>
std::array<double, SPACE_DIM> OffLatticeRandomFieldGenerator< SPACE_DIM >::mUpperCorner
private

Coordinates of the upper corner of the grid.

Definition at line 65 of file OffLatticeRandomFieldGenerator.hpp.

Referenced by OffLatticeRandomFieldGenerator< SPACE_DIM >::serialize().


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