C++ main module for stochmagnet Package
1.0
|
This class is a simulation of one trajectory class for Stoch Microm package. More...
#include <SM_System.h>
Public Member Functions | |
virtual tMemSize | getMemorySize () const |
return the memory size of the class and the memory size of all its attributes/associations More... | |
virtual tMemSize | getContentsMemorySize () const |
return the memory size of the included associations More... | |
const SM_Network & | getNetwork () const |
get the network More... | |
SM_Network & | getNetwork () |
get the network More... | |
const SM_TimeStepper & | getTimeStepper () const |
get the time stepper More... | |
SM_TimeStepper & | getTimeStepper () |
get the time stepper More... | |
void | setInitialMagneticMoment (const std::valarray< tReal > &mu0) |
set the initial Magnetic Moment by moving More... | |
void | setInitialMagneticMoment (const SM_RealField &mu0) |
set the initial Magnetic Moment by moving More... | |
void | setInitialMagneticMoment (const tIndex &N, const std::array< tReal, 3 > &mu0) |
set the initial Magnetic Moment by copy More... | |
const SM_RealField & | getInitialMagneticMoment () const |
set the initial Magnetic Moment More... | |
void | setNoiseRateFunction (CORE_UniquePointer< SM_NoiseRateFunction > &f) |
gst the noise rate function More... | |
SM_NoiseRateFunction & | getNoiseRateFunction () |
get the noise rate function More... | |
const SM_NoiseRateFunction & | getNoiseRateFunction () const |
get the noise rate function More... | |
const SM_LandauLifschitzFunction & | getLandauLifschitzFunction () const |
get the Landau Lifschitz function return the Landau lifschitz function for reading More... | |
SM_LandauLifschitzFunction & | getLandauLifschitzFunction () |
get the Landau Lifschitz function More... | |
void | addOperator (CORE_UniquePointer< SM_Operator > op) |
add operator More... | |
const SM_Operator * | getOperator (const tString &name) const |
get the operator with name More... | |
void | copyOperators (const SM_System &system) |
copy the operator More... | |
const std::map< tString, CORE_UniquePointer< SM_Operator > > & | getOperators () const |
get the operators More... | |
tIndex | getOperatorsNumber () const |
get the operator with name More... | |
virtual void | getOperatorNames (std::vector< tString > &names) const |
get the operator names More... | |
virtual void | discretize () |
discretize the system More... | |
tBoolean | makeRelaxation (const SM_StochasticFunction *randomFunction, tReal *mu, tReal *Es) |
compute the relaxation process by calling only virtual methods More... | |
virtual tString | toString () const override |
turn the class into a string representation More... | |
template<class T > | |
std::shared_ptr< T > | getSharedPointer () |
return the shared pointer for this More... | |
template<class T > | |
std::shared_ptr< const T > | getConstSharedPointer () const |
return a const shared pointer for this More... | |
template<class T > | |
tBoolean | isInstanceOf () const |
test if the clas T is an instance of this class More... | |
tString | getClassName () const |
return the name of the class More... | |
tString | getPointerString () const |
retrun the pointer of the class as a string More... | |
tString | getIdentityString () const |
retrun the string identification of the class More... | |
Static Public Member Functions | |
static tBoolean | EnableMemoryStack (const tBoolean &isMemoryChecked) |
enable the memory stack More... | |
static void | EnableMemoryStack () |
enable the memory stack More... | |
static void | DisableMemoryStack () |
disable the memory stack More... | |
static tBoolean | IsMemoryStackEnabled () |
return trur if the memory stack is enabled More... | |
static tString | MemoryStackToString () |
get the memory stack in string More... | |
static tIndex | GetRegisteredClassesNumber () |
get the memory stack in string More... | |
Protected Member Functions | |
SM_System (void) | |
create a class More... | |
virtual | ~SM_System (void) |
destroy the class More... | |
SM_RealField & | getMagneticField () |
get the magnetic field More... | |
void | computeMagneticField (const tIndex &t, const SM_Network &network, const tReal *mu, tReal *B) const |
compute the magnetic field at time step index t by calling the virtual method SM_Operator::computeMagneticField() More... | |
void | computeMagneticFieldAndEnergies (const tIndex &t, const SM_Network &network, const tReal *mu, tReal *B, tReal *Es) const |
compute the magnetic field by calling the virtual method SM_Operator::computeMagneticField() More... | |
virtual tBoolean | computeMuAtNextTimeStep (const tReal &dt, const tReal &epsilon_t, const tIndex &nParticles, const tDimension &dim, const tReal *mu_t, tReal *mu_tpdt) const =0 |
compute mu at time step More... | |
Private Member Functions | |
template<class T > | |
std::shared_ptr< T > | setThis (std::unique_ptr< T, CORE_Object::Delete > &up) |
set the shared pointer from an unique pointer More... | |
Private Attributes | |
SM_LandauLifschitzFunction | mLLFunction |
SM_Network | mNetwork |
SM_TimeStepper | mTimeStepper |
std::map< tString, CORE_UniquePointer< SM_Operator > > | mOperators |
SM_RealField | mB |
SM_RealField | mMu0 |
CORE_UniquePointer< SM_NoiseRateFunction > | mNoiseRateFunction |
std::weak_ptr< CORE_Object > | mThis |
This class is a simulation of one trajectory class for Stoch Microm package.
This class solves the system
Where \( \delta \) is 0 for Ito System and 1 for Stratonovich normalized system For the Stratonovich system the Matrix A is computed with the assumption that \( |\mu_t|=1 \) so that the we have directly \( \mu_t= Y_t \).
The general stochastic relaxation process implemented in the class SM_StratonovichNormalizedSystem can be sumarized with the following algorithm
for the stratonovich system the normalization of \( \mu_{t+dt} \) is ignored and the normalized formulation of the Landau Lifschitz equation is used (see SM_LandauLifschitzFunction). It is implemented in the class SM_StratonovichSystem .
|
inlineprotected |
create a class
References mLLFunction, mMu0, SM_LandauLifschitzFunction::setAlpha(), SM_LandauLifschitzFunction::setBeta(), and tReal.
|
inlineprotectedvirtual |
destroy the class
|
inline |
add operator
[in,out] | op | : operator to add. op points to null at the output |
References mOperators.
Referenced by SM_Test::grid3DParticlesTestCase(), SM_Test::linedParticlesTestCase(), SM_Run::loadOperatorsFromOptions(), and SM_Test::testOperators().
|
inlineprotected |
compute the magnetic field at time step index t by calling the virtual method SM_Operator::computeMagneticField()
[in] | t | index of the time step |
[in] | network | : network of the field |
[in] | mu | magnetic moments of size nParticles x dim |
[out] | B | magnetic field of size nParticles x dim |
References SM_Network::getDimension(), SM_Network::getParticlesNumber(), mOperators, tIndex, and tReal.
|
inlineprotected |
compute the magnetic field by calling the virtual method SM_Operator::computeMagneticField()
[in] | t | index of the time step |
[in] | network | : network of the field |
[in] | mu | magnetic moments of size nParticles x dim |
[out] | B | magnetic field of size nParticles x dim |
[out] | Es | Energies of size nOpertaors+1 |
References SM_Network::getDimension(), SM_Network::getParticlesNumber(), mOperators, tIndex, and tReal.
Referenced by makeRelaxation().
|
protectedpure virtual |
compute mu at time step
[in] | dt | time step |
[in] | epsilon_t | : epsilon at time t |
[in] | nParticles | number of particles |
[in] | dim | dimension of space |
[in] | mu_t | : mu at time t |
[in,out] | mu_tpdt | mu at time t+dt |
\( \mu_{t+dt}=\mu_{t+dt}+(1-K.\varepsilon_t^2.dt).\mu_t \)
Implemented in SM_TemplatedSystem< SystemImpl >, SM_TemplatedSystem< SM_ItoSystem >, SM_TemplatedSystem< SM_StratonovichSystem >, and SM_TemplatedSystem< SM_StratonovichNormalizedSystem >.
Referenced by makeRelaxation().
|
inline |
copy the operator
[in] | system | : the operators of the system are copied. |
References getOperators().
|
inlinestaticinherited |
disable the memory stack
Referenced by CORE_Object::EnableMemoryStack().
|
inlinevirtual |
discretize the system
[in] | nTimeSteps | number of time steps |
[in] | nParticles | number of particles |
Reimplemented in SM_StratonovichSystem, SM_StratonovichNormalizedSystem, SM_TemplatedSystem< SystemImpl >, SM_TemplatedSystem< SM_ItoSystem >, SM_TemplatedSystem< SM_StratonovichSystem >, and SM_TemplatedSystem< SM_StratonovichNormalizedSystem >.
References getNetwork(), SM_Network::getParticlesNumber(), mB, mOperators, and CORE_Field< T, K, D, S, I >::setElementsNumber().
Referenced by SM_TemplatedSystem< SystemImpl >::discretize().
|
inlinestaticinherited |
enable the memory stack
Referenced by CORE_Object::EnableMemoryStack(), and CORE_Run::SetDebugOptions().
|
inlinestaticinherited |
enable the memory stack
[in] | isMemoryChecked | : true to verify memory allocation of CORE_Object classes |
References CORE_Object::DisableMemoryStack(), CORE_Object::EnableMemoryStack(), and CORE_Object::IsMemoryStackEnabled().
|
inlineinherited |
return the name of the class
Referenced by CORE_Object::getIdentityString(), and CORE_Test::testTypes().
|
inlineinherited |
return a const shared pointer for this
References CORE_Object::mThis.
|
inlinevirtual |
return the memory size of the included associations
Reimplemented from CORE_Object.
References CORE_Object::getContentsMemorySize(), SM_Network::getContentsMemorySize(), CORE_Field< T, K, D, S, I >::getContentsMemorySize(), mB, mLLFunction, mMu0, mNetwork, mNoiseRateFunction, mOperators, and tMemSize.
Referenced by SM_ItoSystem::getMemorySize(), SM_StratonovichNormalizedSystem::getMemorySize(), SM_StratonovichSystem::getMemorySize(), getMemorySize(), and SM_TemplatedSystem< SystemImpl >::getMemorySize().
|
inlineinherited |
retrun the string identification of the class
References CORE_Object::getClassName(), and core_functions::pointerToString().
Referenced by CORE_Test::testArray(), CORE_Test::testField(), CORE_Test::testTypes(), CORE_Object::toString(), CORE_ClassFactory::toString(), and CORE_Field< T, K, D, S, I >::toString().
|
inline |
set the initial Magnetic Moment
References mMu0.
Referenced by SM_Beam::discretize(), SM_DemagnetizedOperator::discretize(), and makeRelaxation().
|
inline |
get the Landau Lifschitz function
References mLLFunction.
|
inline |
get the Landau Lifschitz function return the Landau lifschitz function for reading
References mLLFunction.
Referenced by SM_Beam::discretize(), SM_StratonovichNormalizedSystem::discretize(), SM_StratonovichSystem::discretize(), SM_Test::grid3DParticlesTestCase(), SM_Test::linedParticlesTestCase(), SM_Run::loadBeamFromOptions(), makeRelaxation(), and SM_Test::testOperators().
|
inlineprotected |
get the magnetic field
References mB.
|
inlinevirtual |
return the memory size of the class and the memory size of all its attributes/associations
Reimplemented from SM_Object.
Reimplemented in SM_TemplatedSystem< SystemImpl >, SM_TemplatedSystem< SM_ItoSystem >, SM_TemplatedSystem< SM_StratonovichSystem >, SM_TemplatedSystem< SM_StratonovichNormalizedSystem >, SM_StratonovichSystem, SM_StratonovichNormalizedSystem, and SM_ItoSystem.
References getContentsMemorySize().
|
inline |
|
inline |
get the network
References mNetwork.
Referenced by SM_Beam::computeL2Convergence(), SM_Beam::discretize(), discretize(), SM_PermanentZeemanOperator::discretize(), SM_ZeemanOperator::discretize(), SM_Output::generateOutput(), SM_Test::grid3DParticlesTestCase(), SM_Test::linedParticlesTestCase(), SM_Run::loadMagneticMomentFromOptions(), makeRelaxation(), SM_VTK::save(), SM_Test::testEnergyOperatorsDerivatives(), and SM_Test::validate().
|
inline |
get the noise rate function
References mNoiseRateFunction.
Referenced by SM_Beam::computeL2Convergence(), makeRelaxation(), SM_Output::saveStochasticIndicators(), and SM_Beam::templatedSimulate().
|
inline |
|
inline |
get the operator with name
[in] | name | : name of the operator |
References mOperators.
Referenced by SM_Beam::computeL2Convergence(), SM_TemplatedSystem< SystemImpl >::discretize(), and SM_Test::testEnergyOperatorsDerivatives().
|
inlinevirtual |
get the operator names
[out] | names | : names of the operator |
Reimplemented in SM_TemplatedSystem< SystemImpl >, SM_TemplatedSystem< SM_ItoSystem >, SM_TemplatedSystem< SM_StratonovichSystem >, and SM_TemplatedSystem< SM_StratonovichNormalizedSystem >.
References mOperators.
Referenced by SM_Output::generateOutput().
|
inline |
get the operators
References mOperators.
Referenced by copyOperators().
|
inline |
get the operator with name
[in] | name | : name of the operator |
References mOperators.
Referenced by SM_Beam::discretize(), makeRelaxation(), and SM_Output::saveStochasticIndicators().
|
inlineinherited |
retrun the pointer of the class as a string
References core_functions::pointerToString().
|
inlinestaticinherited |
get the memory stack in string
|
inlineinherited |
return the shared pointer for this
References CORE_Object::mThis.
|
inline |
|
inline |
get the time stepper
References mTimeStepper.
Referenced by SM_Beam::computeL2Convergence(), SM_Beam::discretize(), SM_ZeemanOperator::discretize(), SM_Output::generateOutput(), SM_Test::grid3DParticlesTestCase(), SM_Test::linedParticlesTestCase(), SM_Run::loadBeamFromOptions(), makeRelaxation(), SM_VTK::save(), SM_Output::saveStochasticIndicators(), SM_Test::testOperators(), and SM_Test::validate().
|
inlineinherited |
test if the clas T is an instance of this class
Referenced by SM_Beam::templatedSimulate().
|
inlinestaticinherited |
return trur if the memory stack is enabled
Referenced by CORE_Object::EnableMemoryStack(), and main().
tBoolean SM_System::makeRelaxation | ( | const SM_StochasticFunction * | randomFunction, |
tReal * | mu, | ||
tReal * | Es | ||
) |
compute the relaxation process by calling only virtual methods
[in] | randomFunction | random function for the stochastic simulation |
[out] | mu | mu at all time of size nParticules x dim x nTimeSteps |
[out] | Es | energies of the system for each operatr & total operator |
References ASSERT_IN, SM_LandauLifschitzFunction::computeFunction(), SM_NoiseRateFunction::computeFunction(), computeMagneticFieldAndEnergies(), computeMuAtNextTimeStep(), CORE_Field< T, K, D, S, I >::getDimension(), SM_Network::getDimension(), CORE_Field< T, K, D, S, I >::getElementsNumber(), getInitialMagneticMoment(), getLandauLifschitzFunction(), SM_TimeStepper::getMaximumTimeStepsNumber(), getNetwork(), getNoiseRateFunction(), getOperatorsNumber(), SM_Network::getParticlesNumber(), SM_TimeStepper::getTimeStep(), getTimeStepper(), mB, mMu0, SM_StochasticFunction::random(), tBoolean, tIndex, and tReal.
|
inlinestaticinherited |
get the memory stack in string
Referenced by main().
|
inline |
set the initial Magnetic Moment by moving
[in] | mu0 | constant value of Mu at time 0 by moving |
References mMu0, and CORE_StdPtrField< T, K, D >::normalize().
|
inline |
set the initial Magnetic Moment by moving
[in] | mu0 | constant value of Mu at time 0 by moving |
References mMu0, and CORE_StdPtrField< T, K, D >::normalize().
Referenced by SM_Test::grid3DParticlesTestCase(), SM_Test::linedParticlesTestCase(), SM_Run::loadMagneticMomentFromOptions(), and SM_Test::testEnergyOperatorsDerivatives().
|
inline |
set the initial Magnetic Moment by copy
[in] | N | : number of particles |
[in] | mu0 | constant value of Mu |
References CORE_StdPtrField< T, K, D >::initialize(), mMu0, and CORE_Field< T, K, D, S, I >::setElementsNumber().
|
inline |
gst the noise rate function
[in] | f | : the noise rate function |
References mNoiseRateFunction.
Referenced by SM_Test::grid3DParticlesTestCase(), SM_Test::linedParticlesTestCase(), SM_Run::loadBeamFromOptions(), and SM_Test::testOperators().
|
inlineprivateinherited |
set the shared pointer from an unique pointer
[in,out] | up | unique pointer of the class at input, points to null pointer at output |
Method only calledby the friend class CORE_ClassFactory::NewSharedInstance()
References CORE_Object::mThis.
|
overridevirtual |
turn the class into a string representation
Reimplemented from CORE_Object.
References SM_Network::getDimension(), CORE_Field< T, K, D, S, I >::getElementsNumber(), mLLFunction, mMu0, mNetwork, mNoiseRateFunction, mTimeStepper, tIndex, tNaturalInteger, CORE_Object::toString(), SM_LandauLifschitzFunction::toString(), SM_Network::toString(), SM_TimeStepper::toString(), tReal, and tUInt.
|
private |
Referenced by discretize(), getContentsMemorySize(), getMagneticField(), and makeRelaxation().
|
private |
Referenced by getContentsMemorySize(), getLandauLifschitzFunction(), SM_System(), and toString().
|
private |
Referenced by getContentsMemorySize(), getInitialMagneticMoment(), makeRelaxation(), setInitialMagneticMoment(), SM_System(), and toString().
|
private |
Referenced by getContentsMemorySize(), getNetwork(), and toString().
|
private |
Referenced by getContentsMemorySize(), getNoiseRateFunction(), setNoiseRateFunction(), and toString().
|
private |
|
privateinherited |
Referenced by CORE_Object::getConstSharedPointer(), CORE_Object::getSharedPointer(), and CORE_Object::setThis().
|
private |
Referenced by getTimeStepper(), and toString().