/[escript]/branches/doubleplusgood/paso/src/SystemMatrix_nullifyRowsAndCols.cpp
ViewVC logotype

Contents of /branches/doubleplusgood/paso/src/SystemMatrix_nullifyRowsAndCols.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4261 - (show annotations)
Wed Feb 27 06:09:33 2013 UTC (6 years, 1 month ago) by jfenwick
File size: 4685 byte(s)
Initial all c++ build.
But ... there are now reinterpret_cast<>'s
1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2013 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 since 2012 by School of Earth Sciences
13 *
14 *****************************************************************************/
15
16
17 /************************************************************************************/
18
19 /* Paso: SystemMatrix */
20
21 /* nullify rows and columns in the matrix */
22 /* */
23 /* The rows and columns are marked by positive values in */
24 /* mask_row and mask_col. Values on the main diagonal */
25 /* which are marked to set to zero by both mask_row and */
26 /* mask_col are set to main_diagonal_value. */
27
28
29 /************************************************************************************/
30
31 /* Copyrights by ACcESS Australia 2003 */
32 /* Author: Lutz Gross, l.gross@uq.edu.au */
33
34 /************************************************************************************/
35
36 #include "Paso.h"
37 #include "SystemMatrix.h"
38
39 void Paso_SystemMatrix_nullifyRowsAndCols(Paso_SystemMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value) {
40
41 double *remote_values=NULL;
42 Esys_MPIInfo *mpi_info=A->mpi_info;
43 if (mpi_info->size>1) {
44 if (A ->col_block_size==1 && A ->row_block_size ==1) {
45 if (A->type & MATRIX_FORMAT_CSC) {
46 Esys_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: CSC is not supported by MPI.");
47 return;
48 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
49 Esys_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: TRILINOS is not supported with MPI.");
50 return;
51 } else {
52 if (Esys_noError()) {
53 Paso_SystemMatrix_startColCollect(A,mask_col);
54 Paso_SystemMatrix_startRowCollect(A,mask_row);
55 Paso_SparseMatrix_nullifyRowsAndCols_CSR_BLK1(A->mainBlock,mask_row,mask_col,main_diagonal_value);
56 remote_values=Paso_SystemMatrix_finishColCollect(A);
57 Paso_SparseMatrix_nullifyRowsAndCols_CSR_BLK1(A->col_coupleBlock,mask_row,remote_values,0.);
58 remote_values=Paso_SystemMatrix_finishRowCollect(A);
59 Paso_SparseMatrix_nullifyRowsAndCols_CSR_BLK1(A->row_coupleBlock,remote_values,mask_col,0.);
60 }
61 }
62 } else {
63 if (A->type & MATRIX_FORMAT_CSC) {
64 Esys_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: CSC is not supported by MPI.");
65 return;
66 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
67 Esys_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: TRILINOS is not supported with MPI.");
68 return;
69 } else {
70 if (Esys_noError()) {
71 Paso_SystemMatrix_startColCollect(A,mask_col) ;
72 Paso_SystemMatrix_startRowCollect(A,mask_row) ;
73 Paso_SparseMatrix_nullifyRowsAndCols_CSR(A->mainBlock,mask_row,mask_col,main_diagonal_value);
74 remote_values=Paso_SystemMatrix_finishColCollect(A);
75 Paso_SparseMatrix_nullifyRowsAndCols_CSR(A->col_coupleBlock,mask_row,remote_values,0.);
76 remote_values=Paso_SystemMatrix_finishRowCollect(A);
77 Paso_SparseMatrix_nullifyRowsAndCols_CSR(A->row_coupleBlock,remote_values,mask_col,0.);
78 }
79 }
80 }
81 } else {
82 if (A ->col_block_size==1 && A ->row_block_size ==1) {
83 if (A->type & MATRIX_FORMAT_CSC) {
84 Paso_SparseMatrix_nullifyRowsAndCols_CSC_BLK1(A->mainBlock,mask_row,mask_col,main_diagonal_value);
85 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
86 Esys_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: TRILINOS is not supported.");
87 } else {
88 Paso_SparseMatrix_nullifyRowsAndCols_CSR_BLK1(A->mainBlock,mask_row,mask_col,main_diagonal_value);
89 }
90 } else {
91 if (A->type & MATRIX_FORMAT_CSC) {
92 Paso_SparseMatrix_nullifyRowsAndCols_CSC(A->mainBlock,mask_row,mask_col,main_diagonal_value);
93 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
94 Esys_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: TRILINOS is not supported with MPI.");
95 } else {
96 Paso_SparseMatrix_nullifyRowsAndCols_CSR(A->mainBlock,mask_row,mask_col,main_diagonal_value);
97 }
98 }
99 }
100 return;
101 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26