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

Diff of /trunk/paso/src/ILU.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

temp_trunk_copy/paso/src/Solver_ILU.c revision 1384 by phornby, Fri Jan 11 02:29:38 2008 UTC trunk/paso/src/Solver_ILU.c revision 1841 by gross, Fri Oct 3 03:57:52 2008 UTC
# Line 1  Line 1 
1    
 /* $Id$ */  
   
2  /*******************************************************  /*******************************************************
3   *  *
4   *           Copyright 2003-2007 by ACceSS MNRF  * Copyright (c) 2003-2008 by University of Queensland
5   *       Copyright 2007 by University of Queensland  * Earth Systems Science Computational Center (ESSCC)
6   *  * http://www.uq.edu.au/esscc
7   *                http://esscc.uq.edu.au  *
8   *        Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
9   *  Licensed under the Open Software License version 3.0  * Licensed under the Open Software License version 3.0
10   *     http://www.opensource.org/licenses/osl-3.0.php  * http://www.opensource.org/licenses/osl-3.0.php
11   *  *
12   *******************************************************/  *******************************************************/
13    
14    
15  /**************************************************************/  /**************************************************************/
16    
# Line 52  Paso_Solver_ILU* Paso_Solver_getILU(Paso Line 51  Paso_Solver_ILU* Paso_Solver_getILU(Paso
51    dim_t n_block=A->row_block_size;    dim_t n_block=A->row_block_size;
52    index_t num_colors=0, *mis_marker=NULL;    index_t num_colors=0, *mis_marker=NULL;
53    register double A11,A12,A13,A21,A22,A23,A31,A32,A33,D;    register double A11,A12,A13,A21,A22,A23,A31,A32,A33,D;
   register double mainA11,mainA12,mainA13,mainA21,mainA22,mainA23,mainA31,mainA32,mainA33;  
54    register double S11,S12,S13,S21,S22,S23,S31,S32,S33;    register double S11,S12,S13,S21,S22,S23,S31,S32,S33;
55    register index_t i,iptr_main,iptr,iptr_ik,k,iptr_kj,j,iptr_ij,color,color2;    register index_t i,iptr_main,iptr,iptr_ik,k,iptr_kj,j,iptr_ij,color,color2;
56    double time0,time_color,time_fac;    double time0,time_color,time_fac;
# Line 75  Paso_Solver_ILU* Paso_Solver_getILU(Paso Line 73  Paso_Solver_ILU* Paso_Solver_getILU(Paso
73         /* find main diagonal and copy matrix values */         /* find main diagonal and copy matrix values */
74         #pragma omp parallel for schedule(static) private(i,iptr,iptr_main,k)         #pragma omp parallel for schedule(static) private(i,iptr,iptr_main,k)
75         for (i = 0; i < n; ++i) {         for (i = 0; i < n; ++i) {
            for (iptr=A->pattern->ptr[i];iptr<A->pattern->ptr[i+1]; ++iptr) {  
76                 iptr_main=A->pattern->ptr[0]-1;                 iptr_main=A->pattern->ptr[0]-1;
77                  for (iptr=A->pattern->ptr[i];iptr<A->pattern->ptr[i+1]; iptr++) {                 for (iptr=A->pattern->ptr[i];iptr<A->pattern->ptr[i+1]; iptr++) {
78                     if (A->pattern->index[iptr]==i) iptr_main=iptr;                     if (A->pattern->index[iptr]==i) iptr_main=iptr;
79                     for (k=0;k<n_block*n_block;++k) out->factors[n_block*n_block*iptr+k]=A->val[n_block*n_block*iptr+k];                     for (k=0;k<n_block*n_block;++k) out->factors[n_block*n_block*iptr+k]=A->val[n_block*n_block*iptr+k];
80                 }                 }
81                 out->main_iptr[i]=iptr_main;                 out->main_iptr[i]=iptr_main;
82                 if (iptr_main==A->pattern->ptr[0]-1)                 if (iptr_main==A->pattern->ptr[0]-1)  {
83                    Paso_setError(VALUE_ERROR, "Paso_Solver_getILU: no main diagonal");                    Paso_setError(VALUE_ERROR, "Paso_Solver_getILU: no main diagonal");
84             }                 }
85         }         }
86         /* start factorization */         /* start factorization */
87        
# Line 353  void Paso_Solver_solveILU(Paso_Solver_IL Line 350  void Paso_Solver_solveILU(Paso_Solver_IL
350            
351            
352       /* copy x into b*/       /* copy x into b*/
353       #pragma omp for private(i) schedule(static)       #pragma omp parallel for private(i) schedule(static)
354       for (i=0;i<n*n_block;++i) x[i]=b[i];       for (i=0;i<n*n_block;++i) x[i]=b[i];
355       /* forward substitution */       /* forward substitution */
356       for (color=0;color<ilu->num_colors;++color) {       for (color=0;color<ilu->num_colors;++color) {
357             if (n_block==1) {             if (n_block==1) {
358                #pragma omp for schedule(static) private(i,iptr_ik,k,S1,R1,iptr_main)                #pragma omp parallel for schedule(static) private(i,iptr_ik,k,S1,R1,iptr_main)
359                for (i = 0; i < n; ++i) {                for (i = 0; i < n; ++i) {
360                     if (ilu->colorOf[i]==color) {                     if (ilu->colorOf[i]==color) {
361                       /* x_i=x_i-a_ik*x_k */                                           /* x_i=x_i-a_ik*x_k */                    
# Line 375  void Paso_Solver_solveILU(Paso_Solver_IL Line 372  void Paso_Solver_solveILU(Paso_Solver_IL
372                     }                     }
373                }                }
374             } else if (n_block==2) {             } else if (n_block==2) {
375                #pragma omp for schedule(static) private(i,iptr_ik,k,iptr_main,S1,S2,R1,R2)                #pragma omp parallel for schedule(static) private(i,iptr_ik,k,iptr_main,S1,S2,R1,R2)
376                for (i = 0; i < n; ++i) {                for (i = 0; i < n; ++i) {
377                     if (ilu->colorOf[i]==color) {                     if (ilu->colorOf[i]==color) {
378                       /* x_i=x_i-a_ik*x_k */                       /* x_i=x_i-a_ik*x_k */
# Line 397  void Paso_Solver_solveILU(Paso_Solver_IL Line 394  void Paso_Solver_solveILU(Paso_Solver_IL
394    
395                }                }
396             } else if (n_block==3) {             } else if (n_block==3) {
397                #pragma omp for schedule(static) private(i,iptr_ik,iptr_main,k,S1,S2,S3,R1,R2,R3)                #pragma omp parallel for schedule(static) private(i,iptr_ik,iptr_main,k,S1,S2,S3,R1,R2,R3)
398                for (i = 0; i < n; ++i) {                for (i = 0; i < n; ++i) {
399                     if (ilu->colorOf[i]==color) {                     if (ilu->colorOf[i]==color) {
400                       /* x_i=x_i-a_ik*x_k */                       /* x_i=x_i-a_ik*x_k */
# Line 422  void Paso_Solver_solveILU(Paso_Solver_IL Line 419  void Paso_Solver_solveILU(Paso_Solver_IL
419                   }                   }
420                }                }
421             }             }
            #pragma omp barrier  
422       }       }
423       /* backward substitution */       /* backward substitution */
424       for (color=(ilu->num_colors)-1;color>-1;--color) {       for (color=(ilu->num_colors)-1;color>-1;--color) {
425             if (n_block==1) {             if (n_block==1) {
426                #pragma omp for schedule(static) private(i,iptr_ik,k,S1,R1)                #pragma omp parallel for schedule(static) private(i,iptr_ik,k,S1,R1)
427                for (i = 0; i < n; ++i) {                for (i = 0; i < n; ++i) {
428                     if (ilu->colorOf[i]==color) {                     if (ilu->colorOf[i]==color) {
429                       /* x_i=x_i-a_ik*x_k */                       /* x_i=x_i-a_ik*x_k */
# Line 443  void Paso_Solver_solveILU(Paso_Solver_IL Line 439  void Paso_Solver_solveILU(Paso_Solver_IL
439                     }                     }
440                }                }
441             } else if (n_block==2) {             } else if (n_block==2) {
442                #pragma omp for schedule(static) private(i,iptr_ik,k,S1,S2,R1,R2)                #pragma omp parallel for schedule(static) private(i,iptr_ik,k,S1,S2,R1,R2)
443                for (i = 0; i < n; ++i) {                for (i = 0; i < n; ++i) {
444                     if (ilu->colorOf[i]==color) {                     if (ilu->colorOf[i]==color) {
445                       /* x_i=x_i-a_ik*x_k */                       /* x_i=x_i-a_ik*x_k */
# Line 463  void Paso_Solver_solveILU(Paso_Solver_IL Line 459  void Paso_Solver_solveILU(Paso_Solver_IL
459                     }                     }
460                }                }
461             } else if (n_block==3) {             } else if (n_block==3) {
462                #pragma omp for schedule(static) private(i,iptr_ik,k,S1,S2,S3,R1,R2,R3)                #pragma omp parallel for schedule(static) private(i,iptr_ik,k,S1,S2,S3,R1,R2,R3)
463                for (i = 0; i < n; ++i) {                for (i = 0; i < n; ++i) {
464                     if (ilu->colorOf[i]==color) {                     if (ilu->colorOf[i]==color) {
465                       /* x_i=x_i-a_ik*x_k */                       /* x_i=x_i-a_ik*x_k */

Legend:
Removed from v.1384  
changed lines
  Added in v.1841

  ViewVC Help
Powered by ViewVC 1.1.26