VERB4D
MatrixSolver.h
Go to the documentation of this file.
1 
21 #ifndef MatrixSolver_H
22 #define MatrixSolver_H
23 
24 #include "Matrix.h"
25 
26 
27 void AddBoundary(DiagMatrix &Matrix_A, string type, int in, int id1, double dh);
28 
29 bool AddBoundaries_1D(
30  CalculationMatrix &matr_A, CalculationMatrix &matr_B, CalculationMatrix &matr_C,
32  int x_size,
33  double x_LBC, double x_UBC,
34  string x_LBC_type, string x_UBC_type,
35  int ix);
36 
37 bool AddBoundaries_2D(
38  CalculationMatrix &matr_A, CalculationMatrix &matr_B, CalculationMatrix &matr_C,
40  int x_size, int y_size,
43  string &x_LBC_type, string &x_UBC_type,
44  string &y_LBC_type, string &y_UBC_type,
45  int ix, int iy, int in);
46 
49  CalculationMatrix &matr_A, CalculationMatrix &matr_B, CalculationMatrix &matr_C,
51  int x_size, int y_size,
52  Matrix1D<double> &x_LBC, Matrix1D<double> &x_UBC,
53  Matrix1D<double> &y_LBC, Matrix1D<double> &y_UBC,
54  string x_LBC_type, string x_UBC_type,
55  string y_LBC_type, string y_UBC_type,
57  Matrix2D<double> &G, Matrix2D<double> Sources, Matrix2D<double> Losses, double dt);
58 
60 
61 
62 
63 
65  string FirstDerivative, string SecondDerivative,
66  Matrix1D<double> &x,
67  Matrix1D<double> &D,
68  Matrix1D<double> &G,
69  double multiplicator);
70 
71 
72 void GetDerivativeVector_2D(string derivativeType, int &dx, int &dy);
73 
75  int ix, int iy,
76  string FirstDerivative, string SecondDerivative,
77  Matrix2D<double> &x,
78  Matrix2D<double> &y,
79  Matrix2D<double> &D,
80  Matrix2D<double> &G,
81  double multiplicator);
82 
84  int ix, int iy,
85  string FirstDerivative, string SecondDerivative,
86  Matrix2D<double> &x,
87  Matrix2D<double> &y,
88  Matrix2D<double> &D,
89  Matrix2D<double> &G,
90  double multiplicator);
91 
93  int ix, int iy,
94  string FirstDerivative, string SecondDerivative,
95  Matrix2D<double> &x,
96  Matrix2D<double> &y,
97  Matrix2D<double> &Coef1,
98  Matrix2D<double> &Coef2,
99  double multiplicator
100  );
101 
103  int ix, int iy,
104  string FirstDerivative, string SecondDerivative,
105  Matrix2D<double> &x,
106  Matrix2D<double> &y,
107  Matrix2D<double> &Coef1,
108  Matrix2D<double> &Coef2,
109  double multiplicator
110  );
111 
112 
114 bool tridag(double a[], double b[], double c[], double r[], double u[], long n);
115 
117 extern "C" {
118  //extern void dgesv_(int *,int *,double *,int *,int*,double *,int*,int*);
119  //extern void sgesv_(int *,int *,float *,int *,int*, float *,int*,int*);
120  extern void dgbsv_(long int *n, long int *kl, long int *ku, long int *nrhs, double *ab, long int *ldab, long int *ipiv, double *b, long int *ldb, long int *info);
121 };
122 
123 
126  int x_size, int y_size,
127  Matrix1D<double> x_LBC, Matrix1D<double> x_UBC,
128  Matrix1D<double> y_LBC, Matrix1D<double> y_UBC,
129  string x_LBC_type, string x_UBC_type,
130  string y_LBC_type, string y_UBC_type,
132  Matrix2D<double> &G, double dt);
133 
136  int x_size, int y_size,
137  Matrix1D<double> x_LBC, Matrix1D<double> x_UBC,
138  Matrix1D<double> y_LBC, Matrix1D<double> y_UBC,
139  string x_LBC_type, string x_UBC_type,
140  string y_LBC_type, string y_UBC_type,
142  Matrix2D<double> &G, double dt);
143 
146  int x_size, int y_size,
147  Matrix1D<double> x_LBC, Matrix1D<double> x_UBC,
148  Matrix1D<double> y_LBC, Matrix1D<double> y_UBC,
149  string x_LBC_type, string x_UBC_type,
150  string y_LBC_type, string y_UBC_type,
152  Matrix2D<double> &G, double dt);
153 
156  int x_size, int y_size,
157  Matrix1D<double> x_LBC, Matrix1D<double> x_UBC,
158  Matrix1D<double> y_LBC, Matrix1D<double> y_UBC,
159  string x_LBC_type, string x_UBC_type,
160  string y_LBC_type, string y_UBC_type,
162  Matrix2D<double> &G, double dt);
163 
166  int x_size, int y_size,
167  Matrix1D<double> x_LBC, Matrix1D<double> x_UBC,
168  Matrix1D<double> y_LBC, Matrix1D<double> y_UBC,
169  string x_LBC_type, string x_UBC_type,
170  string y_LBC_type, string y_UBC_type,
172  Matrix2D<double> &G, double dt);
173 
176  int x_size, int y_size,
177  Matrix1D<double> x_LBC, Matrix1D<double> x_UBC,
178  Matrix1D<double> y_LBC, Matrix1D<double> y_UBC,
179  string x_LBC_type, string x_UBC_type,
180  string y_LBC_type, string y_UBC_type,
182  Matrix2D<double> &G, double dt);
183 
184 #endif
185 
void AnySecondDerivativeApproximation_2D(CalculationMatrix &matr_A, int ix, int iy, string FirstDerivative, string SecondDerivative, Matrix2D< double > &x, Matrix2D< double > &y, Matrix2D< double > &Coef1, Matrix2D< double > &Coef2, double multiplicator)
Definition: MatrixSolver.cpp:1322
Matrix 1D, 2D, 3D and 4D and operations with them.
bool MakeModelMatrix_2D_ADI3_y(CalculationMatrix &matr_A, CalculationMatrix &matr_B, CalculationMatrix &matr_C, Matrix2D< double > &x, Matrix2D< double > &y, int x_size, int y_size, Matrix1D< double > x_LBC, Matrix1D< double > x_UBC, Matrix1D< double > y_LBC, Matrix1D< double > y_UBC, string x_LBC_type, string x_UBC_type, string y_LBC_type, string y_UBC_type, Matrix2D< double > &Dxx, Matrix2D< double > &Dyy, Matrix2D< double > &Dxy, Matrix2D< double > &Dyx, Matrix2D< double > &G, double dt)
THIS FUNCTION IS CURRENTLY NOT BEING USED.
Definition: MatrixSolver.cpp:891
bool tridag(double a[], double b[], double c[], double r[], double u[], long n)
Solve the AU=R system of equations, where A - tridiagonal matrix nxn with diagonals a[]...
Definition: MatrixSolver.cpp:1445
void AnySecondDerivativeApproximation_2D_y(CalculationMatrix &matr_A, int ix, int iy, string FirstDerivative, string SecondDerivative, Matrix2D< double > &x, Matrix2D< double > &y, Matrix2D< double > &Coef1, Matrix2D< double > &Coef2, double multiplicator)
Definition: MatrixSolver.cpp:1379
bool MakeModelMatrix_2D_ADI3_x(CalculationMatrix &matr_A, CalculationMatrix &matr_B, CalculationMatrix &matr_C, Matrix2D< double > &x, Matrix2D< double > &y, int x_size, int y_size, Matrix1D< double > x_LBC, Matrix1D< double > x_UBC, Matrix1D< double > y_LBC, Matrix1D< double > y_UBC, string x_LBC_type, string x_UBC_type, string y_LBC_type, string y_UBC_type, Matrix2D< double > &Dxx, Matrix2D< double > &Dyy, Matrix2D< double > &Dxy, Matrix2D< double > &Dyx, Matrix2D< double > &G, double dt)
THIS FUNCTION IS CURRENTLY NOT BEING USED.
Definition: MatrixSolver.cpp:760
void SecondDerivativeApproximation_2D_y(CalculationMatrix &matr_A, int ix, int iy, string FirstDerivative, string SecondDerivative, Matrix2D< double > &x, Matrix2D< double > &y, Matrix2D< double > &D, Matrix2D< double > &G, double multiplicator)
Definition: MatrixSolver.cpp:1264
bool MakeModelMatrix_2D_ADI1_y(CalculationMatrix &matr_A, CalculationMatrix &matr_B, CalculationMatrix &matr_C, Matrix2D< double > &x, Matrix2D< double > &y, int x_size, int y_size, Matrix1D< double > x_LBC, Matrix1D< double > x_UBC, Matrix1D< double > y_LBC, Matrix1D< double > y_UBC, string x_LBC_type, string x_UBC_type, string y_LBC_type, string y_UBC_type, Matrix2D< double > &Dxx, Matrix2D< double > &Dyy, Matrix2D< double > &Dxy, Matrix2D< double > &Dyx, Matrix2D< double > &G, double dt)
THIS FUNCTION IS CURRENTLY NOT BEING USED.
Definition: MatrixSolver.cpp:335
A matrix used primarily for diagonalized calculations.
Definition: Matrix.h:472
A matrix of 1 dimensions that is immutable.
Definition: Matrix.h:49
bool AddBoundaries_1D(CalculationMatrix &matr_A, CalculationMatrix &matr_B, CalculationMatrix &matr_C, Matrix1D< double > &x, int x_size, double x_LBC, double x_UBC, string x_LBC_type, string x_UBC_type, int ix)
Definition: MatrixSolver.cpp:63
void dgbsv_(long int *n, long int *kl, long int *ku, long int *nrhs, double *ab, long int *ldab, long int *ipiv, double *b, long int *ldb, long int *info)
Lapack function for matrix inversion declaration.
Diagonals of matrix stored as map (diagonal number, 1d diagonal array)
void SecondDerivativeApproximation_1D(CalculationMatrix &matr_A, int ix, string FirstDerivative, string SecondDerivative, Matrix1D< double > &x, Matrix1D< double > &D, Matrix1D< double > &G, double multiplicator)
Definition: MatrixSolver.cpp:1109
A matrix of 2 dimensions that is immutable.
Definition: Matrix.h:139
void SecondDerivativeApproximation_2D(CalculationMatrix &matr_A, int ix, int iy, string FirstDerivative, string SecondDerivative, Matrix2D< double > &x, Matrix2D< double > &y, Matrix2D< double > &D, Matrix2D< double > &G, double multiplicator)
Definition: MatrixSolver.cpp:1195
void AddBoundary(DiagMatrix &Matrix_A, string type, int in, int id1, double dh)
Definition: MatrixSolver.cpp:43
bool AddBoundaries_2D(CalculationMatrix &matr_A, CalculationMatrix &matr_B, CalculationMatrix &matr_C, Matrix2D< double > &x, Matrix2D< double > &y, int x_size, int y_size, Matrix1D< double > x_LBC, Matrix1D< double > x_UBC, Matrix1D< double > y_LBC, Matrix1D< double > y_UBC, string &x_LBC_type, string &x_UBC_type, string &y_LBC_type, string &y_UBC_type, int ix, int iy, int in)
Definition: MatrixSolver.cpp:123
void GetDerivativeVector_2D(string derivativeType, int &dx, int &dy)
Definition: MatrixSolver.cpp:1169
bool MakeModelMatrix_2D_ADI2_x(CalculationMatrix &matr_A, CalculationMatrix &matr_B, CalculationMatrix &matr_C, Matrix2D< double > &x, Matrix2D< double > &y, int x_size, int y_size, Matrix1D< double > x_LBC, Matrix1D< double > x_UBC, Matrix1D< double > y_LBC, Matrix1D< double > y_UBC, string x_LBC_type, string x_UBC_type, string y_LBC_type, string y_UBC_type, Matrix2D< double > &Dxx, Matrix2D< double > &Dyy, Matrix2D< double > &Dxy, Matrix2D< double > &Dyx, Matrix2D< double > &G, double dt)
THIS FUNCTION IS CURRENTLY NOT BEING USED.
Definition: MatrixSolver.cpp:448
bool MakeModelMatrix_2D(CalculationMatrix &matr_A, CalculationMatrix &matr_B, CalculationMatrix &matr_C, Matrix2D< double > &x, Matrix2D< double > &y, int x_size, int y_size, Matrix1D< double > &x_LBC, Matrix1D< double > &x_UBC, Matrix1D< double > &y_LBC, Matrix1D< double > &y_UBC, string x_LBC_type, string x_UBC_type, string y_LBC_type, string y_UBC_type, Matrix2D< double > &Dxx, Matrix2D< double > &Dyy, Matrix2D< double > &Dxy, Matrix2D< double > &Dyx, Matrix2D< double > &G, Matrix2D< double > Sources, Matrix2D< double > Losses, double dt)
FUNCITON NOT IMPLEMENTED.
bool MakeModelMatrix_2D_ADI1_x(CalculationMatrix &matr_A, CalculationMatrix &matr_B, CalculationMatrix &matr_C, Matrix2D< double > &x, Matrix2D< double > &y, int x_size, int y_size, Matrix1D< double > x_LBC, Matrix1D< double > x_UBC, Matrix1D< double > y_LBC, Matrix1D< double > y_UBC, string x_LBC_type, string x_UBC_type, string y_LBC_type, string y_UBC_type, Matrix2D< double > &Dxx, Matrix2D< double > &Dyy, Matrix2D< double > &Dxy, Matrix2D< double > &Dyx, Matrix2D< double > &G, double dt)
THIS FUNCTION IS CURRENTLY NOT BEING USED.
Definition: MatrixSolver.cpp:225
void Lapack(DiagMatrix &A, Matrix1D< double > &B, Matrix1D< double > &X)
Definition: MatrixSolver.cpp:1018
bool MakeModelMatrix_2D_ADI2_y(CalculationMatrix &matr_A, CalculationMatrix &matr_B, CalculationMatrix &matr_C, Matrix2D< double > &x, Matrix2D< double > &y, int x_size, int y_size, Matrix1D< double > x_LBC, Matrix1D< double > x_UBC, Matrix1D< double > y_LBC, Matrix1D< double > y_UBC, string x_LBC_type, string x_UBC_type, string y_LBC_type, string y_UBC_type, Matrix2D< double > &Dxx, Matrix2D< double > &Dyy, Matrix2D< double > &Dxy, Matrix2D< double > &Dyx, Matrix2D< double > &G, double dt)
THIS FUNCTION IS CURRENTLY NOT BEING USED.
Definition: MatrixSolver.cpp:604