/[escript]/trunk/paso/src/SystemMatrix_nullifyRowsAndCols.c
ViewVC logotype

Contents of /trunk/paso/src/SystemMatrix_nullifyRowsAndCols.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1811 - (show annotations)
Thu Sep 25 23:11:13 2008 UTC (11 years ago) by ksteube
File MIME type: text/plain
File size: 4426 byte(s)
Copyright updated in all files

1
2 /*******************************************************
3 *
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
14
15 /**************************************************************/
16
17 /* Paso: SystemMatrix */
18
19 /* nullify rows and columns in the matrix */
20 /*
21 /* the rows and columns are marked by positive values in */
22 /* mask_row and mask_col. Values on the main diagonal */
23 /* which are marked to set to zero by both mask_row and */
24 /* mask_col are set to main_diagonal_value */
25
26
27 /**************************************************************/
28
29 /* Copyrights by ACcESS Australia 2003 */
30 /* Author: gross@access.edu.au */
31
32 /**************************************************************/
33
34 #include "Paso.h"
35 #include "SystemMatrix.h"
36
37 void Paso_SystemMatrix_nullifyRowsAndCols(Paso_SystemMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value) {
38
39 double *remote_values=NULL;
40 Paso_MPIInfo *mpi_info=A->mpi_info;
41 if (mpi_info->size>1) {
42 if (A ->col_block_size==1 && A ->row_block_size ==1) {
43 if (A->type & MATRIX_FORMAT_CSC) {
44 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: CSC is not supported by MPI.");
45 return;
46 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
47 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: TRILINOS is not supported with MPI.");
48 return;
49 } else {
50 if (Paso_noError()) {
51 Paso_SystemMatrix_startColCollect(A,mask_col);
52 Paso_SystemMatrix_startRowCollect(A,mask_row);
53 Paso_SparseMatrix_nullifyRowsAndCols_CSR_BLK1(A->mainBlock,mask_row,mask_col,main_diagonal_value);
54 remote_values=Paso_SystemMatrix_finishColCollect(A);
55 Paso_SparseMatrix_nullifyRowsAndCols_CSR_BLK1(A->col_coupleBlock,mask_row,remote_values,0.);
56 remote_values=Paso_SystemMatrix_finishRowCollect(A);
57 Paso_SparseMatrix_nullifyRowsAndCols_CSR_BLK1(A->row_coupleBlock,remote_values,mask_col,0.);
58 }
59 }
60 } else {
61 if (A->type & MATRIX_FORMAT_CSC) {
62 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: CSC is not supported by MPI.");
63 return;
64 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
65 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: TRILINOS is not supported with MPI.");
66 return;
67 } else {
68 if (Paso_noError()) {
69 Paso_SystemMatrix_startColCollect(A,mask_col) ;
70 Paso_SystemMatrix_startRowCollect(A,mask_row) ;
71 Paso_SparseMatrix_nullifyRowsAndCols_CSR(A->mainBlock,mask_row,mask_col,main_diagonal_value);
72 remote_values=Paso_SystemMatrix_finishColCollect(A);
73 Paso_SparseMatrix_nullifyRowsAndCols_CSR(A->col_coupleBlock,mask_row,remote_values,0.);
74 remote_values=Paso_SystemMatrix_finishRowCollect(A);
75 Paso_SparseMatrix_nullifyRowsAndCols_CSR(A->row_coupleBlock,remote_values,mask_col,0.);
76 }
77 }
78 }
79 } else {
80 if (A ->col_block_size==1 && A ->row_block_size ==1) {
81 if (A->type & MATRIX_FORMAT_CSC) {
82 Paso_SparseMatrix_nullifyRowsAndCols_CSC_BLK1(A->mainBlock,mask_row,mask_col,main_diagonal_value);
83 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
84 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: TRILINOS is not supported.");
85 } else {
86 Paso_SparseMatrix_nullifyRowsAndCols_CSR_BLK1(A->mainBlock,mask_row,mask_col,main_diagonal_value);
87 }
88 } else {
89 if (A->type & MATRIX_FORMAT_CSC) {
90 Paso_SparseMatrix_nullifyRowsAndCols_CSC(A->mainBlock,mask_row,mask_col,main_diagonal_value);
91 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
92 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: TRILINOS is not supported with MPI.");
93 } else {
94 Paso_SparseMatrix_nullifyRowsAndCols_CSR(A->mainBlock,mask_row,mask_col,main_diagonal_value);
95 }
96 }
97 }
98 return;
99 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26