VERB4D
Macros | Functions
UpdatableMatrix.cpp File Reference

Same functionality as matrices found in Matrix.h but can also be updated from ini-files. More...

#include "UpdatableMatrix.h"

Macros

#define UPDATE_EXT   ".lst"
 

Functions

void MatrixAllocateMemory (Matrix1D< double > &M, const Matrix1D< double > Q1, const Matrix1D< double > Q2, const Matrix1D< double > Q3, const Matrix1D< double > Q4)
 
void MatrixAllocateMemory (Matrix2D< double > &M, const Matrix2D< double > Q1, const Matrix2D< double > Q2, const Matrix2D< double > Q3, const Matrix2D< double > Q4)
 
void MatrixAllocateMemory (Matrix3D< double > &M, const Matrix3D< double > Q1, const Matrix3D< double > Q2, const Matrix3D< double > Q3, const Matrix3D< double > Q4)
 
void MatrixAllocateMemory (Matrix4D< double > &M, const Matrix4D< double > Q1, const Matrix4D< double > Q2, const Matrix4D< double > Q3, const Matrix4D< double > Q4)
 
void MatrixReadFromFile (Matrix1D< double > &M, string data_filename, const Matrix1D< double > Q1, const Matrix1D< double > Q2, const Matrix1D< double > Q3, const Matrix1D< double > Q4)
 
void MatrixReadFromFile (Matrix2D< double > &M, string data_filename, const Matrix2D< double > Q1, const Matrix2D< double > Q2, const Matrix2D< double > Q3, const Matrix2D< double > Q4)
 
void MatrixReadFromFile (Matrix3D< double > &M, string data_filename, const Matrix3D< double > Q1, const Matrix3D< double > Q2, const Matrix3D< double > Q3, const Matrix3D< double > Q4)
 
void MatrixReadFromFile (Matrix4D< double > &M, string data_filename, const Matrix4D< double > Q1, const Matrix4D< double > Q2, const Matrix4D< double > Q3, const Matrix4D< double > Q4)
 
void MatrixLimit (UpdatableMatrix< Matrix1D< double > > &M, Matrix1D< double > &Q1, Matrix1D< double > &Q2, Matrix1D< double > &Q3, Matrix1D< double > &Q4, double Q1_from, double Q1_to, double Q2_from, double Q2_to, double Q3_from, double Q3_to, double Q4_from, double Q4_to)
 
void MatrixLimit (UpdatableMatrix< Matrix2D< double > > &M, Matrix2D< double > &Q1, Matrix2D< double > &Q2, Matrix2D< double > &Q3, Matrix2D< double > &Q4, double Q1_from, double Q1_to, double Q2_from, double Q2_to, double Q3_from, double Q3_to, double Q4_from, double Q4_to)
 
void MatrixLimit (UpdatableMatrix< Matrix3D< double > > &M, Matrix3D< double > &Q1, Matrix3D< double > &Q2, Matrix3D< double > &Q3, Matrix3D< double > &Q4, double Q1_from, double Q1_to, double Q2_from, double Q2_to, double Q3_from, double Q3_to, double Q4_from, double Q4_to)
 
void MatrixLimit (UpdatableMatrix< Matrix4D< double > > &M, Matrix4D< double > &Q1, Matrix4D< double > &Q2, Matrix4D< double > &Q3, Matrix4D< double > &Q4, double Q1_from, double Q1_to, double Q2_from, double Q2_to, double Q3_from, double Q3_to, double Q4_from, double Q4_to)
 
string GetCurrentTimeValue (string filename, double current_time, double &update_time)
 
bool is_number (const std::string &s)
 

Detailed Description

Same functionality as matrices found in Matrix.h but can also be updated from ini-files.

These can act just like matrices, but have the ability to be updated from ini-files at any point in time.

Templetes are used so we don't repeat exactly the same code 4 times - for 1D, 2D, 3D, and 4D matrices

Function Documentation

string GetCurrentTimeValue ( string  filename,
double  current_time,
double &  update_time 
)

Search for current time-step in an update-file and return the corresponding value

Parameters
filename- filename to check. Also can be just a value - then we just return this value!
current_time- the time we're searching for
update_time- this is a return value! It is the time we've found!
Returns
bool is_number ( const std::string &  s)

Check if a string is number

Note: Will accept any string (even badly formatted ones) consisting entirely of the following: Numbers, . , e , - , +

For example 1.2.3-e.4 will be accepted

Parameters
s- the string we need to check
Returns
True if it's a number, false if it's not
void MatrixAllocateMemory ( Matrix1D< double > &  M,
const Matrix1D< double >  Q1,
const Matrix1D< double >  Q2,
const Matrix1D< double >  Q3,
const Matrix1D< double >  Q4 
)
inline

Allocates memory using the allocate memory function for Matrix1D

void MatrixAllocateMemory ( Matrix2D< double > &  M,
const Matrix2D< double >  Q1,
const Matrix2D< double >  Q2,
const Matrix2D< double >  Q3,
const Matrix2D< double >  Q4 
)
inline

Allocates memory using the allocate memory function for Matrix2D

void MatrixAllocateMemory ( Matrix3D< double > &  M,
const Matrix3D< double >  Q1,
const Matrix3D< double >  Q2,
const Matrix3D< double >  Q3,
const Matrix3D< double >  Q4 
)
inline

Allocates memory using the allocate memory function for Matrix3D

void MatrixAllocateMemory ( Matrix4D< double > &  M,
const Matrix4D< double >  Q1,
const Matrix4D< double >  Q2,
const Matrix4D< double >  Q3,
const Matrix4D< double >  Q4 
)
inline

Allocates memory using the allocate memory function for Matrix4D

void MatrixLimit ( UpdatableMatrix< Matrix1D< double > > &  M,
Matrix1D< double > &  Q1,
Matrix1D< double > &  Q2,
Matrix1D< double > &  Q3,
Matrix1D< double > &  Q4,
double  Q1_from,
double  Q1_to,
double  Q2_from,
double  Q2_to,
double  Q3_from,
double  Q3_to,
double  Q4_from,
double  Q4_to 
)

Function to limit the data on any direction (e.g. only above plasmapause location, or only on day/night side)

Sets all values to 0 which are not in the range of "from" to "to"

Parameters
M- The matrix that will be updated(limited)
void MatrixLimit ( UpdatableMatrix< Matrix2D< double > > &  M,
Matrix2D< double > &  Q1,
Matrix2D< double > &  Q2,
Matrix2D< double > &  Q3,
Matrix2D< double > &  Q4,
double  Q1_from,
double  Q1_to,
double  Q2_from,
double  Q2_to,
double  Q3_from,
double  Q3_to,
double  Q4_from,
double  Q4_to 
)

Function to limit the data on any direction (e.g. only above plasmapause location, or only on day/night side)

Sets all values to 0 which are not in the range of "from" to "to"

Parameters
M- The matrix that will be updated(limited)
void MatrixLimit ( UpdatableMatrix< Matrix3D< double > > &  M,
Matrix3D< double > &  Q1,
Matrix3D< double > &  Q2,
Matrix3D< double > &  Q3,
Matrix3D< double > &  Q4,
double  Q1_from,
double  Q1_to,
double  Q2_from,
double  Q2_to,
double  Q3_from,
double  Q3_to,
double  Q4_from,
double  Q4_to 
)

Function to limit the data on any direction (e.g. only above plasmapause location, or only on day/night side)

Sets all values to 0 which are not in the range of "from" to "to"

Parameters
M- The matrix that will be updated(limited)
void MatrixLimit ( UpdatableMatrix< Matrix4D< double > > &  M,
Matrix4D< double > &  Q1,
Matrix4D< double > &  Q2,
Matrix4D< double > &  Q3,
Matrix4D< double > &  Q4,
double  Q1_from,
double  Q1_to,
double  Q2_from,
double  Q2_to,
double  Q3_from,
double  Q3_to,
double  Q4_from,
double  Q4_to 
)

Function to limit the data on any direction (e.g. only above plasmapause location, or only on day/night side)

Sets all values to 0 which are not in the range of "from" to "to"

Parameters
M- The matrix that will be updated(limited)
void MatrixReadFromFile ( Matrix1D< double > &  M,
string  data_filename,
const Matrix1D< double >  Q1,
const Matrix1D< double >  Q2,
const Matrix1D< double >  Q3,
const Matrix1D< double >  Q4 
)
void MatrixReadFromFile ( Matrix2D< double > &  M,
string  data_filename,
const Matrix2D< double >  Q1,
const Matrix2D< double >  Q2,
const Matrix2D< double >  Q3,
const Matrix2D< double >  Q4 
)
void MatrixReadFromFile ( Matrix3D< double > &  M,
string  data_filename,
const Matrix3D< double >  Q1,
const Matrix3D< double >  Q2,
const Matrix3D< double >  Q3,
const Matrix3D< double >  Q4 
)
void MatrixReadFromFile ( Matrix4D< double > &  M,
string  data_filename,
const Matrix4D< double >  Q1,
const Matrix4D< double >  Q2,
const Matrix4D< double >  Q3,
const Matrix4D< double >  Q4 
)