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

#include <SM_Run.h>

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

Public Member Functions

 SM_Run (void)
 create More...
 
virtual ~SM_Run (void)
 destroy More...
 
virtual tMemSize getMemorySize () const
 return the memory size of the class and the memory size of all its attributes/associations More...
 
virtual void initManOptions (std::map< tString, std::map< tString, tString > > &options) const override
 init the man of the options More...
 
virtual void initOptions (std::map< tString, tString > &options) const override
 default initialization of the options More...
 
virtual void createClassFactories (const std::map< tString, tString > &options) const override
 create the class factories from options More...
 
virtual tBoolean makeTests (const std::map< tString, tString > &options) const override
 mak ethe tests of the prograp More...
 
virtual tBoolean makeRun (const tString &command, const std::map< tString, tString > &options) const override
 make Run command More...
 
virtual tMemSize getContentsMemorySize () const override
 return the memory size in byte More...
 
tBoolean executeRun (int argc, char *argv[]) const
 run the program from main class More...
 
tBoolean printHelp (const std::map< tString, tString > &options) const
 print the help 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...
 
virtual tString toString () const
 return the string representation of the object node More...
 

Static Public Member Functions

static void SetSoftName (const tString &soft)
 set soft name More...
 
static const tStringGetSoftName ()
 get soft name More...
 
static void SetVersion (const tString &version)
 set the version More...
 
static const tStringGetVersion ()
 get the version More...
 
static const tBooleanIsProfiling ()
 retun true if the code is in profing mode More...
 
static tBoolean Is64Architecture ()
 return true if the machine is a 64 bits machine More...
 
static tBoolean Is32Architecture ()
 return true if the machine is a 32 bits machine More...
 
static void InitSeed (const unsigned int &seed)
 init the seed for uniform random generator More...
 
static void InitSeed ()
 init the seed for uniform random generator More...
 
static CORE_OutOut ()
 return the output stream More...
 
static void SetOutputOptions (const std::map< tString, tString > &option)
 create the output stream from the options More...
 
static void SetDebugOptions (const std::map< tString, tString > &option)
 create the debug data from options More...
 
static CORE_ClassFactoryGetClassFactory ()
 return the class factory More...
 
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...
 

Private Member Functions

tBoolean run (const std::map< tString, tString > &options) const
 run the progra with the options More...
 
CORE_UniquePointer< SM_BeamloadBeamFromOptions (const std::map< tString, tString > &options) const
 load the beam More...
 
tBoolean loadNetworkFromOptions (SM_Network &network, const std::map< tString, tString > &options) const
 load the network More...
 
tBoolean loadMagneticMomentFromOptions (SM_System &system, const std::map< tString, tString > &options) const
 load the magnetic moment More...
 
tBoolean loadOperatorsFromOptions (SM_System &system, const std::map< tString, tString > &options) const
 load the operators More...
 
tBoolean generateOutput (SM_Beam &beam, const std::map< tString, tString > &options) const
 save the file for animations More...
 
tBoolean createMagneticDipolarMap (const tString &fileName) const
 create a dipolar magnetic map More...
 
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

std::weak_ptr< CORE_ObjectmThis
 

Static Private Attributes

static tString mSoftName ="core.exe"
 
static tString mVersion ="VERSION"
 
static CORE_UniquePointer< CORE_OutmOut =CORE_Out::New()
 
static CORE_UniquePointer< CORE_ClassFactorymClassFactory =CORE_ClassFactory::New()
 
static tBoolean mIsProfiling =false
 

Constructor & Destructor Documentation

◆ SM_Run()

SM_Run::SM_Run ( void  )

create

References CORE_Run::SetSoftName(), and CORE_Run::SetVersion().

Here is the call graph for this function:

◆ ~SM_Run()

SM_Run::~SM_Run ( void  )
virtual

destroy

Member Function Documentation

◆ createClassFactories()

void SM_Run::createClassFactories ( const std::map< tString, tString > &  options) const
overridevirtual

create the class factories from options

Parameters
[in]optionsthe options

Reimplemented from CORE_Run.

References CORE_ClassFactory::addClassFactory(), CORE_Run::GetClassFactory(), and SM_ClassFactory::New().

Here is the call graph for this function:

◆ createMagneticDipolarMap()

tBoolean SM_Run::createMagneticDipolarMap ( const tString fileName) const
private

create a dipolar magnetic map

Parameters
[in]fileNamename of the VTK file to save
Returns
true if the creation of the mapp file has succeeded

References CORE_Field< T, K, D, S, I >::getValues(), SM_DemagnetizedOperator::New(), SM_Network::New(), CORE_Field< T, K, D, S, I >::setElementsNumber(), tBoolean, tIndex, tReal, tString, and tUCInt.

Referenced by makeRun().

Here is the call graph for this function:
Here is the caller 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:

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

◆ executeRun()

tBoolean CORE_Run::executeRun ( int  argc,
char *  argv[] 
) const
inherited

run the program from main class

Parameters
[in]argcnumber of arguments
[in]argvthe char* value of the arguments
Returns
true if the running has succeeded

References CORE_Run::createClassFactories(), CORE_Run::initOptions(), CORE_Run::makeRun(), CORE_Run::makeTests(), CORE_Run::printHelp(), CORE_OptionsReader::ReadOption(), CORE_OptionsReader::ReadOptions(), CORE_Run::SetDebugOptions(), CORE_Run::SetOutputOptions(), tInt, core_functions::trim(), and tString.

Referenced by run().

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

◆ generateOutput()

tBoolean SM_Run::generateOutput ( SM_Beam beam,
const std::map< tString, tString > &  options 
) const
private

save the file for animations

Parameters
[in]beamthe beam to print the results
[in]optionsoptions of the program
Returns
true if the output has been generated

References SM_Output::generateOutput(), CORE_OptionsReader::ReadPath(), CORE_OptionsReader::ReadVector(), SM_Output::setOutputPath(), SM_Output::setPrefix(), SM_Output::setSimulations(), and tString.

Referenced by run().

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

◆ GetClassFactory()

static CORE_ClassFactory& CORE_Run::GetClassFactory ( )
inlinestaticinherited

return the class factory

Returns
the output stream

References CORE_Run::mClassFactory.

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

Here is the caller 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 CORE_Run::getContentsMemorySize ( ) const
inlineoverridevirtualinherited

return the memory size in byte

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_Run::mClassFactory, and CORE_Run::mOut.

Referenced by getMemorySize(), and CORE_Run::getMemorySize().

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:

◆ getMemorySize()

virtual tMemSize SM_Run::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 CORE_Run.

References CORE_Run::getContentsMemorySize().

Here is the call 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.

◆ GetSoftName()

static const tString& CORE_Run::GetSoftName ( )
inlinestaticinherited

get soft name

Returns
the soft name

References CORE_Run::mSoftName.

Referenced by CORE_Run::printHelp(), and run().

Here is the caller graph for this function:

◆ GetVersion()

static const tString& CORE_Run::GetVersion ( )
inlinestaticinherited

get the version

Returns
the version in string form

References CORE_Run::mVersion.

Referenced by CORE_Run::printHelp(), and run().

Here is the caller graph for this function:

◆ initManOptions()

void SM_Run::initManOptions ( std::map< tString, std::map< tString, tString > > &  options) const
overridevirtual

init the man of the options

Parameters
[in]optionsman of the options

Reimplemented from CORE_Run.

References CORE_Run::initManOptions(), and tString.

Referenced by makeRun(), and run().

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

◆ initOptions()

void SM_Run::initOptions ( std::map< tString, tString > &  options) const
overridevirtual

default initialization of the options

Parameters
[in]optionsdefault values of the options

Reimplemented from CORE_Run.

References CORE_Run::initOptions().

Here is the call graph for this function:

◆ InitSeed() [1/2]

static void CORE_Run::InitSeed ( )
inlinestaticinherited

init the seed for uniform random generator

◆ InitSeed() [2/2]

static void CORE_Run::InitSeed ( const unsigned int &  seed)
inlinestaticinherited

init the seed for uniform random generator

Parameters
[in]seed: seed for uniform random generator

Referenced by CORE_Test::primaryTests().

Here is the caller graph for this function:

◆ Is32Architecture()

static tBoolean CORE_Run::Is32Architecture ( )
inlinestaticinherited

return true if the machine is a 32 bits machine

Returns
true is the computing is done in a 32 bits machine

References tLDouble.

Referenced by CORE_Test::testTypes().

Here is the caller graph for this function:

◆ Is64Architecture()

static tBoolean CORE_Run::Is64Architecture ( )
inlinestaticinherited

return true if the machine is a 64 bits machine

Returns
true is the computing is done in a 64 bits machine

References tLDouble.

Referenced by SM_VTK::getVTKType(), and CORE_Test::testTypes().

Here is the caller graph for this function:

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

◆ IsProfiling()

static const tBoolean& CORE_Run::IsProfiling ( )
inlinestaticinherited

retun true if the code is in profing mode

Returns
true if the code is in profiling mode

References CORE_Run::mIsProfiling.

◆ loadBeamFromOptions()

CORE_UniquePointer< SM_Beam > SM_Run::loadBeamFromOptions ( const std::map< tString, tString > &  options) const
private

◆ loadMagneticMomentFromOptions()

tBoolean SM_Run::loadMagneticMomentFromOptions ( SM_System system,
const std::map< tString, tString > &  options 
) const
private

load the magnetic moment

Parameters
[in,out]system: system to load
[in]optionsfrom the options
Returns
true if the loading has been succeeded

References SM_Network::getDimension(), SM_System::getNetwork(), SM_Network::getParticlesNumber(), CORE_OptionsReader::ReadVector(), SM_System::setInitialMagneticMoment(), tBoolean, tIndex, tInt, tReal, and tString.

Referenced by run().

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

◆ loadNetworkFromOptions()

tBoolean SM_Run::loadNetworkFromOptions ( SM_Network network,
const std::map< tString, tString > &  options 
) const
private

load the network

Parameters
[in,out]network: network to load
[in]optionsfrom the options
Returns
true if the loading has been succeeded

References SM_Network::create3DGrid(), CORE_OptionsReader::ReadVector(), tBoolean, tIndex, tNaturalInteger, tReal, and tString.

Referenced by run().

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

◆ loadOperatorsFromOptions()

tBoolean SM_Run::loadOperatorsFromOptions ( SM_System system,
const std::map< tString, tString > &  options 
) const
private

load the operators

Parameters
[in,out]system: system to load the operators
[in]optionsfrom the options
Returns
true if the loading has been succeeded

References SM_System::addOperator(), CORE_Run::GetClassFactory(), CORE_ClassFactory::NewUniqueInstance(), CORE_OptionsReader::ReadVector(), SM_ZeemanOperator::setBext(), tBoolean, tReal, and tString.

Referenced by run().

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

◆ makeRun()

tBoolean SM_Run::makeRun ( const tString command,
const std::map< tString, tString > &  options 
) const
overridevirtual

make Run command

Parameters
[in]commandthe command to run
[in]optionsthe options of the program
Returns
true if the executing of the program has succeeded

Reimplemented from CORE_Run.

References createMagneticDipolarMap(), initManOptions(), run(), CORE_OptionsReader::SaveOptionsToFile(), and tString.

Here is the call graph for this function:

◆ makeTests()

tBoolean SM_Run::makeTests ( const std::map< tString, tString > &  options) const
overridevirtual

mak ethe tests of the prograp

Parameters
[in]optionsthe options of the tests
Returns
true if the the executing of the tests of program has succeeded

Reimplemented from CORE_Run.

References CORE_Test::execute().

Here is the call graph for this function:

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

◆ Out()

static CORE_Out& CORE_Run::Out ( )
inlinestaticinherited

◆ printHelp()

tBoolean CORE_Run::printHelp ( const std::map< tString, tString > &  options) const
inherited

print the help

Parameters
[in]optionsthe options of the program
Returns
always true

References CORE_Run::GetSoftName(), CORE_Run::GetVersion(), CORE_Run::initManOptions(), CORE_Run::Out(), and tString.

Referenced by CORE_Run::executeRun().

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

◆ run()

tBoolean SM_Run::run ( const std::map< tString, tString > &  options) const
private

◆ SetDebugOptions()

void CORE_Run::SetDebugOptions ( const std::map< tString, tString > &  option)
staticinherited

create the debug data from options

Parameters
[in]optionsdefault values of the options

References CORE_Object::EnableMemoryStack(), CORE_Run::mIsProfiling, CORE_Run::Out(), CORE_Out::println(), CORE_OptionsReader::ReadBoolean(), and tBoolean.

Referenced by CORE_Run::executeRun(), and CORE_Test::testCase().

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

◆ SetOutputOptions()

void CORE_Run::SetOutputOptions ( const std::map< tString, tString > &  option)
staticinherited

create the output stream from the options

Parameters
[in]optionsdefault values of the options

References CORE_Out::ALL_OUTPUT, CORE_Out::APPEND, CORE_Out::CREATE, CORE_Out::FILE_OUTPUT, CORE_Out::NO_OUTPUT, CORE_Run::Out(), CORE_OptionsReader::ReadBoolean(), CORE_OptionsReader::ReadPath(), CORE_Out::SCREEN_OUTPUT, CORE_Out::setOutput(), CORE_Out::setOutputFile(), tBoolean, tFlag, tString, and CORE_Out::update().

Referenced by CORE_Run::executeRun(), and CORE_Test::testCase().

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

◆ SetSoftName()

static void CORE_Run::SetSoftName ( const tString soft)
inlinestaticinherited

set soft name

Parameters
[in]softname of the soft

References CORE_Run::mSoftName.

Referenced by SM_Run().

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.

◆ SetVersion()

static void CORE_Run::SetVersion ( const tString version)
inlinestaticinherited

set the version

Parameters
versionname of the version set the version of the code

References CORE_Run::mVersion.

Referenced by SM_Run().

Here is the caller graph for this function:

◆ toString()

virtual tString CORE_Object::toString ( ) const
inlinevirtualinherited

Member Data Documentation

◆ mClassFactory

CORE_UniquePointer< CORE_ClassFactory > CORE_Run::mClassFactory =CORE_ClassFactory::New()
staticprivateinherited

◆ mIsProfiling

tBoolean CORE_Run::mIsProfiling =false
staticprivateinherited

◆ mOut

CORE_UniquePointer< CORE_Out > CORE_Run::mOut =CORE_Out::New()
staticprivateinherited

◆ mSoftName

tString CORE_Run::mSoftName ="core.exe"
staticprivateinherited

◆ mThis

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

◆ mVersion

tString CORE_Run::mVersion ="VERSION"
staticprivateinherited

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