/[escript]/trunk/paso/src/SystemMatrix_MatrixVector.cpp
ViewVC logotype

Contents of /trunk/paso/src/SystemMatrix_MatrixVector.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4836 - (show annotations)
Mon Apr 7 05:51:55 2014 UTC (5 years, 5 months ago) by caltinay
File size: 3585 byte(s)
"Some" SystemMatrix clean up.....

1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2014 by University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16
17
18 /****************************************************************************/
19
20 /* Paso: matrix vector product with sparse matrix */
21
22 /****************************************************************************/
23
24 /* Copyrights by ACcESS Australia 2003,2004,2005 */
25 /* Author: Lutz Gross, l.gross@uq.edu.au */
26
27 /****************************************************************************/
28
29 #include "Paso.h"
30 #include "SystemMatrix.h"
31
32 namespace paso {
33
34 /* raw scaled vector update operation: out = alpha * A * in + beta * out */
35 void SystemMatrix_MatrixVector(double alpha, SystemMatrix_ptr A,
36 const double* in, double beta, double* out)
37 {
38 if (A->is_balanced) {
39 Esys_setError(VALUE_ERROR, "SystemMatrix_MatrixVector: balanced matrix is not supported.");
40 return;
41 }
42 if (A->type & MATRIX_FORMAT_CSC) {
43 if (A->mpi_info->size > 1) {
44 Esys_setError(SYSTEM_ERROR,"SystemMatrix_MatrixVector: CSC is not supported by MPI.");
45 return;
46 } else {
47 if (A->type & MATRIX_FORMAT_OFFSET1) {
48 SparseMatrix_MatrixVector_CSC_OFFSET1(alpha,A->mainBlock,in,beta,out);
49 } else {
50 SparseMatrix_MatrixVector_CSC_OFFSET0(alpha,A->mainBlock,in,beta,out);
51 }
52 }
53 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
54 Esys_setError(SYSTEM_ERROR,"SystemMatrix_MatrixVector: TRILINOS is not supported with MPI.");
55 return;
56 } else {
57 if (A->type & MATRIX_FORMAT_OFFSET1) {
58 if (A->mpi_info->size > 1) {
59 Esys_setError(SYSTEM_ERROR,"SystemMatrix_MatrixVector: CSR with offset 1 is not supported in MPI.");
60 return;
61 } else {
62 SparseMatrix_MatrixVector_CSR_OFFSET1(alpha,A->mainBlock,in,beta,out);
63 }
64 } else {
65 if (Esys_noError()) {
66 SystemMatrix_MatrixVector_CSR_OFFSET0(alpha,A,in,beta,out);
67 }
68 }
69 }
70 }
71
72 void SystemMatrix_MatrixVector_CSR_OFFSET0(double alpha, SystemMatrix_ptr A,
73 const double* in, const double beta,
74 double* out)
75 {
76 // start exchange
77 A->startCollect(in);
78 // process main block
79 if (A->type & MATRIX_FORMAT_DIAGONAL_BLOCK) {
80 SparseMatrix_MatrixVector_CSR_OFFSET0_DIAG(alpha,A->mainBlock,in,beta,out);
81 } else {
82 SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->mainBlock,in,beta,out);
83 }
84 // finish exchange
85 double* remote_values = A->finishCollect();
86 // process couple block
87 if (A->col_coupleBlock->pattern->ptr != NULL) {
88 if (A->type & MATRIX_FORMAT_DIAGONAL_BLOCK) {
89 SparseMatrix_MatrixVector_CSR_OFFSET0_DIAG(alpha,A->col_coupleBlock,remote_values,1.,out);
90 } else {
91 SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->col_coupleBlock,remote_values,1.,out);
92 }
93 }
94 }
95
96 } // namespace paso
97

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision
svn:mergeinfo /branches/amg_from_3530/paso/src/SystemMatrix_MatrixVector.cpp:3531-3826 /branches/lapack2681/paso/src/SystemMatrix_MatrixVector.cpp:2682-2741 /branches/pasowrap/paso/src/SystemMatrix_MatrixVector.cpp:3661-3674 /branches/py3_attempt2/paso/src/SystemMatrix_MatrixVector.cpp:3871-3891 /branches/restext/paso/src/SystemMatrix_MatrixVector.cpp:2610-2624 /branches/ripleygmg_from_3668/paso/src/SystemMatrix_MatrixVector.cpp:3669-3791 /branches/stage3.0/paso/src/SystemMatrix_MatrixVector.cpp:2569-2590 /branches/symbolic_from_3470/paso/src/SystemMatrix_MatrixVector.cpp:3471-3974 /branches/symbolic_from_3470/ripley/test/python/paso/src/SystemMatrix_MatrixVector.cpp:3517-3974 /release/3.0/paso/src/SystemMatrix_MatrixVector.cpp:2591-2601 /trunk/paso/src/SystemMatrix_MatrixVector.cpp:4257-4344 /trunk/ripley/test/python/paso/src/SystemMatrix_MatrixVector.cpp:3480-3515

  ViewVC Help
Powered by ViewVC 1.1.26