Chaste Commit::baa90ac2819b962188b7562f2326be23c47859a7
|
#include <OffLatticeRandomFieldGenerator.hpp>
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< double > | SampleRandomField (const std::vector< Node< SPACE_DIM > * > &rNodes) |
std::vector< double > | SampleRandomFieldAtTime (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 |
An OffLatticeRandomFieldGenerator for adding spatially-correlated noise to a mesh with off-lattice nodes.
Definition at line 54 of file OffLatticeRandomFieldGenerator.hpp.
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.
lowerCorner | the lower corner of the rectangular grid |
upperCorner | the upper corner of the rectangular grid |
periodicity | whether the grid is periodic in each dimension |
lengthScale | the length scale of the correlation when calculating the covariance matrix |
boxWidth | the box size for the box collection. Defaults to DOUBLE_UNSET in which case it is reset appropriately. |
Definition at line 49 of file OffLatticeRandomFieldGenerator.cpp.
References DOUBLE_UNSET, OffLatticeRandomFieldGenerator< SPACE_DIM >::mOpenSimplex, and OffLatticeRandomFieldGenerator< SPACE_DIM >::mpBoxCollection.
|
virtualdefault |
Default constructor.
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.
rNodes | a vector of nodes at which to sample the random field |
Definition at line 101 of file OffLatticeRandomFieldGenerator.cpp.
References RandomNumberGenerator::Instance().
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.
rNodes | a vector nodes at which to sample the random field |
time | time at which to sample the random field |
Definition at line 108 of file OffLatticeRandomFieldGenerator.cpp.
References NEVER_REACHED.
|
inlineprivate |
Archive the member variables.
archive | the archive |
version | the current version of this class |
Definition at line 89 of file OffLatticeRandomFieldGenerator.hpp.
References OffLatticeRandomFieldGenerator< SPACE_DIM >::mLengthScale, OffLatticeRandomFieldGenerator< SPACE_DIM >::mLowerCorner, OffLatticeRandomFieldGenerator< SPACE_DIM >::mPeriodicity, and OffLatticeRandomFieldGenerator< SPACE_DIM >::mUpperCorner.
void OffLatticeRandomFieldGenerator< SPACE_DIM >::SetRandomSeed | ( | const unsigned | seed | ) |
Set the random seed used for the generator.
seed | the new seed |
Definition at line 94 of file OffLatticeRandomFieldGenerator.cpp.
|
friend |
Definition at line 58 of file OffLatticeRandomFieldGenerator.hpp.
|
friend |
Definition at line 59 of file OffLatticeRandomFieldGenerator.hpp.
|
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().
|
private |
Coordinates of the lower corner of the grid.
Definition at line 62 of file OffLatticeRandomFieldGenerator.hpp.
Referenced by OffLatticeRandomFieldGenerator< SPACE_DIM >::serialize().
|
private |
The number of nodes passed in at the most recent Update().
Definition at line 80 of file OffLatticeRandomFieldGenerator.hpp.
|
private |
Noise generator
Definition at line 100 of file OffLatticeRandomFieldGenerator.hpp.
Referenced by OffLatticeRandomFieldGenerator< SPACE_DIM >::OffLatticeRandomFieldGenerator().
|
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().
|
private |
Whether the grid is periodic in each dimension.
Definition at line 68 of file OffLatticeRandomFieldGenerator.hpp.
Referenced by OffLatticeRandomFieldGenerator< SPACE_DIM >::serialize().
|
private |
Coordinates of the upper corner of the grid.
Definition at line 65 of file OffLatticeRandomFieldGenerator.hpp.
Referenced by OffLatticeRandomFieldGenerator< SPACE_DIM >::serialize().