/[escript]/trunk/paso/src/SparseMatrix.h
ViewVC logotype

Contents of /trunk/paso/src/SparseMatrix.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3005 - (show annotations)
Thu Apr 22 05:59:31 2010 UTC (9 years, 5 months ago) by gross
File MIME type: text/plain
File size: 5297 byte(s)
early call of setPreconditioner in FCT solver removed.
1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2010 by University of Queensland
5 * Earth Systems Science Computational Center (ESSCC)
6 * http://www.uq.edu.au/esscc
7 *
8 * Primary Business: Queensland, Australia
9 * Licensed under the Open Software License version 3.0
10 * http://www.opensource.org/licenses/osl-3.0.php
11 *
12 *******************************************************/
13
14
15 /**************************************************************/
16
17 /* Paso: SparseMatrix and SystemVector */
18
19 /**************************************************************/
20
21 /* Author: lgross@uq.edu.au */
22
23 /**************************************************************/
24
25 #ifndef INC_PASO_SPARSEMATRIX
26 #define INC_PASO_SPARSEMATRIX
27
28 #include "Common.h"
29 #include "Pattern.h"
30 #include "Options.h"
31 #include "Paso.h"
32
33 /**************************************************************/
34
35 /* this struct holds a stiffness matrix: */
36
37 #define MATRIX_FORMAT_DEFAULT 0
38 #define MATRIX_FORMAT_CSC 1
39 #define MATRIX_FORMAT_SYM 2
40 #define MATRIX_FORMAT_BLK1 4
41 #define MATRIX_FORMAT_OFFSET1 8
42 #define MATRIX_FORMAT_TRILINOS_CRS 16
43
44 typedef int Paso_SparseMatrixType;
45
46 typedef struct Paso_SparseMatrix {
47 Paso_SparseMatrixType type;
48 dim_t reference_counter;
49
50 dim_t row_block_size;
51 dim_t col_block_size;
52 dim_t block_size;
53
54 dim_t numRows;
55 dim_t numCols;
56 Paso_Pattern* pattern;
57 dim_t len;
58
59 double *val; /* this is used for classical CSR or CSC */
60 void* solver;
61 } Paso_SparseMatrix;
62
63 /* interfaces: */
64
65 Paso_SparseMatrix* Paso_SparseMatrix_alloc(Paso_SparseMatrixType,Paso_Pattern*,dim_t,dim_t,const bool_t);
66 Paso_SparseMatrix* Paso_SparseMatrix_getReference(Paso_SparseMatrix*);
67 void Paso_SparseMatrix_free(Paso_SparseMatrix*);
68 void Paso_SparseMatrix_MatrixVector_CSC_OFFSET0(const double alpha, const Paso_SparseMatrix* A, const double* in, const double beta, double* out);
69 void Paso_SparseMatrix_MatrixVector_CSC_OFFSET1(const double alpha, const Paso_SparseMatrix* A, const double* in, const double beta, double* out);
70 void Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(const double alpha, const Paso_SparseMatrix* A, const double* in, const double beta, double* out);
71 void Paso_SparseMatrix_MatrixVector_CSR_OFFSET1(const double alpha, const Paso_SparseMatrix* A, const double* in, const double beta, double* out);
72 void Paso_SparseMatrix_copy(Paso_SparseMatrix*,double*);
73 void Paso_SparseMatrix_addAbsRow_CSR_OFFSET0(Paso_SparseMatrix*,double*);
74 void Paso_SparseMatrix_addRow_CSR_OFFSET0(Paso_SparseMatrix*,double*);
75 void Paso_SparseMatrix_nullifyRowsAndCols_CSC_BLK1(Paso_SparseMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value);
76 void Paso_SparseMatrix_nullifyRowsAndCols_CSR_BLK1(Paso_SparseMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value);
77 void Paso_SparseMatrix_nullifyRowsAndCols_CSC(Paso_SparseMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value);
78 void Paso_SparseMatrix_nullifyRowsAndCols_CSR(Paso_SparseMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value);
79 void Paso_SparseMatrix_nullifyRows_CSR_BLK1(Paso_SparseMatrix* A, double* mask_row, double main_diagonal_value);
80 void Paso_SparseMatrix_saveHB_CSC(Paso_SparseMatrix *, FILE*);
81 Paso_SparseMatrix* Paso_SparseMatrix_getSubmatrix(Paso_SparseMatrix* A,dim_t,dim_t,index_t*,index_t*);
82 Paso_SparseMatrix* Paso_SparseMatrix_getBlock(Paso_SparseMatrix* A, int blockid);
83
84 Paso_SparseMatrix* Paso_SparseMatrix_getProlongation(Paso_SparseMatrix* W, index_t* mis_marker);
85 Paso_SparseMatrix* Paso_SparseMatrix_getRestriction(Paso_SparseMatrix* P);
86 void Paso_SparseMatrix_updateWeights(Paso_SparseMatrix* A,Paso_SparseMatrix* W_FC, index_t* mis_marker);
87 Paso_SparseMatrix* Paso_Solver_getCoarseMatrix(Paso_SparseMatrix *A, Paso_SparseMatrix *R, Paso_SparseMatrix *P);
88 Paso_SparseMatrix* Paso_SparseMatrix_MatrixMatrix(Paso_SparseMatrix* A, Paso_SparseMatrix* B);
89
90 void Paso_SparseMatrix_setValues(Paso_SparseMatrix*,double);
91 void Paso_SparseMatrix_saveMM_CSC(Paso_SparseMatrix *, FILE *);
92 void Paso_SparseMatrix_MatrixVector_CSR_OFFSET0_stripe(const double alpha, const dim_t nRows, const dim_t row_block_size, const dim_t col_block_size, const index_t* ptr, const index_t* index, const double* val, const double* in, const double beta, double* out);
93 Paso_SparseMatrix* Paso_SparseMatrix_loadMM_toCSR( char *fileName_p );
94 void Paso_SparseMatrix_saveMM(Paso_SparseMatrix * A_p, char * fileName_p);
95 void Paso_SparseMatrix_nullifyRows_CSR(Paso_SparseMatrix*, double*, double);
96 index_t* Paso_SparseMatrix_borrowMainDiagonalPointer(Paso_SparseMatrix * A_p);
97 void Paso_SparseMatrix_copyFromMainDiagonal(Paso_SparseMatrix * A_p, double* out);
98 void Paso_SparseMatrix_copyToMainDiagonal(Paso_SparseMatrix * A_p, const double* in);
99 void Paso_SparseMatrix_copyBlockFromMainDiagonal(Paso_SparseMatrix * A_p, double* out);
100 void Paso_SparseMatrix_copyBlockToMainDiagonal(Paso_SparseMatrix * A_p, const double* in);
101 /*
102 void Paso_SparseMatrix_add(Paso_SparseMatrix*,dim_t,index_t*, dim_t,dim_t,index_t*,dim_t, double*);
103 Paso_SparseMatrix* Paso_SparseMatrix_loadMM_toCSR(char *);
104 void Paso_Solver_getCoarseMatrix(Paso_SparseMatrix* A_c, Paso_SparseMatrix* A,Paso_SparseMatrix *R,Paso_SparseMatrix *P);
105 */
106
107 #endif /* #ifndef INC_PASO_SPARSEMATRIX */
108

  ViewVC Help
Powered by ViewVC 1.1.26