Matrix3D< T > Class Template Reference

Matrix 3D class. More...

#include <Matrix.h>

Collaboration diagram for Matrix3D< T >:

Collaboration graph
[legend]

List of all members.

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.
max ()
 Return maximum value of the matrix.
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)
Matrix3Doperator= (const Matrix3D< T > &M)
 Makes matrix equal to Matrix M.
Matrix3Doperator= (Matrix2D< T > &M)
 Makes 3D matrix from 2D matrix.
Matrix3Doperator= (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


Detailed Description

template<typename T>
class Matrix3D< T >

Matrix 3D class.

Matrixes and operations.

Definition at line 147 of file Matrix.h.


Constructor & Destructor Documentation

template<typename T>
Matrix3D< T >::Matrix3D (  )  [inline]

Default constructor. Do nothing.

Definition at line 165 of file Matrix.h.

Referenced by DiffusionCoefficient::operator*(), BoundaryCondition::operator*(), and DiffusionCoefficient::operator+().

Here is the caller graph for this function:

template<class T>
Matrix3D< T >::Matrix3D ( const Matrix3D< T > &  M  )  [inline]

Constructor.

Create matrix equal to Matrix M.

Parameters:
&M - Matrix M.

Definition at line 776 of file Matrix.cpp.

References Matrix3D< T >::initialized, and Matrix3D< T >::operator=().

Here is the call graph for this function:

template<class T>
Matrix3D< T >::Matrix3D ( int  x_size,
int  y_size,
int  z_size 
) [inline]

Constructor.

Allocate memory.

Definition at line 763 of file Matrix.cpp.

References Matrix3D< T >::AllocateMemory(), and Matrix3D< T >::initialized.

Here is the call graph for this function:

template<class T >
Matrix3D< T >::~Matrix3D (  )  [inline]

Destructor.

Definition at line 785 of file Matrix.cpp.

References Matrix3D< T >::initialized, Matrix3D< T >::size_x, and Matrix3D< T >::size_y.


Member Function Documentation

template<class T >
Matrix3D< T > Matrix3D< T >::abs (  )  [inline]

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.

template<class T >
void Matrix3D< T >::AllocateMemory ( int  x_size,
int  y_size,
int  z_size 
) [inline]

Alocating memory and filling it with zero-valiues.

Todo:
Do not fill initialized matrix with zeros.

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=().

Here is the caller graph for this function:

template<class T >
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.

template<class T >
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().

Here is the caller graph for this function:

template<class T >
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.

template<class T >
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().

Here is the caller graph for this function:

template<class T>
Matrix3D< T > Matrix3D< T >::operator* ( Matrix3D< T > &  M  )  [inline]

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.

template<class T>
Matrix3D< T > Matrix3D< T >::operator* ( Val  )  [inline]

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.

template<class T>
Matrix3D< T > Matrix3D< T >::operator+ ( Matrix3D< T > &  M  )  [inline]

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.

template<class T>
Matrix3D< T > Matrix3D< T >::operator- ( Matrix3D< T > &  M  )  [inline]

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.

template<class T>
Matrix3D< T > Matrix3D< T >::operator/ ( Matrix3D< T > &  M  )  [inline]

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.

template<class T>
Matrix3D< T > Matrix3D< T >::operator/ ( Val  )  [inline]

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.

template<class T>
Matrix3D< T > & Matrix3D< T >::operator= ( Val  )  [inline]

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.

template<class T>
Matrix3D< T > & Matrix3D< T >::operator= ( Matrix2D< T > &  M  )  [inline]

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.

Here is the call graph for this function:

template<class T>
Matrix3D< T > & Matrix3D< T >::operator= ( const Matrix3D< T > &  M  )  [inline]

Makes matrix equal to Matrix M.

Parameters:
&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().

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T >
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.

Parameters:
i - number of element to return

Definition at line 825 of file Matrix.cpp.

References Matrix3D< T >::initialized.

template<class T>
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.

template<class T >
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().

Here is the caller graph for this function:

template<typename T>
T& Matrix3D< T >::Value ( int  x,
int  y,
int  z 
) [inline]

Definition at line 186 of file Matrix.h.

template<class T>
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.

template<class T >
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().

Here is the caller graph for this function:

template<class T >
Matrix2D< T > Matrix3D< T >::xSlice ( int  p_x  )  [inline]

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().

Here is the caller graph for this function:

template<class T >
Matrix2D< T > Matrix3D< T >::ySlice ( int  p_y  )  [inline]

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().

Here is the caller graph for this function:

template<class T >
Matrix2D< T > Matrix3D< T >::zSlice ( int  p_z  )  [inline]

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().

Here is the caller graph for this function:


Member Data Documentation

template<typename T>
string Matrix3D< T >::change_ind

Variables useful for changes tracking.

Definition at line 156 of file Matrix.h.

template<typename T>
bool Matrix3D< T >::initialized

template<typename T>
string Matrix3D< T >::name

template<typename T>
int Matrix3D< T >::size_x

template<typename T>
int Matrix3D< T >::size_y

template<typename T>
int Matrix3D< T >::size_z


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

Generated on Thu May 27 11:53:19 2010 for VERB_CODE_2.0 by  doxygen 1.5.9