C++ main module for stochmagnet Package
1.0
|
#include <SM_Run.h>
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 tString & | GetSoftName () |
get soft name More... | |
static void | SetVersion (const tString &version) |
set the version More... | |
static const tString & | GetVersion () |
get the version More... | |
static const tBoolean & | IsProfiling () |
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_Out & | Out () |
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_ClassFactory & | GetClassFactory () |
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_Beam > | loadBeamFromOptions (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_Object > | mThis |
Static Private Attributes | |
static tString | mSoftName ="core.exe" |
static tString | mVersion ="VERSION" |
static CORE_UniquePointer< CORE_Out > | mOut =CORE_Out::New() |
static CORE_UniquePointer< CORE_ClassFactory > | mClassFactory =CORE_ClassFactory::New() |
static tBoolean | mIsProfiling =false |
SM_Run::SM_Run | ( | void | ) |
create
References CORE_Run::SetSoftName(), and CORE_Run::SetVersion().
|
virtual |
destroy
|
overridevirtual |
create the class factories from options
[in] | options | the options |
Reimplemented from CORE_Run.
References CORE_ClassFactory::addClassFactory(), CORE_Run::GetClassFactory(), and SM_ClassFactory::New().
create a dipolar magnetic map
[in] | fileName | name of the VTK file to save |
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().
|
inlinestaticinherited |
disable the memory stack
Referenced by CORE_Object::EnableMemoryStack().
|
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().
|
inherited |
run the program from main class
[in] | argc | number of arguments |
[in] | argv | the char* value of the arguments |
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().
|
private |
save the file for animations
[in] | beam | the beam to print the results |
[in] | options | options of the program |
References SM_Output::generateOutput(), CORE_OptionsReader::ReadPath(), CORE_OptionsReader::ReadVector(), SM_Output::setOutputPath(), SM_Output::setPrefix(), SM_Output::setSimulations(), and tString.
Referenced by run().
|
inlinestaticinherited |
return the class factory
References CORE_Run::mClassFactory.
Referenced by createClassFactories(), SM_Test::grid3DParticlesTestCase(), SM_Test::linedParticlesTestCase(), loadBeamFromOptions(), loadOperatorsFromOptions(), and SM_Test::testOperators().
|
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.
|
inlineoverridevirtualinherited |
return the memory size in byte
Reimplemented from CORE_Object.
References CORE_Run::mClassFactory, and CORE_Run::mOut.
Referenced by getMemorySize(), and CORE_Run::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().
|
inlinevirtual |
return the memory size of the class and the memory size of all its attributes/associations
Reimplemented from CORE_Run.
References CORE_Run::getContentsMemorySize().
|
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.
|
inlinestaticinherited |
get soft name
References CORE_Run::mSoftName.
Referenced by CORE_Run::printHelp(), and run().
|
inlinestaticinherited |
get the version
References CORE_Run::mVersion.
Referenced by CORE_Run::printHelp(), and run().
|
overridevirtual |
init the man of the options
[in] | options | man of the options |
Reimplemented from CORE_Run.
References CORE_Run::initManOptions(), and tString.
Referenced by makeRun(), and run().
default initialization of the options
[in] | options | default values of the options |
Reimplemented from CORE_Run.
References CORE_Run::initOptions().
|
inlinestaticinherited |
init the seed for uniform random generator
|
inlinestaticinherited |
init the seed for uniform random generator
[in] | seed | : seed for uniform random generator |
Referenced by CORE_Test::primaryTests().
|
inlinestaticinherited |
return true if the machine is a 32 bits machine
References tLDouble.
Referenced by CORE_Test::testTypes().
|
inlinestaticinherited |
return true if the machine is a 64 bits machine
References tLDouble.
Referenced by SM_VTK::getVTKType(), and CORE_Test::testTypes().
|
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().
|
inlinestaticinherited |
retun true if the code is in profing mode
References CORE_Run::mIsProfiling.
|
private |
load the beam
[in] | options | from the options |
References CORE_Run::GetClassFactory(), SM_System::getLandauLifschitzFunction(), SM_Beam::getSystem(), SM_System::getTimeStepper(), CORE_ClassFactory::NewUniqueInstance(), CORE_OptionsReader::ReadBoolean(), SM_LandauLifschitzFunction::setAlpha(), SM_Beam::setBeamSize(), SM_LandauLifschitzFunction::setBeta(), SM_Beam::setIsTemplatedSimulateVersion(), SM_System::setNoiseRateFunction(), SM_Beam::setStochasticFunction(), SM_Beam::setSystem(), SM_TimeStepper::setTargetTime(), SM_TimeStepper::setTimeStep(), tBoolean, tNaturalInteger, tReal, tString, tUInt, and tULLInt.
Referenced by run().
|
private |
load the magnetic moment
[in,out] | system | : system to load |
[in] | options | from the options |
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().
|
private |
load the network
[in,out] | network | : network to load |
[in] | options | from the options |
References SM_Network::create3DGrid(), CORE_OptionsReader::ReadVector(), tBoolean, tIndex, tNaturalInteger, tReal, and tString.
Referenced by run().
|
private |
load the operators
[in,out] | system | : system to load the operators |
[in] | options | from the options |
References SM_System::addOperator(), CORE_Run::GetClassFactory(), CORE_ClassFactory::NewUniqueInstance(), CORE_OptionsReader::ReadVector(), SM_ZeemanOperator::setBext(), tBoolean, tReal, and tString.
Referenced by run().
|
overridevirtual |
make Run command
[in] | command | the command to run |
[in] | options | the options of the program |
Reimplemented from CORE_Run.
References createMagneticDipolarMap(), initManOptions(), run(), CORE_OptionsReader::SaveOptionsToFile(), and tString.
mak ethe tests of the prograp
[in] | options | the options of the tests |
Reimplemented from CORE_Run.
References CORE_Test::execute().
|
inlinestaticinherited |
get the memory stack in string
Referenced by main().
|
inlinestaticinherited |
return the output stream
References CORE_Run::mOut.
Referenced by CORE_Exception::CORE_Exception(), SM_Beam::discretize(), SM_Test::elementaryTests(), CORE_Test::execute(), SM_Test::grid3DParticlesTestCase(), SM_Test::linedParticlesTestCase(), CORE_Test::primaryTests(), SM_Test::primaryTests(), CORE_Run::printHelp(), run(), CORE_Run::SetDebugOptions(), CORE_Run::SetOutputOptions(), CORE_Test::testCase(), SM_Test::testDerivative(), SM_Test::testEnergyOperatorsDerivatives(), CORE_Test::testIO(), CORE_Test::testMemorySize(), SM_Test::testNormalLaw(), CORE_Test::testTypes(), SM_Test::testVirtualMethods(), and SM_Test::validate().
print the help
[in] | options | the options of the program |
References CORE_Run::GetSoftName(), CORE_Run::GetVersion(), CORE_Run::initManOptions(), CORE_Run::Out(), and tString.
Referenced by CORE_Run::executeRun().
run the progra with the options
[in] | options | options of the program |
References CORE_Chrono::ConvertDuration(), generateOutput(), CORE_Chrono::GetDate(), CORE_Exception::getMessage(), CORE_Run::GetSoftName(), CORE_Run::GetVersion(), initManOptions(), loadBeamFromOptions(), loadMagneticMomentFromOptions(), loadNetworkFromOptions(), loadOperatorsFromOptions(), CORE_Run::Out(), CORE_Out::print(), CORE_OptionsReader::PrintOptions(), CORE_Chrono::start(), CORE_Chrono::stop(), tBoolean, tIndex, CORE_Object::toString(), and tUInt.
Referenced by makeRun().
create the debug data from options
[in] | options | default 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().
create the output stream from the options
[in] | options | default 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().
|
inlinestaticinherited |
set soft name
[in] | soft | name of the soft |
References CORE_Run::mSoftName.
Referenced by SM_Run().
|
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.
|
inlinestaticinherited |
set the version
version | name of the version set the version of the code |
References CORE_Run::mVersion.
Referenced by SM_Run().
|
inlinevirtualinherited |
return the string representation of the object node
Reimplemented in SM_TimeStepper, SM_System, SM_StochasticFunction, SM_Network, SM_LandauLifschitzFunction, SM_Beam, CORE_Field< T, K, D, S, I >, CORE_Field< T, K, D, CORE_StdPtrArray< T >, CORE_StdPtrField< T, K, D > >, CORE_Field< T, K, D, CORE_StdValArray< T >, CORE_StdValField< T, K, D > >, CORE_Collection< T, I >, CORE_ClassFactory, and SM_NoiseRateFunction.
References CORE_Object::getIdentityString().
Referenced by run(), CORE_Collection< T, I >::toString(), SM_Beam::toString(), SM_Network::toString(), SM_StochasticFunction::toString(), SM_System::toString(), and SM_TimeStepper::toString().
|
staticprivateinherited |
Referenced by CORE_Run::GetClassFactory(), CORE_Run::getContentsMemorySize(), and CORE_Run::~CORE_Run().
|
staticprivateinherited |
Referenced by CORE_Run::IsProfiling(), and CORE_Run::SetDebugOptions().
|
staticprivateinherited |
Referenced by CORE_Run::getContentsMemorySize(), CORE_Run::Out(), and CORE_Run::~CORE_Run().
|
staticprivateinherited |
Referenced by CORE_Run::GetSoftName(), and CORE_Run::SetSoftName().
|
privateinherited |
Referenced by CORE_Object::getConstSharedPointer(), CORE_Object::getSharedPointer(), and CORE_Object::setThis().
|
staticprivateinherited |
Referenced by CORE_Run::GetVersion(), and CORE_Run::SetVersion().