00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef INC_PASO_SYSTEMMATRIX
00027 #define INC_PASO_SYSTEMMATRIX
00028
00029 #include "Common.h"
00030 #include "SparseMatrix.h"
00031 #include "SystemMatrixPattern.h"
00032 #include "Options.h"
00033 #include "Paso_MPI.h"
00034 #include "Paso.h"
00035 #include "Coupler.h"
00036
00037
00038
00039
00040
00041
00042 #define MATRIX_FORMAT_DEFAULT 0
00043 #define MATRIX_FORMAT_CSC 1
00044 #define MATRIX_FORMAT_SYM 2
00045 #define MATRIX_FORMAT_BLK1 4
00046 #define MATRIX_FORMAT_OFFSET1 8
00047 #define MATRIX_FORMAT_TRILINOS_CRS 16
00048
00049 typedef int Paso_SystemMatrixType;
00050
00051 typedef struct Paso_SystemMatrix {
00052 Paso_SystemMatrixType type;
00053 Paso_SystemMatrixPattern *pattern;
00054
00055 dim_t reference_counter;
00056
00057 dim_t logical_row_block_size;
00058 dim_t logical_col_block_size;
00059
00060 dim_t row_block_size;
00061 dim_t col_block_size;
00062 dim_t block_size;
00063
00064 Paso_Distribution *row_distribution;
00065 Paso_Distribution *col_distribution;
00066 Paso_MPIInfo *mpi_info;
00067
00068 Paso_Coupler* col_coupler;
00069 Paso_Coupler* row_coupler;
00070
00071 Paso_SparseMatrix* mainBlock;
00072 Paso_SparseMatrix* col_coupleBlock;
00073 Paso_SparseMatrix* row_coupleBlock;
00074 bool_t normalizer_is_valid;
00075 double *normalizer;
00076 index_t solver_package;
00077 void* solver;
00078
00079
00080 void *trilinos_data;
00081
00082 } Paso_SystemMatrix;
00083
00084
00085
00086 Paso_SystemMatrix* Paso_SystemMatrix_alloc(Paso_SystemMatrixType,Paso_SystemMatrixPattern*,dim_t,dim_t, const bool_t patternIsUnrolled);
00087 Paso_SystemMatrix* Paso_SystemMatrix_getReference(Paso_SystemMatrix*);
00088 void Paso_SystemMatrix_free(Paso_SystemMatrix*);
00089
00090 void Paso_SystemMatrix_MatrixVector(const double alpha, Paso_SystemMatrix* A, const double* in, const double beta, double* out);
00091 void Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(double alpha, Paso_SystemMatrix* A, const double* in, const double beta, double* out);
00092 void Paso_solve(Paso_SystemMatrix* A, double* out, double* in, Paso_Options* options);
00093 void Paso_solve_free(Paso_SystemMatrix* in);
00094 void Paso_SystemMatrix_startCollect(Paso_SystemMatrix* A,const double* in);
00095 double* Paso_SystemMatrix_finishCollect(Paso_SystemMatrix* A);
00096 void Paso_SystemMatrix_startColCollect(Paso_SystemMatrix* A,const double* in);
00097 double* Paso_SystemMatrix_finishColCollect(Paso_SystemMatrix* A);
00098 void Paso_SystemMatrix_startRowCollect(Paso_SystemMatrix* A,const double* in);
00099 double* Paso_SystemMatrix_finishRowCollect(Paso_SystemMatrix* A);
00100 void Paso_SystemMatrix_nullifyRowsAndCols(Paso_SystemMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value);
00101 double* Paso_SystemMatrix_borrowNormalization(Paso_SystemMatrix* A);
00102 dim_t Paso_SystemMatrix_getTotalNumRows(const Paso_SystemMatrix* A);
00103 dim_t Paso_SystemMatrix_getTotalNumCols(const Paso_SystemMatrix*);
00104 dim_t Paso_SystemMatrix_getGlobalNumRows(Paso_SystemMatrix*);
00105 dim_t Paso_SystemMatrix_getGlobalNumCols(Paso_SystemMatrix*);
00106
00107 void Paso_SystemMatrix_saveMM(Paso_SystemMatrix *, char *);
00108 void Paso_SystemMatrix_saveHB(Paso_SystemMatrix *, char *);
00109 Paso_SystemMatrix* Paso_SystemMatrix_loadMM_toCSR(char *);
00110 Paso_SystemMatrix* Paso_SystemMatrix_loadMM_toCSC(char *);
00111 void Paso_RHS_loadMM_toCSR( char *fileName_p, double *b, dim_t size);
00112 void Paso_SystemMatrix_setDefaults(Paso_Options*);
00113 int Paso_SystemMatrix_getSystemMatrixTypeId(const index_t solver,const index_t preconditioner, const index_t package,const bool_t symmetry, Paso_MPIInfo *mpi_info);
00114 dim_t Paso_SystemMatrix_getNumOutput(Paso_SystemMatrix* A);
00115 void Paso_SystemMatrix_setValues(Paso_SystemMatrix*,double);
00116 void Paso_SystemMatrix_add(Paso_SystemMatrix*,dim_t,index_t*, dim_t,dim_t,index_t*,dim_t, double*);
00117 void Paso_SystemMatrix_rowSum(Paso_SystemMatrix* A, double* row_sum);
00118 void Paso_SystemMatrix_nullifyRows(Paso_SystemMatrix* A, double* mask_row, double main_diagonal_value);
00119 void Paso_SparseMatrix_nullifyRows_CSR(Paso_SparseMatrix*, double*, double);
00120
00121
00122 #endif
00123