/[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 1563 - (show annotations)
Wed May 21 15:27:34 2008 UTC (11 years, 5 months ago) by gross
File MIME type: text/plain
File size: 4461 byte(s)
Some stuff added to make the FCT solver work with Dirichlet Boundary conditions for MPI. 
and a memory leak in the coupler fixed.


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 if (Paso_noError()) {
52 Paso_SystemMatrix_startColCollect(A,mask_col);
53 Paso_SystemMatrix_startRowCollect(A,mask_row);
54 Paso_SparseMatrix_nullifyRowsAndCols_CSR_BLK1(A->mainBlock,mask_row,mask_col,main_diagonal_value);
55 remote_values=Paso_SystemMatrix_finishColCollect(A);
56 Paso_SparseMatrix_nullifyRowsAndCols_CSR_BLK1(A->col_coupleBlock,mask_row,remote_values,0.);
57 remote_values=Paso_SystemMatrix_finishRowCollect(A);
58 Paso_SparseMatrix_nullifyRowsAndCols_CSR_BLK1(A->row_coupleBlock,remote_values,mask_col,0.);
59 }
60 }
61 } else {
62 if (A->type & MATRIX_FORMAT_CSC) {
63 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: CSC is not supported by MPI.");
64 return;
65 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
66 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: TRILINOS is not supported with MPI.");
67 return;
68 } else {
69 if (Paso_noError()) {
70 Paso_SystemMatrix_startColCollect(A,mask_col) ;
71 Paso_SystemMatrix_startRowCollect(A,mask_row) ;
72 Paso_SparseMatrix_nullifyRowsAndCols_CSR(A->mainBlock,mask_row,mask_col,main_diagonal_value);
73 remote_values=Paso_SystemMatrix_finishColCollect(A);
74 Paso_SparseMatrix_nullifyRowsAndCols_CSR(A->col_coupleBlock,mask_row,remote_values,0.);
75 remote_values=Paso_SystemMatrix_finishRowCollect(A);
76 Paso_SparseMatrix_nullifyRowsAndCols_CSR(A->row_coupleBlock,remote_values,mask_col,0.);
77 }
78 }
79 }
80 } else {
81 if (A ->col_block_size==1 && A ->row_block_size ==1) {
82 if (A->type & MATRIX_FORMAT_CSC) {
83 Paso_SparseMatrix_nullifyRowsAndCols_CSC_BLK1(A->mainBlock,mask_row,mask_col,main_diagonal_value);
84 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
85 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: TRILINOS is not supported.");
86 } else {
87 Paso_SparseMatrix_nullifyRowsAndCols_CSR_BLK1(A->mainBlock,mask_row,mask_col,main_diagonal_value);
88 }
89 } else {
90 if (A->type & MATRIX_FORMAT_CSC) {
91 Paso_SparseMatrix_nullifyRowsAndCols_CSC(A->mainBlock,mask_row,mask_col,main_diagonal_value);
92 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
93 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: TRILINOS is not supported with MPI.");
94 } else {
95 Paso_SparseMatrix_nullifyRowsAndCols_CSR(A->mainBlock,mask_row,mask_col,main_diagonal_value);
96 }
97 }
98 }
99 return;
100 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26