# Contents of /trunk/paso/src/SystemMatrix_borrowNormalization.c

Revision 1811 - (show annotations)
Thu Sep 25 23:11:13 2008 UTC (11 years ago) by ksteube
File MIME type: text/plain
File size: 2980 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 /* returns a borrowed reference to the matrix normaliztion vector */ 20 21 /* if the vector is in valid a new vector is calculate as the inverse */ 22 /* of the sum of the absolute value in each row/column */ 23 24 /**************************************************************/ 25 26 /* Copyrights by ACcESS Australia 2005 */ 27 /* Author: gross@access.edu.au */ 28 29 /**************************************************************/ 30 31 #include "Paso.h" 32 #include "SystemMatrix.h" 33 34 double* Paso_SystemMatrix_borrowNormalization(Paso_SystemMatrix* A) { 35 dim_t irow, nrow; 36 index_t irow_failed, irow_failed_local; 37 register double fac; 38 if (!A->normalizer_is_valid) { 39 if ((A->type & MATRIX_FORMAT_CSC) || (A->type & MATRIX_FORMAT_SYM) || (A->type & MATRIX_FORMAT_OFFSET1)) { 40 Paso_setError(TYPE_ERROR,"Paso_SystemMatrix_borrowNormalization: No normalization available for compressed sparse column, symmetric storage scheme or index offset 1."); 41 } else { 42 if (Paso_checkPtr(A->normalizer)) { 43 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_borrowNormalization: no memory alloced for normalizer."); 44 45 } else { 46 nrow=A->mainBlock->numRows*A->row_block_size; 47 #pragma omp parallel for private(irow) schedule(static) 48 for (irow=0; irownormalizer[irow]=0; 50 } 51 Paso_SparseMatrix_addAbsRow_CSR_OFFSET0(A->mainBlock,A->normalizer); 52 Paso_SparseMatrix_addAbsRow_CSR_OFFSET0(A->col_coupleBlock,A->normalizer); 53 54 #pragma omp parallel 55 { 56 irow_failed_local=-1; 57 #pragma omp for private(irow,fac) schedule(static) 58 for (irow=0; irownormalizer[irow]; 60 if (ABS(fac)>0) { 61 A->normalizer[irow]=1./fac; 62 } else { 63 A->normalizer[irow]=1.; 64 irow_failed=irow; 65 } 66 } 67 #pragma omp critical 68 irow_failed=irow_failed_local; 69 } 70 if (irow_failed>=0) { 71 Paso_setError(ZERO_DIVISION_ERROR,"There is a row containing zero entries only."); 72 } 73 A->normalizer_is_valid=TRUE; 74 } 75 } 76 Paso_MPIInfo_noError(A->mpi_info ); 77 } 78 return A->normalizer; 79 }

## Properties

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

 ViewVC Help Powered by ViewVC 1.1.26