C++ mpi module for stochmagnet_main Package
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
SM_System Class Referenceabstract

This class is a one simulation of a beam for Stoch Magnet 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...
 
void setNetwork (CORE_UniquePointer< SM_Network > net)
 set the network More...
 
const SM_NetworkgetNetwork () const
 get the network More...
 
SM_NetworkgetNetwork ()
 get the network More...
 
tBoolean hasNetwork () const
 return true if the system has a network More...
 
const SM_MaterialgetMaterial () const
 get the material of the network More...
 
SM_MaterialgetMaterial ()
 get the material of the network More...
 
void setInitialMagneticMomentDirections (const std::valarray< tReal > &S0)
 set the initial unit direction of spins More...
 
void setInitialMagneticMomentDirections (const SM_RealField &S0)
 set the initial unit direction of spins More...
 
void setInitialMagneticMomentDirections (const tIndex &N, const std::array< tReal, SM_Constants::DIM > &S0)
 set the initial unit direction of spins More...
 
virtual tBoolean updateInitialMagneticMomentDirections (const SM_RealField &S0)
 update the initial unit direction of spins More...
 
const SM_RealFieldgetInitialMagneticMomentDirections () const
 get the initial unit direction of spins More...
 
SM_RealFieldgetInitialMagneticMomentDirections ()
 get the initial unit direction of spins for writting More...
 
const SM_RealFieldgetMagneticMomentDirections () const
 get the unit direction of spins at time More...
 
SM_RealFieldgetMagneticMomentDirections ()
 get the unit direction of spins at time for writting More...
 
virtual tBoolean initializeMagneticMomentDirections ()
 initialize magnetic moments direction More...
 
void addOperator (CORE_UniquePointer< SM_Operator > op)
 add operator More...
 
const SM_SliceOperatorgetOperator (const tString &name) const
 get the operator with name More...
 
SM_SliceOperatorgetOperator (const tString &name)
 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...
 
std::map< tString, CORE_UniquePointer< SM_Operator > > & getOperators ()
 get the operators More...
 
tIndex getOperatorsNumber () const
 get the operators number More...
 
void getOperatorsName (std::vector< tString > &names) const
 get the operator names More...
 
virtual void setStochasticNoise (const tReal &eps)
 set the stochastic noise without dimension More...
 
const tReal & getStochasticNoise () const
 get the stochastic noise without dimension More...
 
virtual void setNoiseTemperature (const tReal &T)
 set the noise as a temperature in Kelvin More...
 
const tReal & getNoiseTemperature () const
 get the noise temperature in Kelvin More...
 
virtual tULLInt getGeneratedRandomNumbers () const =0
 get the generated of random number More...
 
const tIndex & getStepIndex () const
 get the step index More...
 
tIndex & getStepIndex ()
 get the step index More...
 
virtual void normalize (const tBoolean &isAdimensionized)
 normalize the system More...
 
virtual void sumOverNetworks (const int &rootNetwork, tIndex &n, const tIndex &nValues, tReal *values) const
 sum the values of all network More...
 
void computeMagneticMomentDirectionsSumOverNetworks (const int &rootNetwork, std::array< tReal, SM_Constants::DIM > &sumS) const
 compute the sum over the domain of magnetic moment dierctions More...
 
void computeMagneticMomentDirectionsMeanOverNetworks (const int &rootNetwork, std::array< tReal, SM_Constants::DIM > &meanS) const
 compute the mean over the domain of magneticmoment directions More...
 
void computeMagneticMomentDirectionsSum (const tInteger &start, const tInteger &end, std::array< tReal, SM_Constants::DIM > &sumS) const
 compute the sum of magnetic moment directions over the network More...
 
virtual void discretize ()
 discretize the system More...
 
void updateOperatorsState (const tIndex &timeIndex, const SM_Network &network, const SM_Material &material, const SM_RealField &S)
 update the operators state before computeing magnetic field More...
 
void computeMagneticField (const tIndex &timeIndex, const SM_Network &network, const SM_Material &material, const SM_RealField &S, SM_RealField &H) const
 compute the magnetic field at time step index t by calling the virtual method SM_Operator::computeMagneticField() More...
 
tReal computeSpinEnergy (const tIndex &i, const SM_Network &network, const SM_Material &material, const SM_RealField &S) const
 compute the energy of the spin of the system More...
 
tReal computeSpinEnergy (const tIndex &i, const tIndex &timeIndex, const SM_Network &network, const SM_Material &material, const SM_RealField &S) const
 compute the energy of the spin of the system More...
 
const tReal & computeEnergies (std::valarray< tReal > &energies) const
 compute the energies per operators More...
 
const tReal & computeEnergies (const tIndex &timeIndex, std::valarray< tReal > &energies) const
 compute the energies per operators More...
 
virtual tString toString () const override
 turn the class into a string representation More...
 
- Public Member Functions inherited from SM_Object
 SM_Object (void)
 create
 
virtual ~SM_Object (void)
 destroy
 
- Public Member Functions inherited from CORE_Object
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 void ComputeFieldSum (const tInteger &start, const tInteger &end, const SM_RealField &F, std::array< tReal, SM_Constants::DIM > &sumF)
 compute the sum of F over the network More...
 
- Static Public Member Functions inherited from CORE_Object
static tBoolean EnableMemoryStack (const tBoolean &isMemoryChecked)
 enable the memory stack More...
 
static void EnableMemoryStack ()
 enable the memory stack
 
static void DisableMemoryStack ()
 disable the memory stack
 
static tBoolean IsMemoryStackEnabled ()
 return trur if the memory stack is enabled
 
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
 
virtual ~SM_System (void)
 destroy the class
 
tReal computeEnergy (const SM_Network &network, const SM_Material &material, const SM_RealField &S) const
 compute the energy of the system More...
 
tReal computeEnergy (const tIndex &timeIndex, const SM_Network &network, const SM_Material &material, const SM_RealField &S) const
 compute the energy of the system More...
 
- Protected Member Functions inherited from CORE_Object
 CORE_Object ()
 build an instance of the object
 
virtual ~CORE_Object ()
 destroy the instance of object std

 

Detailed Description

This class is a one simulation of a beam for Stoch Magnet package.

The system class SM_System describes a simulation of ne trajectory of a beam. A system class contains the attributes data:

A system class contains the attributes state:

A system class is linked to:

This class implements:

There is two kinds of implemtation of system

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

◆ computeEnergies() [1/2]

const tReal& SM_System::computeEnergies ( const tIndex &  timeIndex,
std::valarray< tReal > &  energies 
) const
inline

compute the energies per operators

Parameters
[in]timeIndexindex of time (O per default)
[out]energiesenergies per operator of size number Of operatorq + 1
Returns
the total energy of the system

◆ computeEnergies() [2/2]

const tReal& SM_System::computeEnergies ( std::valarray< tReal > &  energies) const
inline

compute the energies per operators

Parameters
[out]energiesenergies per operator of size number Of operatorq + 1
Returns
the total energy of the system

◆ computeEnergy() [1/2]

tReal SM_System::computeEnergy ( const SM_Network network,
const SM_Material material,
const SM_RealField S 
) const
inlineprotected

compute the energy of the system

Parameters
[in]network: network of the system
[in]material: material of the system
[in]Sdirection of the magnetic moments of size nParticles x SM_Constants::DIM
Returns
the energy

◆ computeEnergy() [2/2]

tReal SM_System::computeEnergy ( const tIndex &  timeIndex,
const SM_Network network,
const SM_Material material,
const SM_RealField S 
) const
inlineprotected

compute the energy of the system

Parameters
[in]timeIndexindex of time
[in]network: network of the system
[in]material: material of the system
[in]Sdirection of the magnetic moments of size nParticles x SM_Constants::DIM
Returns
the energy

◆ ComputeFieldSum()

static void SM_System::ComputeFieldSum ( const tInteger &  start,
const tInteger &  end,
const SM_RealField F,
std::array< tReal, SM_Constants::DIM > &  sumF 
)
inlinestatic

compute the sum of F over the network

Parameters
[in]startstart element to compute the sum
[in]end: end element to compute the sum
[in]Ffield to compute teh sumper coordinate for element in [start,end[
[out]sumF: \( \forall k in [0,d[, F_k=\sum_i F_k[i] \)

◆ computeMagneticField()

void SM_System::computeMagneticField ( const tIndex &  timeIndex,
const SM_Network network,
const SM_Material material,
const SM_RealField S,
SM_RealField H 
) const
inline

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

Parameters
[in]timeIndexindex of the time step
[in]network: network of the system
[in]material: material of the system
[in]Sdirection of the magnetic moments of size nParticles x SM_Constants::DIM
[out]Hmagnetic field of size nParticles x SM_Constants::DIM

◆ computeMagneticMomentDirectionsMeanOverNetworks()

void SM_System::computeMagneticMomentDirectionsMeanOverNetworks ( const int &  rootNetwork,
std::array< tReal, SM_Constants::DIM > &  meanS 
) const
inline

compute the mean over the domain of magneticmoment directions

Parameters
[in]rootNetwork;index of the root network to store the results
[out]meanS: mean of S over the particles of the networks

◆ computeMagneticMomentDirectionsSum()

void SM_System::computeMagneticMomentDirectionsSum ( const tInteger &  start,
const tInteger &  end,
std::array< tReal, SM_Constants::DIM > &  sumS 
) const
inline

compute the sum of magnetic moment directions over the network

Parameters
[in]startstart element to compute the sum
[in]end: end element to compute the sum
[out]sumS: \( \forall k in [0,d[, \forall p in [start,end[ S_k+= S_k[p] \)

◆ computeMagneticMomentDirectionsSumOverNetworks()

void SM_System::computeMagneticMomentDirectionsSumOverNetworks ( const int &  rootNetwork,
std::array< tReal, SM_Constants::DIM > &  sumS 
) const
inline

compute the sum over the domain of magnetic moment dierctions

Parameters
[in]rootNetwork;index of the root network to store the results
[out]sumS: sum of S on all the particles of the networks: \( \forall k in [0,d[, \forall p in \mathcal{R}, F_k+=F_k[p] \)

◆ computeSpinEnergy() [1/2]

tReal SM_System::computeSpinEnergy ( const tIndex &  i,
const SM_Network network,
const SM_Material material,
const SM_RealField S 
) const
inline

compute the energy of the spin of the system

Parameters
[in]iindex of the spin
[in]network: network of the system
[in]material: material of the system
[in]Sdirection of the magnetic moments of size nParticles x SM_Constants::DIM
Returns
the energy

◆ computeSpinEnergy() [2/2]

tReal SM_System::computeSpinEnergy ( const tIndex &  i,
const tIndex &  timeIndex,
const SM_Network network,
const SM_Material material,
const SM_RealField S 
) const
inline

compute the energy of the spin of the system

Parameters
[in]iindex of the spin
[in]timeIndexindex of time
[in]network: network of the system
[in]material: material of the system
[in]Sdirection of the magnetic moments of size nParticles x SM_Constants::DIM
Returns
the energy

◆ copyOperators()

void SM_System::copyOperators ( const SM_System system)
inline

copy the operator

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

◆ discretize()

virtual void SM_System::discretize ( )
inlinevirtual

◆ 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.

Reimplemented in SMOMPI_MonteCarloSystem, SM_MonteCarloSystem, SMOMPI_LandauLifschitzSystem, SMOMPI_HeunSystem, and SM_LandauLifschitzSystem.

◆ getGeneratedRandomNumbers()

virtual tULLInt SM_System::getGeneratedRandomNumbers ( ) const
pure virtual

get the generated of random number

Returns
the number of genared random number for one running

Implemented in SM_MonteCarloSystem, and SM_LandauLifschitzSystem.

◆ getInitialMagneticMomentDirections() [1/2]

SM_RealField& SM_System::getInitialMagneticMomentDirections ( )
inline

get the initial unit direction of spins for writting

Returns
the initial unit direction of spins

◆ getInitialMagneticMomentDirections() [2/2]

const SM_RealField& SM_System::getInitialMagneticMomentDirections ( ) const
inline

get the initial unit direction of spins

Returns
the initial unit direction of spins

◆ getMagneticMomentDirections() [1/2]

SM_RealField& SM_System::getMagneticMomentDirections ( )
inline

get the unit direction of spins at time for writting

Returns
the unit direction of spins at time

◆ getMagneticMomentDirections() [2/2]

const SM_RealField& SM_System::getMagneticMomentDirections ( ) const
inline

get the unit direction of spins at time

Returns
the unit direction of spins at time

◆ getMaterial() [1/2]

SM_Material& SM_System::getMaterial ( )
inline

get the material of the network

Returns
the material of the network

◆ getMaterial() [2/2]

const SM_Material& SM_System::getMaterial ( ) const
inline

get the material of the network

Returns
the material of the network

◆ 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 SMOMPI_MonteCarloSystem, SM_MonteCarloSystem, SMOMPI_StratonovichSystem, SMOMPI_StratonovichNormalizedSystem, SMOMPI_LandauLifschitzSystem, SMOMPI_ItoSystem, SMOMPI_HeunSystem, and SM_LandauLifschitzSystem.

◆ getNetwork() [1/2]

SM_Network& SM_System::getNetwork ( )
inline

get the network

Returns
the network for writing

◆ getNetwork() [2/2]

const SM_Network& SM_System::getNetwork ( ) const
inline

get the network

Returns
the network for reading

◆ getNoiseTemperature()

const tReal& SM_System::getNoiseTemperature ( ) const
inline

get the noise temperature in Kelvin

Returns
temperature

◆ getOperator() [1/2]

SM_SliceOperator* SM_System::getOperator ( const tString &  name)
inline

get the operator with name

Parameters
[in]name: name of the operator

◆ getOperator() [2/2]

const SM_SliceOperator* SM_System::getOperator ( const tString &  name) const
inline

get the operator with name

Parameters
[in]name: name of the operator

◆ getOperators() [1/2]

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

get the operators

Returns
the operators map : name->operator

◆ getOperators() [2/2]

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

get the operators

Returns
the operators map : name->operator

◆ getOperatorsName()

void SM_System::getOperatorsName ( std::vector< tString > &  names) const
inline

get the operator names

Parameters
[out]names: names of the operator

◆ getOperatorsNumber()

tIndex SM_System::getOperatorsNumber ( ) const
inline

get the operators number

Returns
the numbe rof operators

◆ getStepIndex() [1/2]

tIndex& SM_System::getStepIndex ( )
inline

get the step index

Returns
the current step index

◆ getStepIndex() [2/2]

const tIndex& SM_System::getStepIndex ( ) const
inline

get the step index

Returns
the current step index

◆ getStochasticNoise()

const tReal& SM_System::getStochasticNoise ( ) const
inline

get the stochastic noise without dimension

Returns
stochastic noise

◆ hasNetwork()

tBoolean SM_System::hasNetwork ( ) const
inline

return true if the system has a network

Returns
true if the system has a network

◆ initializeMagneticMomentDirections()

virtual tBoolean SM_System::initializeMagneticMomentDirections ( )
inlinevirtual

initialize magnetic moments direction

  • step index reste to 0
  • S(t=0)=S_{init}
    Returns
    true if St & S0 has same size

Reimplemented in SM_LandauLifschitzSystem, SMOMPI_MonteCarloSystem, and SMOMPI_LandauLifschitzSystem.

◆ normalize()

virtual void SM_System::normalize ( const tBoolean &  isAdimensionized)
inlinevirtual

normalize the system

Parameters
[in]isAdimensionizedtrue to adimensionize the system

Reimplemented in SM_MonteCarloSystem, and SM_LandauLifschitzSystem.

◆ setInitialMagneticMomentDirections() [1/3]

void SM_System::setInitialMagneticMomentDirections ( const SM_RealField S0)
inline

set the initial unit direction of spins

Parameters
[in]S0initial dierction of spins as an unit vector

◆ setInitialMagneticMomentDirections() [2/3]

void SM_System::setInitialMagneticMomentDirections ( const std::valarray< tReal > &  S0)
inline

set the initial unit direction of spins

Parameters
[in]S0initial dierction of spins as an unit vector

◆ setInitialMagneticMomentDirections() [3/3]

void SM_System::setInitialMagneticMomentDirections ( const tIndex &  N,
const std::array< tReal, SM_Constants::DIM > &  S0 
)
inline

set the initial unit direction of spins

Parameters
[in]N: number of particles
[in]S0constant value of S

◆ setNetwork()

void SM_System::setNetwork ( CORE_UniquePointer< SM_Network net)
inline

set the network

Parameters
[in]net: net of the system

◆ setNoiseTemperature()

virtual void SM_System::setNoiseTemperature ( const tReal &  T)
inlinevirtual

set the noise as a temperature in Kelvin

Parameters
[in]T: temperature

Reimplemented in SM_MonteCarloSystem, and SM_LandauLifschitzSystem.

◆ setStochasticNoise()

virtual void SM_System::setStochasticNoise ( const tReal &  eps)
inlinevirtual

set the stochastic noise without dimension

Parameters
[in]epsstochastic noise

◆ sumOverNetworks()

virtual void SM_System::sumOverNetworks ( const int &  rootNetwork,
tIndex &  n,
const tIndex &  nValues,
tReal *  values 
) const
inlinevirtual

sum the values of all network

Parameters
[in]rootNetwork;index of the root network to store the results
[in,out]nnumber of elements used for computing each element of values at input : per network , at output : for all networks
[in]nValuesnumber of elements of values
[in,out]valuesvalues computed at input : per network, at output: for all networks Do nothing by defaut because there is only one network

Reimplemented in SMOMPI_LandauLifschitzSystem.

◆ toString()

virtual tString SM_System::toString ( ) const
inlineoverridevirtual

turn the class into a string representation

Returns
a string representation of the class

Reimplemented from CORE_Object.

Reimplemented in SM_MonteCarloSystem, and SM_LandauLifschitzSystem.

◆ updateInitialMagneticMomentDirections()

virtual tBoolean SM_System::updateInitialMagneticMomentDirections ( const SM_RealField S0)
inlinevirtual

update the initial unit direction of spins

Parameters
[in]S0initial dierction of spins as an unit vector
Returns
true is initial magnetic moment direction is set to S0 only if they have the same size

Reimplemented in SMOMPI_LandauLifschitzSystem, and SM_LandauLifschitzSystem.

◆ updateOperatorsState()

void SM_System::updateOperatorsState ( const tIndex &  timeIndex,
const SM_Network network,
const SM_Material material,
const SM_RealField S 
)
inline

update the operators state before computeing magnetic field

Parameters
[in]timeIndexindex of the time step
[in]network: network of the system
[in]material: material of the system
[in]Sdirection of the magnetic moments of size nParticles x SM_Constants::DIM

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