/[escript]/branches/escript3047_with_pastix2995/paso/src/SystemMatrix_MatrixVector.c
ViewVC logotype

Contents of /branches/escript3047_with_pastix2995/paso/src/SystemMatrix_MatrixVector.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3049 - (show annotations)
Fri Jun 25 04:20:29 2010 UTC (8 years, 10 months ago) by lgao
File MIME type: text/plain
File size: 4483 byte(s)
Add direct solver pastix 2995. Currently works for single MPI rank only. For jobs with more than 1 MPI rank, the structure "coupleBlock" in "SystemMatrix" is not ready yet. 


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: matrix vector product with sparse matrix */
18
19 /**************************************************************/
20
21 /* Copyrights by ACcESS Australia 2003,2004,2005 */
22 /* Author: Lutz Gross, l.gross@uq.edu.au */
23
24 /**************************************************************/
25
26 #include "Paso.h"
27 #include "SystemMatrix.h"
28
29 /**************************************************************************/
30
31 /* raw scaled vector update operation: out = alpha * A * in + beta * out */
32
33
34 void Paso_SystemMatrix_MatrixVector(const double alpha,
35 Paso_SystemMatrix* A,
36 const double* in,
37 const double beta,
38 double* out) {
39
40 /*double *snd_buffer=NULL, *rcv_buffer=NULL;*/
41 Paso_MPIInfo *mpi_info=A->mpi_info;
42
43 if (A->type & MATRIX_FORMAT_CSC) {
44 if (A->type & MATRIX_FORMAT_OFFSET1) {
45 Paso_SystemMatrix_MatrixVector_CSC_OFFSET1(alpha,A,in,beta,out);
46 } else {
47 if (mpi_info->size>1) {
48 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: CSC with index 0 is not supported by MPI.");
49 return;
50 } else {
51 Paso_SparseMatrix_MatrixVector_CSC_OFFSET0(alpha,A->mainBlock,in,beta,out);
52 }
53 /* if ( mpi_info->size>1) {
54 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: CSC is not supported by MPI.");
55 return;
56 } else {
57 if (A->type & MATRIX_FORMAT_OFFSET1) {
58 Paso_SparseMatrix_MatrixVector_CSC_OFFSET1(alpha,A->mainBlock,in,beta,out);
59 } else {
60 Paso_SparseMatrix_MatrixVector_CSC_OFFSET0(alpha,A->mainBlock,in,beta,out);
61 } */
62 }
63 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
64 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: TRILINOS is not supported with MPI.");
65 return;
66 } else {
67 if (A->type & MATRIX_FORMAT_OFFSET1) {
68 if ( mpi_info->size>1) {
69 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: CSR with index 1 is not supported by MPI.");
70 return;
71 } else {
72 Paso_SparseMatrix_MatrixVector_CSR_OFFSET1(alpha,A->mainBlock,in,beta,out);
73 }
74 } else {
75 if (Paso_noError()) {
76 Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(alpha,A,in,beta,out);
77 }
78 }
79 }
80 }
81
82 void Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(double alpha,
83 Paso_SystemMatrix* A,
84 const double* in,
85 const double beta,
86 double* out)
87 {
88 double *remote_values=NULL;
89 /* start exchange */
90 Paso_SystemMatrix_startCollect(A,in);
91 /* process main block */
92 Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->mainBlock,in,beta,out);
93 /* finish exchange */
94 remote_values=Paso_SystemMatrix_finishCollect(A);
95 /* process couple block */
96 if (A->col_coupleBlock->pattern->ptr!=NULL) {
97 Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->col_coupleBlock,remote_values,1.,out);
98 }
99
100 }
101
102 void Paso_SystemMatrix_MatrixVector_CSC_OFFSET1(double alpha,
103 Paso_SystemMatrix* A,
104 const double* in,
105 const double beta,
106 double* out)
107 {
108 double *remote_values=NULL;
109 /* start exchange */
110 Paso_SystemMatrix_startRowCollect(A,in);
111 /* process main block */
112 Paso_SparseMatrix_MatrixVector_CSC_OFFSET1(alpha,A->mainBlock,in,beta,out);
113 /* finish exchange */
114 remote_values=Paso_SystemMatrix_finishRowCollect(A);
115 /* process couple block */
116 if (A->row_coupleBlock->pattern->ptr!=NULL) {
117 Paso_SparseMatrix_MatrixVector_CSC_OFFSET1(alpha,A->row_coupleBlock,remote_values,1.,out);
118 }
119
120 }
121

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26