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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2240 - (hide annotations)
Wed Feb 4 01:17:06 2009 UTC (10 years, 8 months ago) by artak
File MIME type: text/plain
File size: 4072 byte(s)
Some statistical print outs are added in solver and loadMM to Paso_SparseMatrix method is added
1 ksteube 1313
2     /*******************************************************
3 ksteube 1811 *
4     * Copyright (c) 2003-2008 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 ksteube 1313
14 ksteube 1811
15 ksteube 1313 /**************************************************************/
16    
17     /* Paso: SparseMatrix and SystemVector */
18    
19     /**************************************************************/
20    
21 gross 1363 /* Author: lgross@uq.edu.au */
22 ksteube 1313
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     double *val; /* this is used for classical CSR or CSC */
59     } Paso_SparseMatrix;
60    
61     /* interfaces: */
62    
63     Paso_SparseMatrix* Paso_SparseMatrix_alloc(Paso_SparseMatrixType,Paso_Pattern*,dim_t,dim_t);
64     Paso_SparseMatrix* Paso_SparseMatrix_getReference(Paso_SparseMatrix*);
65     void Paso_SparseMatrix_free(Paso_SparseMatrix*);
66 gross 1639 void Paso_SparseMatrix_MatrixVector_CSC_OFFSET0(const double alpha, const Paso_SparseMatrix* A, const double* in, const double beta, double* out);
67 phornby 1642 void Paso_SparseMatrix_MatrixVector_CSC_OFFSET1(const double alpha, const Paso_SparseMatrix* A, const double* in, const double beta, double* out);
68     void Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(const double alpha, const Paso_SparseMatrix* A, const double* in, const double beta, double* out);
69     void Paso_SparseMatrix_MatrixVector_CSR_OFFSET1(const double alpha, const Paso_SparseMatrix* A, const double* in, const double beta, double* out);
70 ksteube 1313 void Paso_SparseMatrix_copy(Paso_SparseMatrix*,double*);
71     void Paso_SparseMatrix_addAbsRow_CSR_OFFSET0(Paso_SparseMatrix*,double*);
72 gross 1363 void Paso_SparseMatrix_addRow_CSR_OFFSET0(Paso_SparseMatrix*,double*);
73 ksteube 1313 void Paso_SparseMatrix_nullifyRowsAndCols_CSC_BLK1(Paso_SparseMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value);
74     void Paso_SparseMatrix_nullifyRowsAndCols_CSR_BLK1(Paso_SparseMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value);
75     void Paso_SparseMatrix_nullifyRowsAndCols_CSC(Paso_SparseMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value);
76     void Paso_SparseMatrix_nullifyRowsAndCols_CSR(Paso_SparseMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value);
77 gross 1417 void Paso_SparseMatrix_nullifyRows_CSR_BLK1(Paso_SparseMatrix* A, double* mask_row, double main_diagonal_value);
78 ksteube 1313 void Paso_SparseMatrix_saveHB_CSC(Paso_SparseMatrix *, FILE*);
79     Paso_SparseMatrix* Paso_SparseMatrix_getSubmatrix(Paso_SparseMatrix* A,dim_t,dim_t,index_t*,index_t*);
80     void Paso_SparseMatrix_setValues(Paso_SparseMatrix*,double);
81     void Paso_SparseMatrix_saveMM_CSC(Paso_SparseMatrix *, FILE *);
82 gross 1639 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);
83 artak 2240 Paso_SparseMatrix* Paso_SparseMatrix_loadMM_toCSR( char *fileName_p );
84     void Paso_SparseMatrix_saveMM(Paso_SparseMatrix * A_p, char * fileName_p);
85 gross 1361
86 ksteube 1313 /*
87     void Paso_SparseMatrix_add(Paso_SparseMatrix*,dim_t,index_t*, dim_t,dim_t,index_t*,dim_t, double*);
88     Paso_SparseMatrix* Paso_SparseMatrix_loadMM_toCSR(char *);
89     */
90    
91     #endif /* #ifndef INC_PASO_SPARSEMATRIX */
92    

  ViewVC Help
Powered by ViewVC 1.1.26