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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1387 - (show annotations)
Fri Jan 11 07:45:26 2008 UTC (11 years, 10 months ago) by trankine
Original Path: temp/paso/src/SystemMatrix_nullifyRowsAndCols.c
File MIME type: text/plain
File size: 4154 byte(s)
Restore the trunk that existed before the windows changes were committed to the (now moved to branches) old trunk.
1
2 /* $Id$ */
3
4 /*******************************************************
5 *
6 * Copyright 2003-2007 by ACceSS MNRF
7 * Copyright 2007 by University of Queensland
8 *
9 * http://esscc.uq.edu.au
10 * Primary Business: Queensland, Australia
11 * Licensed under the Open Software License version 3.0
12 * http://www.opensource.org/licenses/osl-3.0.php
13 *
14 *******************************************************/
15
16 /**************************************************************/
17
18 /* Paso: SystemMatrix */
19
20 /* nullify rows and columns in the matrix */
21
22 /* the rows and columns are marked by positive values in */
23 /* mask_row and mask_col. Values on the main diagonal */
24 /* which are marked to set to zero by both mask_row and */
25 /* mask_col are set to main_diagonal_value */
26
27
28 /**************************************************************/
29
30 /* Copyrights by ACcESS Australia 2003 */
31 /* Author: gross@access.edu.au */
32
33 /**************************************************************/
34
35 #include "Paso.h"
36 #include "SystemMatrix.h"
37
38 void Paso_SystemMatrix_nullifyRowsAndCols(Paso_SystemMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value) {
39
40 double *remote_values=NULL;
41 Paso_MPIInfo *mpi_info=A->mpi_info;
42 if (mpi_info->size>1) {
43 if (A ->col_block_size==1 && A ->row_block_size ==1) {
44 if (A->type & MATRIX_FORMAT_CSC) {
45 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: CSC is not supported by MPI.");
46 return;
47 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
48 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: TRILINOS is not supported with MPI.");
49 return;
50 } else {
51 Paso_SystemMatrix_allocBuffer(A);
52 if (Paso_noError()) {
53 Paso_SystemMatrix_startCollect(A,mask_col) ;
54 Paso_SparseMatrix_nullifyRowsAndCols_CSR_BLK1(A->mainBlock,mask_row,mask_col,main_diagonal_value);
55 remote_values=Paso_SystemMatrix_finishCollect(A);
56 Paso_SparseMatrix_nullifyRowsAndCols_CSR_BLK1(A->coupleBlock,mask_row,remote_values,0.);
57 }
58 Paso_SystemMatrix_freeBuffer(A);
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 Paso_SystemMatrix_allocBuffer(A);
69 if (Paso_noError()) {
70 Paso_SystemMatrix_startCollect(A,mask_col) ;
71 Paso_SparseMatrix_nullifyRowsAndCols_CSR(A->mainBlock,mask_row,mask_col,main_diagonal_value);
72 remote_values=Paso_SystemMatrix_finishCollect(A);
73 Paso_SparseMatrix_nullifyRowsAndCols_CSR(A->coupleBlock,mask_row,remote_values,0.);
74 }
75 Paso_SystemMatrix_freeBuffer(A);
76 }
77 }
78 } else {
79 if (A ->col_block_size==1 && A ->row_block_size ==1) {
80 if (A->type & MATRIX_FORMAT_CSC) {
81 Paso_SparseMatrix_nullifyRowsAndCols_CSC_BLK1(A->mainBlock,mask_row,mask_col,main_diagonal_value);
82 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
83 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: TRILINOS is not supported.");
84 } else {
85 Paso_SparseMatrix_nullifyRowsAndCols_CSR_BLK1(A->mainBlock,mask_row,mask_col,main_diagonal_value);
86 }
87 } else {
88 if (A->type & MATRIX_FORMAT_CSC) {
89 Paso_SparseMatrix_nullifyRowsAndCols_CSC(A->mainBlock,mask_row,mask_col,main_diagonal_value);
90 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
91 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: TRILINOS is not supported with MPI.");
92 } else {
93 Paso_SparseMatrix_nullifyRowsAndCols_CSR(A->mainBlock,mask_row,mask_col,main_diagonal_value);
94 }
95 }
96 }
97 return;
98 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26