C++ main module for stochmagnet Package  1.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
SM_System Class Referenceabstract

This class is a simulation of one trajectory class for Stoch Microm package. More...

#include <SM_System.h>

Inheritance diagram for SM_System:
Inheritance graph
[legend]
Collaboration diagram for SM_System:
Collaboration graph
[legend]

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_NetworkgetNetwork () const
 get the network More...
 
SM_NetworkgetNetwork ()
 get the network More...
 
const SM_TimeSteppergetTimeStepper () const
 get the time stepper More...
 
SM_TimeSteppergetTimeStepper ()
 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_RealFieldgetInitialMagneticMoment () const
 set the initial Magnetic Moment More...
 
void setNoiseRateFunction (CORE_UniquePointer< SM_NoiseRateFunction > &f)
 gst the noise rate function More...
 
SM_NoiseRateFunctiongetNoiseRateFunction ()
 get the noise rate function More...
 
const SM_NoiseRateFunctiongetNoiseRateFunction () const
 get the noise rate function More...
 
const SM_LandauLifschitzFunctiongetLandauLifschitzFunction () const
 get the Landau Lifschitz function return the Landau lifschitz function for reading More...
 
SM_LandauLifschitzFunctiongetLandauLifschitzFunction ()
 get the Landau Lifschitz function More...
 
void addOperator (CORE_UniquePointer< SM_Operator > op)
 add operator More...
 
const SM_OperatorgetOperator (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_RealFieldgetMagneticField ()
 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_NoiseRateFunctionmNoiseRateFunction
 
std::weak_ptr< CORE_ObjectmThis
 

Detailed Description

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

Constructor & Destructor Documentation

◆ SM_System()

SM_System::SM_System ( void  )
inlineprotected

create a class

References mLLFunction, mMu0, SM_LandauLifschitzFunction::setAlpha(), SM_LandauLifschitzFunction::setBeta(), and tReal.

Here is the call graph for this function:

◆ ~SM_System()

virtual SM_System::~SM_System ( void  )
inlineprotectedvirtual

destroy the class

Member Function Documentation

◆ addOperator()

void SM_System::addOperator ( CORE_UniquePointer< SM_Operator op)
inline

add operator

Parameters
[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().

Here is the caller graph for this function:

◆ computeMagneticField()

void SM_System::computeMagneticField ( const tIndex t,
const SM_Network network,
const tReal mu,
tReal B 
) const
inlineprotected

compute the magnetic field at time step index t by calling the virtual method SM_Operator::computeMagneticField()

Parameters
[in]tindex of the time step
[in]network: network of the field
[in]mumagnetic moments of size nParticles x dim
[out]Bmagnetic field of size nParticles x dim

References SM_Network::getDimension(), SM_Network::getParticlesNumber(), mOperators, tIndex, and tReal.

Here is the call graph for this function:

◆ computeMagneticFieldAndEnergies()

void SM_System::computeMagneticFieldAndEnergies ( const tIndex t,
const SM_Network network,
const tReal mu,
tReal B,
tReal Es 
) const
inlineprotected

compute the magnetic field by calling the virtual method SM_Operator::computeMagneticField()

Parameters
[in]tindex of the time step
[in]network: network of the field
[in]mumagnetic moments of size nParticles x dim
[out]Bmagnetic field of size nParticles x dim
[out]EsEnergies of size nOpertaors+1

References SM_Network::getDimension(), SM_Network::getParticlesNumber(), mOperators, tIndex, and tReal.

Referenced by makeRelaxation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ computeMuAtNextTimeStep()

virtual tBoolean SM_System::computeMuAtNextTimeStep ( const tReal dt,
const tReal epsilon_t,
const tIndex nParticles,
const tDimension dim,
const tReal mu_t,
tReal mu_tpdt 
) const
protectedpure virtual

compute mu at time step

Parameters
[in]dttime step
[in]epsilon_t: epsilon at time t
[in]nParticlesnumber of particles
[in]dimdimension of space
[in]mu_t: mu at time t
[in,out]mu_tpdtmu at time t+dt

\( \mu_{t+dt}=\mu_{t+dt}+(1-K.\varepsilon_t^2.dt).\mu_t \)

Returns
false if there is a point \( P_i \) where at the coordinate k , \( |\mu_k(P_i)| \) is too much greater than 1 (10 for instance)

Implemented in SM_TemplatedSystem< SystemImpl >, SM_TemplatedSystem< SM_ItoSystem >, SM_TemplatedSystem< SM_StratonovichSystem >, and SM_TemplatedSystem< SM_StratonovichNormalizedSystem >.

Referenced by makeRelaxation().

Here is the caller graph for this function:

◆ copyOperators()

void SM_System::copyOperators ( const SM_System system)
inline

copy the operator

Parameters
[in]system: the operators of the system are copied.

References getOperators().

Here is the call graph for this function:

◆ DisableMemoryStack()

static void CORE_Object::DisableMemoryStack ( )
inlinestaticinherited

disable the memory stack

Referenced by CORE_Object::EnableMemoryStack().

Here is the caller graph for this function:

◆ discretize()

virtual void SM_System::discretize ( )
inlinevirtual

discretize the system

Parameters
[in]nTimeStepsnumber of time steps
[in]nParticlesnumber 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EnableMemoryStack() [1/2]

static void CORE_Object::EnableMemoryStack ( )
inlinestaticinherited

enable the memory stack

Referenced by CORE_Object::EnableMemoryStack(), and CORE_Run::SetDebugOptions().

Here is the caller graph for this function:

◆ EnableMemoryStack() [2/2]

static tBoolean CORE_Object::EnableMemoryStack ( const tBoolean isMemoryChecked)
inlinestaticinherited

enable the memory stack

Parameters
[in]isMemoryChecked: true to verify memory allocation of CORE_Object classes
Returns
true if the memroy is checked

References CORE_Object::DisableMemoryStack(), CORE_Object::EnableMemoryStack(), and CORE_Object::IsMemoryStackEnabled().

Here is the call graph for this function:

◆ getClassName()

tString CORE_Object::getClassName ( ) const
inlineinherited

return the name of the class

Returns
the string name of the class

Referenced by CORE_Object::getIdentityString(), and CORE_Test::testTypes().

Here is the caller graph for this function:

◆ getConstSharedPointer()

template<class T >
std::shared_ptr<const T> CORE_Object::getConstSharedPointer ( ) const
inlineinherited

return a const shared pointer for this

Returns
the shared pointer as a type T

References CORE_Object::mThis.

◆ getContentsMemorySize()

virtual tMemSize SM_System::getContentsMemorySize ( ) const
inlinevirtual

return the memory size of the included associations

Returns
the memory size of the storage in bytes 1 Kb = 1024 bytes 1 Mb = 1024 Kb 1 Gb = 1024 Mb 1 Tb = 1024 Gb 1 Hb = 1024 Tb

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getIdentityString()

tString CORE_Object::getIdentityString ( ) const
inlineinherited

retrun the string identification of the class

Returns
the string identity 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getInitialMagneticMoment()

const SM_RealField& SM_System::getInitialMagneticMoment ( ) const
inline

set the initial Magnetic Moment

Returns
the initial magnetic moment

References mMu0.

Referenced by SM_Beam::discretize(), SM_DemagnetizedOperator::discretize(), and makeRelaxation().

Here is the caller graph for this function:

◆ getLandauLifschitzFunction() [1/2]

SM_LandauLifschitzFunction& SM_System::getLandauLifschitzFunction ( )
inline

get the Landau Lifschitz function

Returns
the Landau lifschitz function for writing

References mLLFunction.

◆ getLandauLifschitzFunction() [2/2]

const SM_LandauLifschitzFunction& SM_System::getLandauLifschitzFunction ( ) const
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().

Here is the caller graph for this function:

◆ getMagneticField()

SM_RealField& SM_System::getMagneticField ( )
inlineprotected

get the magnetic field

References mB.

◆ getMemorySize()

virtual tMemSize SM_System::getMemorySize ( ) const
inlinevirtual

return the memory size of the class and the memory size of all its attributes/associations

Returns
the memory size of the class and the memory size of its attributes/associations in bytes The mamory size is :
  • the added size of the base classes which contains:
    • the primary attributes size depends on the order: (first delare the smallest attributes size
    • all virtual functions costs <pointer-size> (4 32xor 8 64x) bytes by virtual function
    • virtual inherihtance will increase of (4 or 8) bytes
  • we add the size of the contains values of the attributes : for example the size of a string is the length of the string 1 octet = 1 byte 1 Ko = 1024 bytes 1 Mo = 1024 Ko 1 Go = 1024 Mo

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().

Here is the call graph for this function:

◆ getNetwork() [1/2]

SM_Network& SM_System::getNetwork ( )
inline

get the network

Returns
the network for writing

References mNetwork.

◆ getNetwork() [2/2]

const SM_Network& SM_System::getNetwork ( ) const
inline

◆ getNoiseRateFunction() [1/2]

SM_NoiseRateFunction& SM_System::getNoiseRateFunction ( )
inline

get the noise rate function

Returns
the noise rate function

References mNoiseRateFunction.

Referenced by SM_Beam::computeL2Convergence(), makeRelaxation(), SM_Output::saveStochasticIndicators(), and SM_Beam::templatedSimulate().

Here is the caller graph for this function:

◆ getNoiseRateFunction() [2/2]

const SM_NoiseRateFunction& SM_System::getNoiseRateFunction ( ) const
inline

get the noise rate function

Returns
the noise rate function

References mNoiseRateFunction.

◆ getOperator()

const SM_Operator* SM_System::getOperator ( const tString name) const
inline

get the operator with name

Parameters
[in]name: name of the operator

References mOperators.

Referenced by SM_Beam::computeL2Convergence(), SM_TemplatedSystem< SystemImpl >::discretize(), and SM_Test::testEnergyOperatorsDerivatives().

Here is the caller graph for this function:

◆ getOperatorNames()

virtual void SM_System::getOperatorNames ( std::vector< tString > &  names) const
inlinevirtual

get the operator names

Parameters
[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().

Here is the caller graph for this function:

◆ getOperators()

const std::map<tString,CORE_UniquePointer<SM_Operator> >& SM_System::getOperators ( ) const
inline

get the operators

Returns
the operators map : name->operator

References mOperators.

Referenced by copyOperators().

Here is the caller graph for this function:

◆ getOperatorsNumber()

tIndex SM_System::getOperatorsNumber ( ) const
inline

get the operator with name

Parameters
[in]name: name of the operator

References mOperators.

Referenced by SM_Beam::discretize(), makeRelaxation(), and SM_Output::saveStochasticIndicators().

Here is the caller graph for this function:

◆ getPointerString()

tString CORE_Object::getPointerString ( ) const
inlineinherited

retrun the pointer of the class as a string

Returns
the pointer of the calss as a string

References core_functions::pointerToString().

Here is the call graph for this function:

◆ GetRegisteredClassesNumber()

static tIndex CORE_Object::GetRegisteredClassesNumber ( )
inlinestaticinherited

get the memory stack in string

Returns
the string representation of the memory stack

◆ getSharedPointer()

template<class T >
std::shared_ptr<T> CORE_Object::getSharedPointer ( )
inlineinherited

return the shared pointer for this

Returns
the shared pointer as a type T

References CORE_Object::mThis.

◆ getTimeStepper() [1/2]

SM_TimeStepper& SM_System::getTimeStepper ( )
inline

get the time stepper

Returns
the time stepper for writing

References mTimeStepper.

◆ getTimeStepper() [2/2]

const SM_TimeStepper& SM_System::getTimeStepper ( ) const
inline

◆ isInstanceOf()

template<class T >
tBoolean CORE_Object::isInstanceOf ( ) const
inlineinherited

test if the clas T is an instance of this class

Returns
true if the object is an instance of T

Referenced by SM_Beam::templatedSimulate().

Here is the caller graph for this function:

◆ IsMemoryStackEnabled()

static tBoolean CORE_Object::IsMemoryStackEnabled ( )
inlinestaticinherited

return trur if the memory stack is enabled

Referenced by CORE_Object::EnableMemoryStack(), and main().

Here is the caller graph for this function:

◆ makeRelaxation()

tBoolean SM_System::makeRelaxation ( const SM_StochasticFunction randomFunction,
tReal mu,
tReal Es 
)

◆ MemoryStackToString()

static tString CORE_Object::MemoryStackToString ( )
inlinestaticinherited

get the memory stack in string

Returns
the string representation of the memory stack

Referenced by main().

Here is the caller graph for this function:

◆ setInitialMagneticMoment() [1/3]

void SM_System::setInitialMagneticMoment ( const SM_RealField mu0)
inline

set the initial Magnetic Moment by moving

Parameters
[in]mu0constant value of Mu at time 0 by moving

References mMu0, and CORE_StdPtrField< T, K, D >::normalize().

Here is the call graph for this function:

◆ setInitialMagneticMoment() [2/3]

void SM_System::setInitialMagneticMoment ( const std::valarray< tReal > &  mu0)
inline

set the initial Magnetic Moment by moving

Parameters
[in]mu0constant 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setInitialMagneticMoment() [3/3]

void SM_System::setInitialMagneticMoment ( const tIndex N,
const std::array< tReal, 3 > &  mu0 
)
inline

set the initial Magnetic Moment by copy

Parameters
[in]N: number of particles
[in]mu0constant value of Mu

References CORE_StdPtrField< T, K, D >::initialize(), mMu0, and CORE_Field< T, K, D, S, I >::setElementsNumber().

Here is the call graph for this function:

◆ setNoiseRateFunction()

void SM_System::setNoiseRateFunction ( CORE_UniquePointer< SM_NoiseRateFunction > &  f)
inline

gst the noise rate function

Parameters
[in]f: the noise rate function

References mNoiseRateFunction.

Referenced by SM_Test::grid3DParticlesTestCase(), SM_Test::linedParticlesTestCase(), SM_Run::loadBeamFromOptions(), and SM_Test::testOperators().

Here is the caller graph for this function:

◆ setThis()

template<class T >
std::shared_ptr<T> CORE_Object::setThis ( std::unique_ptr< T, CORE_Object::Delete > &  up)
inlineprivateinherited

set the shared pointer from an unique pointer

Parameters
[in,out]upunique pointer of the class at input, points to null pointer at output
Returns
the shared pointer of the class

Method only calledby the friend class CORE_ClassFactory::NewSharedInstance()

References CORE_Object::mThis.

◆ toString()

tString SM_System::toString ( ) const
overridevirtual

turn the class into a string representation

Returns
a string representation of the class

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.

Here is the call graph for this function:

Member Data Documentation

◆ mB

SM_RealField SM_System::mB
private

◆ mLLFunction

SM_LandauLifschitzFunction SM_System::mLLFunction
private

◆ mMu0

SM_RealField SM_System::mMu0
private

◆ mNetwork

SM_Network SM_System::mNetwork
private

◆ mNoiseRateFunction

CORE_UniquePointer<SM_NoiseRateFunction> SM_System::mNoiseRateFunction
private

◆ mOperators

std::map<tString,CORE_UniquePointer<SM_Operator> > SM_System::mOperators
private

◆ mThis

std::weak_ptr<CORE_Object> CORE_Object::mThis
privateinherited

◆ mTimeStepper

SM_TimeStepper SM_System::mTimeStepper
private

Referenced by getTimeStepper(), and toString().


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