#include <Matrix.h>
Public Member Functions | |
int | index1d (int x, int y, int z) |
Returns corresponding index of 1d array. | |
Matrix3D () | |
Default constructor. Do nothing. | |
Matrix3D (const Matrix3D< T > &M) | |
Constructor. | |
Matrix3D (int size_x, int size_y, int size_z) | |
Constructor. | |
~Matrix3D () | |
Destructor. | |
void | AllocateMemory (int size_x, int size_y, int size_z) |
Alocating memory and filling it with zero-valiues. | |
T | max () |
Return maximum value of the matrix. | |
T | maxabs () |
Return absolute maximum value of the matrix. | |
Matrix3D< T > | abs () |
Return absolute value of the matrix. | |
Matrix2D< T > | xSlice (int p_x) |
Make x-slice of 3d matrix - 2d matrix. | |
Matrix2D< T > | ySlice (int p_y) |
Make y-slice of 3d matrix - 2d matrix. | |
Matrix2D< T > | zSlice (int p_z) |
Make z-slice of 3d matrix - 2d matrix. | |
T ** | operator[] (int i) |
Return the i-th pointer to 2d-array. Next [j][k] can be applied, so we have regular [i][j][k]. | |
T & | operator() (int x, int y, int z) |
Return the (x,y,z) value of matrix. | |
T & | Value (int x, int y, int z) |
Matrix3D & | operator= (const Matrix3D< T > &M) |
Makes matrix equal to Matrix M. | |
Matrix3D & | operator= (Matrix2D< T > &M) |
Makes 3D matrix from 2D matrix. | |
Matrix3D & | operator= (T Val) |
Makes Matrix equal to value Val. | |
Matrix3D | operator/ (T Val) |
Divide each element of the matrix to Val. | |
Matrix3D | operator* (T Val) |
Multiply eqach element of the matrix to Val. | |
Matrix3D | operator/ (Matrix3D< T > &M) |
Divide each element of the matrix to corresponds element of matrix M. | |
Matrix3D | operator* (Matrix3D< T > &M) |
Multiply each element of the matrix to corresponds element of matrix M. | |
Matrix3D | operator+ (Matrix3D< T > &M) |
Add each element of the matrix to corresponds element of matrix M. | |
Matrix3D | operator- (Matrix3D< T > &M) |
Substract each element of the matrix to corresponds element of matrix M. | |
void | writeToFile (string filename) |
Write matrix to file. | |
void | writeToFile (string filename, Matrix3D< T > &grid_x, Matrix3D< T > &grid_y, Matrix3D< T > &grid_z) |
Write matrix to file, using 3 other matrixes as a grid (simply - write all 4 matrixes to the file). | |
void | readFromFile (string filename) |
Read matrix data from file. | |
void | readFromFile (string filename, Matrix3D< T > &grid_x, Matrix3D< T > &grid_y, Matrix3D< T > &grid_z) |
Read matrix data from file with grid. | |
Public Attributes | |
bool | initialized |
Flag, equal true if initialized. | |
string | change_ind |
Variables useful for changes tracking. | |
int | size_x |
int | size_y |
int | size_z |
size x, size y, size z | |
string | name |
name of the Matrix |
Matrixes and operations.
Definition at line 147 of file Matrix.h.
Default constructor. Do nothing.
Definition at line 165 of file Matrix.h.
Referenced by DiffusionCoefficient::operator*(), BoundaryCondition::operator*(), and DiffusionCoefficient::operator+().
Constructor.
Create matrix equal to Matrix M.
&M | - Matrix M. |
Definition at line 776 of file Matrix.cpp.
References Matrix3D< T >::initialized, and Matrix3D< T >::operator=().
Constructor.
Allocate memory.
Definition at line 763 of file Matrix.cpp.
References Matrix3D< T >::AllocateMemory(), and Matrix3D< T >::initialized.
Destructor.
Definition at line 785 of file Matrix.cpp.
References Matrix3D< T >::initialized, Matrix3D< T >::size_x, and Matrix3D< T >::size_y.
Return absolute value of the matrix.
Definition at line 1179 of file Matrix.cpp.
References Matrix3D< T >::size_x, Matrix3D< T >::size_y, and Matrix3D< T >::size_z.
void Matrix3D< T >::AllocateMemory | ( | int | x_size, | |
int | y_size, | |||
int | z_size | |||
) | [inline] |
Alocating memory and filling it with zero-valiues.
Reimplemented in DiffusionCoefficient, and GridElement.
Definition at line 796 of file Matrix.cpp.
References i, Matrix3D< T >::initialized, Matrix3D< T >::size_x, Matrix3D< T >::size_y, and Matrix3D< T >::size_z.
Referenced by Grid::Grid(), Grid::MakeGrid(), Matrix3D< T >::Matrix3D(), and Matrix3D< T >::operator=().
int Matrix3D< T >::index1d | ( | int | x, | |
int | y, | |||
int | z | |||
) | [inline] |
Returns corresponding index of 1d array.
Definition at line 814 of file Matrix.cpp.
References Matrix3D< T >::size_y, and Matrix3D< T >::size_z.
T Matrix3D< T >::max | ( | ) | [inline] |
Return maximum value of the matrix.
Definition at line 1145 of file Matrix.cpp.
References Matrix3D< T >::size_x, Matrix3D< T >::size_y, and Matrix3D< T >::size_z.
Referenced by main().
T Matrix3D< T >::maxabs | ( | ) | [inline] |
Return absolute maximum value of the matrix.
Definition at line 1162 of file Matrix.cpp.
References Matrix3D< T >::size_x, Matrix3D< T >::size_y, and Matrix3D< T >::size_z.
T & Matrix3D< T >::operator() | ( | int | x, | |
int | y, | |||
int | z | |||
) | [inline] |
Return the (x,y,z) value of matrix.
Operator (x, y, z), returns value of element [x][y][z].
If DEBUG_MODE defined, check if matrix has been initialized.
Definition at line 851 of file Matrix.cpp.
References Matrix3D< T >::initialized, Matrix3D< T >::size_y, and Matrix3D< T >::size_z.
Referenced by Matrix3D< double >::Value().
Multiply each element of the matrix to corresponds element of matrix M.
Reimplemented in DiffusionCoefficient.
Definition at line 973 of file Matrix.cpp.
References Matrix3D< T >::size_x, Matrix3D< T >::size_y, and Matrix3D< T >::size_z.
Multiply eqach element of the matrix to Val.
Reimplemented in DiffusionCoefficient, and BoundaryCondition.
Definition at line 945 of file Matrix.cpp.
References Matrix3D< T >::size_x, Matrix3D< T >::size_y, and Matrix3D< T >::size_z.
Add each element of the matrix to corresponds element of matrix M.
Reimplemented in DiffusionCoefficient.
Definition at line 987 of file Matrix.cpp.
References Matrix3D< T >::size_x, Matrix3D< T >::size_y, and Matrix3D< T >::size_z.
Substract each element of the matrix to corresponds element of matrix M.
Definition at line 1001 of file Matrix.cpp.
References Matrix3D< T >::size_x, Matrix3D< T >::size_y, and Matrix3D< T >::size_z.
Divide each element of the matrix to corresponds element of matrix M.
Definition at line 959 of file Matrix.cpp.
References Matrix3D< T >::size_x, Matrix3D< T >::size_y, and Matrix3D< T >::size_z.
Divide each element of the matrix to Val.
Definition at line 931 of file Matrix.cpp.
References Matrix3D< T >::size_x, Matrix3D< T >::size_y, and Matrix3D< T >::size_z.
Makes Matrix equal to value Val.
Reimplemented in DiffusionCoefficient, DiffusionCoefficientsGroup, BoundaryCondition, and GridElement.
Definition at line 919 of file Matrix.cpp.
References Matrix3D< T >::size_x, Matrix3D< T >::size_y, and Matrix3D< T >::size_z.
Makes 3D matrix from 2D matrix.
The 3rd dimention makes equal to 1.
Definition at line 897 of file Matrix.cpp.
References Matrix3D< T >::AllocateMemory(), Matrix3D< T >::initialized, Matrix2D< T >::initialized, Matrix2D< T >::size_x, Matrix3D< T >::size_x, Matrix2D< T >::size_y, Matrix3D< T >::size_y, and Matrix3D< T >::size_z.
Makes matrix equal to Matrix M.
&M | - Matrix M. |
Reimplemented in DiffusionCoefficient, DiffusionCoefficientsGroup, and GridElement.
Definition at line 867 of file Matrix.cpp.
References Matrix3D< T >::AllocateMemory(), Matrix3D< T >::initialized, Matrix3D< T >::name, Matrix3D< T >::size_x, Matrix3D< T >::size_y, and Matrix3D< T >::size_z.
Referenced by Matrix3D< T >::Matrix3D().
T ** Matrix3D< T >::operator[] | ( | int | i | ) | [inline] |
Return the i-th pointer to 2d-array. Next [j][k] can be applied, so we have regular [i][j][k].
Operator [i], returns pointer to 2D array.
Next [j][k] can be applyed to return value. If DEBUG_MODE defined, check if matrix has been initialized.
i | - number of element to return |
Definition at line 825 of file Matrix.cpp.
References Matrix3D< T >::initialized.
void Matrix3D< T >::readFromFile | ( | string | filename, | |
Matrix3D< T > & | grid_x, | |||
Matrix3D< T > & | grid_y, | |||
Matrix3D< T > & | grid_z | |||
) | [inline] |
Read matrix data from file with grid.
Definition at line 1096 of file Matrix.cpp.
References Matrix3D< T >::initialized, Matrix3D< T >::size_x, Matrix3D< T >::size_y, and Matrix3D< T >::size_z.
void Matrix3D< T >::readFromFile | ( | string | filename | ) | [inline] |
Read matrix data from file.
Definition at line 1058 of file Matrix.cpp.
References Matrix3D< T >::initialized, Matrix3D< T >::size_x, Matrix3D< T >::size_y, and Matrix3D< T >::size_z.
Referenced by SourcesAndLosses::Initialize().
T& Matrix3D< T >::Value | ( | int | x, | |
int | y, | |||
int | z | |||
) | [inline] |
void Matrix3D< T >::writeToFile | ( | string | filename, | |
Matrix3D< T > & | grid_x, | |||
Matrix3D< T > & | grid_y, | |||
Matrix3D< T > & | grid_z | |||
) | [inline] |
Write matrix to file, using 3 other matrixes as a grid (simply - write all 4 matrixes to the file).
File has two header lines.
Definition at line 1036 of file Matrix.cpp.
References Matrix3D< T >::name, Matrix3D< T >::size_x, Matrix3D< T >::size_y, and Matrix3D< T >::size_z.
void Matrix3D< T >::writeToFile | ( | string | filename | ) | [inline] |
Write matrix to file.
File has two header lines.
Definition at line 1016 of file Matrix.cpp.
References Matrix3D< T >::name, Matrix3D< T >::size_x, Matrix3D< T >::size_y, and Matrix3D< T >::size_z.
Referenced by main().
Make x-slice of 3d matrix - 2d matrix.
Definition at line 1197 of file Matrix.cpp.
References Matrix3D< T >::name, Matrix2D< T >::name, Matrix3D< T >::size_y, and Matrix3D< T >::size_z.
Referenced by main(), and PSD::PSD().
Make y-slice of 3d matrix - 2d matrix.
Definition at line 1213 of file Matrix.cpp.
References Matrix3D< T >::name, Matrix2D< T >::name, Matrix3D< T >::size_x, and Matrix3D< T >::size_z.
Referenced by main().
Make z-slice of 3d matrix - 2d matrix.
Definition at line 1229 of file Matrix.cpp.
References Matrix3D< T >::name, Matrix2D< T >::name, Matrix3D< T >::size_x, and Matrix3D< T >::size_y.
Referenced by main().
string Matrix3D< T >::change_ind |
bool Matrix3D< T >::initialized |
Flag, equal true if initialized.
Definition at line 155 of file Matrix.h.
Referenced by Matrix3D< T >::AllocateMemory(), Matrix3D< double >::Matrix3D(), Matrix3D< T >::Matrix3D(), Matrix3D< T >::operator()(), Matrix3D< T >::operator=(), Matrix3D< T >::operator[](), Matrix3D< T >::readFromFile(), and Matrix3D< T >::~Matrix3D().
name of the Matrix
Definition at line 158 of file Matrix.h.
Referenced by main(), Matrix3D< T >::operator=(), Matrix3D< T >::writeToFile(), Matrix3D< T >::xSlice(), Matrix3D< T >::ySlice(), and Matrix3D< T >::zSlice().
Definition at line 157 of file Matrix.h.
Referenced by Matrix3D< T >::abs(), Matrix3D< T >::AllocateMemory(), Matrix3D< T >::max(), Matrix3D< T >::maxabs(), Matrix3D< T >::operator*(), Matrix3D< T >::operator+(), Matrix3D< T >::operator-(), Matrix3D< T >::operator/(), Matrix3D< T >::operator=(), Matrix3D< T >::readFromFile(), Matrix3D< T >::writeToFile(), Matrix3D< T >::ySlice(), Matrix3D< T >::zSlice(), and Matrix3D< T >::~Matrix3D().
Definition at line 157 of file Matrix.h.
Referenced by Matrix3D< T >::abs(), Matrix3D< T >::AllocateMemory(), Matrix3D< T >::index1d(), Matrix3D< T >::max(), Matrix3D< T >::maxabs(), Matrix3D< T >::operator()(), Matrix3D< T >::operator*(), Matrix3D< T >::operator+(), Matrix3D< T >::operator-(), Matrix3D< T >::operator/(), Matrix3D< T >::operator=(), Matrix3D< T >::readFromFile(), Matrix3D< T >::writeToFile(), Matrix3D< T >::xSlice(), Matrix3D< T >::zSlice(), and Matrix3D< T >::~Matrix3D().
size x, size y, size z
Definition at line 157 of file Matrix.h.
Referenced by Matrix3D< T >::abs(), Matrix3D< T >::AllocateMemory(), Matrix3D< T >::index1d(), Matrix3D< T >::max(), Matrix3D< T >::maxabs(), Matrix3D< T >::operator()(), Matrix3D< T >::operator*(), Matrix3D< T >::operator+(), Matrix3D< T >::operator-(), Matrix3D< T >::operator/(), Matrix3D< T >::operator=(), Matrix3D< T >::readFromFile(), Matrix3D< T >::writeToFile(), Matrix3D< T >::xSlice(), and Matrix3D< T >::ySlice().