Feellgood
Public Member Functions | Static Public Member Functions | Public Attributes | Private Attributes | List of all members
Settings Class Reference

Container for all the settings provided by the user, with conversions to/from YAML. More...

#include <feellgoodSettings.h>

Public Member Functions

 Settings ()
 
void toYaml (void)
 
std::string evolMetadata (std::string realWorldTime) const
 
std::string solMetadata (double t, std::string columnsTitle) const
 
void read (YAML::Node)
 
bool read (std::string filename)
 
int getPrecision (void) const
 
std::string getFileDisplayName (void) const
 
void setFileDisplayName (std::string _s)
 
void setPbName (std::string str)
 
std::string getPbName (void) const
 
void setSimName (std::string str)
 
std::string getSimName (void) const
 
void setScale (const double s)
 
double getScale (void) const
 
void set_MAXITER (int i)
 
int findTetraRegionIdx (const std::string name) const
 
int findFacetteRegionIdx (const std::string name) const
 
Eigen::Vector3d getMagnetization (const Eigen::Ref< Eigen::Vector3d > p) const
 
Eigen::Vector3d getField (const double t_val) const
 
field_exprType getFieldType (void) const
 
Eigen::Vector3d getFieldSpace (const Eigen::Ref< Eigen::Vector3d > p) const
 
double getFieldTime (const double t_val) const
 

Static Public Member Functions

static void dumpDefaults ()
 

Public Attributes

bool withTsv
 
int verbose
 
double time_step
 
int save_period
 
bool recenter
 
Nodes::index recentering_direction
 
double threshold
 
int solverNbTh
 
int scalfmmNbTh
 
STT p_stt
 
bool stt_flag
 
std::string sMx
 
std::string sMy
 
std::string sMz
 
std::string sM
 
std::string sBx
 
std::string sBy
 
std::string sBz
 
std::string sB
 
std::string sB_space
 
std::string sB_time
 
std::string restoreFileName
 
double initial_time = NAN
 
double DUMAX
 
double TOL
 
int MAXITER
 
double ILU_tol
 
int ILU_fill_factor
 
std::vector< Tetra::prmparamTetra
 
std::vector< Facette::prmparamFacette
 
std::string r_path_output_dir
 
std::vector< std::string > evol_columns
 
double tf
 
double dt_min
 
double dt_max
 

Private Attributes

int precision
 
std::string fileDisplayName
 
double _scale
 
std::string simName
 
std::string pbName
 
ExpressionParser mag_parser
 
field_exprType field_type
 
ExpressionParser field_parser
 
ExpressionParser field_time_parser
 
ExpressionParser field_space_parser
 

Detailed Description

Container for all the settings provided by the user, with conversions to/from YAML.

This class stores all the settings the user provides in their YAML configuration file. In addition to storing the settings, the class can convert them to and from YAML text:

The default settings are provided in the source file default-settings.yml. During the build, the contents of this file is embedded into the executable as a character array. This class' constructor initializes the settings by parsing this embedded document.

Javascript expressions (initial magnetization and applied field) are stored both in source form (sM* and sB* members) and as private ExpressionParser instances. This class provides methods for evaluating those expressions: getMagnetization(), getField(), getFieldSpace() and getFieldTime(). All these methods temporarily modify their corresponding ExpressionParser instances, it is thus not safe to call them from multiple threads simultaneously.

Constructor & Destructor Documentation

◆ Settings()

Settings::Settings ( )

Constructor. The default values for data members are defined in the source file default-settings.yml. A cmake rule invokes the linker ld in order to convert this file to an object file which stores the original file's contents as a (not NUL-terminated) character array. This constructor calls read(YAML::Load(...)) on this embedded document in order to initialize all data members.

Member Function Documentation

◆ dumpDefaults()

void Settings::dumpDefaults ( )
static

Print to stdout the embedded YAML document defining the default settings.

◆ evolMetadata()

std::string Settings::evolMetadata ( std::string  realWorldTime) const

build a metadata string for .evol file

◆ findFacetteRegionIdx()

int Settings::findFacetteRegionIdx ( const std::string  name) const
inline
Returns
index of the region in surface region container
Parameters
[in]name

◆ findTetraRegionIdx()

int Settings::findTetraRegionIdx ( const std::string  name) const
inline
Returns
index of the region in volume region container
Parameters
[in]name

◆ getField()

Eigen::Vector3d Settings::getField ( const double  t_val) const
inline

Evaluate the applied field as a function of time. This is allowed only if field_type is RtoR3. This method is not thread safe.

Returns
applied H field (not B!)

◆ getFieldSpace()

Eigen::Vector3d Settings::getFieldSpace ( const Eigen::Ref< Eigen::Vector3d >  p) const
inline

Evaluate the “spatial” part of the applied field, which is a position-dependent vector. This is allowed only if field_type is R4toR3. This method is not thread safe.

Returns
spatial part of applied H field (not B!)

◆ getFieldTime()

double Settings::getFieldTime ( const double  t_val) const
inline

Evaluate the “time” part of the applied field, which is a time-dependent scalar. This is allowed only if field_type is R4toR3. This method is not thread safe.

Returns
time part of applied H field (not B!)

◆ getFieldType()

field_exprType Settings::getFieldType ( void  ) const
inline

Returns the field type, which can be either RtoR3 (vector function of time) or R4toR3 (product of a time-dependent scalar and a position-dependent vector).

◆ getFileDisplayName()

std::string Settings::getFileDisplayName ( void  ) const
inline

getter for fileDisplayName

◆ getMagnetization()

Eigen::Vector3d Settings::getMagnetization ( const Eigen::Ref< Eigen::Vector3d >  p) const
inline

Evaluate the initial magnetization vector as a function of the position vector. This method is not thread safe.

Returns
reduced magnetization (unit vector)

◆ getPbName()

std::string Settings::getPbName ( void  ) const
inline

getter for problem file name

◆ getPrecision()

int Settings::getPrecision ( void  ) const
inline

returns numeric precision for .sol output text files

◆ getScale()

double Settings::getScale ( void  ) const
inline

getter for geometrical scaling factor for physical coordinates of the mesh

◆ getSimName()

std::string Settings::getSimName ( void  ) const
inline

getter for output file name

◆ read() [1/2]

bool Settings::read ( std::string  filename)

read settings from a YAML file. Returns true if a non-empty configuration is found.

◆ read() [2/2]

void Settings::read ( YAML::Node  yaml)

read settings from a parsed YAML document

◆ set_MAXITER()

void Settings::set_MAXITER ( int  i)
inline

maximum number of iterations setter for bicgstab

◆ setFileDisplayName()

void Settings::setFileDisplayName ( std::string  _s)
inline

setter for fileDisplayName

◆ setPbName()

void Settings::setPbName ( std::string  str)
inline

setter for .msh file name

◆ setScale()

void Settings::setScale ( const double  s)
inline

setter for geometrical scaling factor for physical coordinates of the mesh

◆ setSimName()

void Settings::setSimName ( std::string  str)
inline

setter for .sol output file name

◆ solMetadata()

std::string Settings::solMetadata ( double  t,
std::string  columnsTitle 
) const

build a metadata string for .sol text files

◆ toYaml()

void Settings::toYaml ( void  )

Serialize these settings as a YAML document, and print them to stdout.

Member Data Documentation

◆ _scale

double Settings::_scale
private

scaling factor from gmsh files to feellgood

◆ dt_max

double Settings::dt_max

maximal time step

◆ dt_min

double Settings::dt_min

minimal time step

◆ DUMAX

double Settings::DUMAX

maximum value for du step

◆ evol_columns

std::vector<std::string> Settings::evol_columns

contain the value names of the columns the user want in .evol file

◆ field_parser

ExpressionParser Settings::field_parser
private

parser for the time dependant applied field expressions R->R³

◆ field_space_parser

ExpressionParser Settings::field_space_parser
private

parser for the field space dependant vector expressions

◆ field_time_parser

ExpressionParser Settings::field_time_parser
private

parser for the field time dependant scalar expression

◆ field_type

field_exprType Settings::field_type
private

applied field might be either expression defined (t) -> (Bx(t),By(t),Bz(t)) or a couple of math expressions (t) -> A(t) and (x,y,z) -> (fx(x,y,z),fy(x,y,z),fz(x,y,z)) with B(x,y,z,t) = A(t) * (fx(x,y,z),fy(x,y,z),fz(x,y,z))

◆ fileDisplayName

std::string Settings::fileDisplayName
private

parameters file name : either a yaml file or standard input

◆ ILU_fill_factor

int Settings::ILU_fill_factor

◆ ILU_tol

double Settings::ILU_tol

◆ initial_time

double Settings::initial_time = NAN

initial time for the simulation, if defined in the settings file, NAN otherwise

◆ mag_parser

ExpressionParser Settings::mag_parser
private

parser for the magnetization expressions R³->R³

◆ MAXITER

int Settings::MAXITER

maximum number of iteration for biconjugate gradient algorithm

◆ p_stt

STT Settings::p_stt

spin transfert torque parameters

◆ paramFacette

std::vector<Facette::prm> Settings::paramFacette

this vector contains the material parameters for all regions for all the facettes

◆ paramTetra

std::vector<Tetra::prm> Settings::paramTetra

this vector contains the material parameters for all regions for all the tetrahedrons

◆ pbName

std::string Settings::pbName
private

mesh file, gmsh file format

◆ precision

int Settings::precision
private

numeric precision for .sol output text files

◆ r_path_output_dir

std::string Settings::r_path_output_dir

relative path for output files (to be implemented)

◆ recenter

bool Settings::recenter

to recenter magnetization distribution or not

◆ recentering_direction

Nodes::index Settings::recentering_direction

recentering direction, should be IDX_X|IDX_Y|IDX_Z

◆ restoreFileName

std::string Settings::restoreFileName

input file name for continuing a calculation (sol.in)

◆ save_period

int Settings::save_period

magnetic configuration saved every save_period time steps

◆ sB

std::string Settings::sB

string for a JavaScript function defining B, alternative to (sBx, sBy, sBz)

◆ sB_space

std::string Settings::sB_space

string for a JavaScript function defining B space: (x,y,z)->[,,]

◆ sB_time

std::string Settings::sB_time

string for a JavaScript function defining B time, (t) -> real

◆ sBx

std::string Settings::sBx

string for analytical definition of Bx

◆ sBy

std::string Settings::sBy

string for analytical definition of By

◆ sBz

std::string Settings::sBz

string for analytical definition of Bz

◆ scalfmmNbTh

int Settings::scalfmmNbTh

nb of threads for the computation of the demag field with scalfmm

◆ simName

std::string Settings::simName
private

simulation name

◆ sM

std::string Settings::sM

string for a JavaScript function defining M, alternative to (sMx, sMy, sMz)

◆ sMx

std::string Settings::sMx

string for analytical definition of Mx

◆ sMy

std::string Settings::sMy

string for analytical definition of My

◆ sMz

std::string Settings::sMz

string for analytical definition of Mz

◆ solverNbTh

int Settings::solverNbTh

nb of threads for the finite element solver

◆ stt_flag

bool Settings::stt_flag

if spin transfer torque p_stt is fully initialized and boundary conditions ok, stt_flag is set to true

◆ tf

double Settings::tf

final integration time

◆ threshold

double Settings::threshold

threshold value to recenter or not versus avg(M_recentering_direction)

◆ time_step

double Settings::time_step

energy saved every time_step

◆ TOL

double Settings::TOL

solver tolerance (eigen bicgstab)

◆ verbose

int Settings::verbose

verbosity level, defaults to zero

◆ withTsv

bool Settings::withTsv

boolean flag to mention if you want output in txt tsv file format


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