VERB_code_2.2  2
 All Classes Namespaces Files Functions Variables Typedefs Macros Pages
Parameters.cpp File Reference

Defenition of the struct Parameters_structure, struct DxxParameters_structure and supporting function Loads parameters from file into map, then use parameters-structure related functions to get parameters values from the map and store them into the parameters structures. More...

#include "Parameters.h"
#include "../VariousFunctions/variousFunctions.h"
#include "../Exceptions/error.h"
#include "../Logging/Output.h"
#include "../VariousFunctions/erf.h"
#include <iostream>

Go to the source code of this file.

Functions

template<typename T >
bool ReadFromFile (T &variable, ifstream &parameters_file, string variable_name, string default_value="")
 
void StrToVal (string input, double &place)
 Convert string to double. More...
 
void StrToVal (string input, int &place)
 Convert string to int. More...
 
void StrToVal (string input, string &place)
 Return same string. More...
 
void StrToVal (string input, bool &place)
 Convert string to bool. More...
 
bool str2bool (string str)
 Return bool from string (Yes|True|1) More...
 
string bool2str (bool b)
 Return string (Yes|No) from bool. More...
 
void load_1d (Matrix1D< double > &var, string filename, double dt, int var_size)
 

Detailed Description

Defenition of the struct Parameters_structure, struct DxxParameters_structure and supporting function Loads parameters from file into map, then use parameters-structure related functions to get parameters values from the map and store them into the parameters structures.

Author
Developed by Dmitry Subbotin under supervision of the PI Yuri Shprits

Definition in file Parameters.cpp.

Function Documentation

template<typename T >
bool ReadFromFile ( T &  variable,
ifstream &  parameters_file,
string  variable_name,
string  default_value = "" 
)

Read each parameter from parameters file

Definition at line 24 of file Parameters.cpp.

References Output::echo(), and StrToVal().

void StrToVal ( string  input,
double &  place 
)

Convert string to double.

Converting string to double.

Definition at line 526 of file Parameters.cpp.

void StrToVal ( string  input,
int &  place 
)

Convert string to int.

Converting string to int.

Definition at line 534 of file Parameters.cpp.

void StrToVal ( string  input,
string &  place 
)

Return same string.

Converting string to string. Function StrToVal is used in template, so we need thad function to make template function works in case of string.

Definition at line 542 of file Parameters.cpp.

void StrToVal ( string  input,
bool &  place 
)

Convert string to bool.

Converting string to bool.

Definition at line 550 of file Parameters.cpp.

References str2bool().

bool str2bool ( string  str)

Return bool from string (Yes|True|1)

Converting string to boolean.

Definition at line 559 of file Parameters.cpp.

string bool2str ( bool  b)

Return string (Yes|No) from bool.

Converting boolean to string.

Definition at line 567 of file Parameters.cpp.

void load_1d ( Matrix1D< double > &  var,
string  filename,
double  dt,
int  var_size 
)

Read 1d matrix_array from txt-file and interpolate to out time-axis.

Definition at line 574 of file Parameters.cpp.

References Matrix1D< T >::AllocateMemory(), and Matrix1D< T >::size_x.