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

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

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

trunk/esys2/paso/src/Solvers/BiCGStab.c revision 150 by jgs, Thu Sep 15 03:44:45 2005 UTC trunk/paso/src/BiCGStab.c revision 1028 by gross, Wed Mar 14 00:15:24 2007 UTC
# Line 1  Line 1 
1  /* $Id$ */  /* $Id$ */
2    
3  /*  /*
4    ********************************************************************************
5    *               Copyright   2006 by ACcESS MNRF                                *
6    *                                                                              *
7    *                 http://www.access.edu.au                                     *
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     Crude modifications and translations for Paso by Matt Davies and Lutz Gross     Crude modifications and translations for Paso by Matt Davies and Lutz Gross
16  */  */
17    
# Line 66  err_t Paso_Solver_BiCGStab( Line 77  err_t Paso_Solver_BiCGStab(
77      double * r,      double * r,
78      double * x,      double * x,
79      dim_t *iter,      dim_t *iter,
80      double * tolerance) {      double * tolerance,
81        Paso_Performance* pp) {
82    
83    
84    /* Local variables */    /* Local variables */
# Line 74  err_t Paso_Solver_BiCGStab( Line 86  err_t Paso_Solver_BiCGStab(
86    double beta,norm_of_residual,sum_1,sum_2,sum_3,sum_4,norm_of_residual_global;    double beta,norm_of_residual,sum_1,sum_2,sum_3,sum_4,norm_of_residual_global;
87    double alpha, omega, omegaNumtr, omegaDenumtr, rho, tol, rho1;    double alpha, omega, omegaNumtr, omegaDenumtr, rho, tol, rho1;
88    dim_t num_iter=0,maxit,num_iter_global;    dim_t num_iter=0,maxit,num_iter_global;
89    dim_t i0;    dim_t i0,n;
90    bool_t breakFlag=FALSE, maxIterFlag=FALSE, convergeFlag=FALSE;    bool_t breakFlag=FALSE, maxIterFlag=FALSE, convergeFlag=FALSE;
91    dim_t status = SOLVER_NO_ERROR;    dim_t status = SOLVER_NO_ERROR;
92      double *resid = tolerance;
93    /* adapt original routine parameters */    /* adapt original routine parameters */
94    dim_t n = A->num_cols * A-> col_block_size;;    n = A->num_cols * A-> col_block_size;;
   double * resid = tolerance;  
95    
96    /* Executable Statements */    /* Executable Statements */
97    
# Line 105  err_t Paso_Solver_BiCGStab( Line 116  err_t Paso_Solver_BiCGStab(
116      maxit = *iter;      maxit = *iter;
117      tol = *resid;      tol = *resid;
118        
119  #pragma omp parallel firstprivate(maxit,tol,convergeFlag,maxIterFlag,breakFlag) \      #pragma omp parallel firstprivate(maxit,tol) \
120         private(rho,omega,num_iter,norm_of_residual,beta,alpha,rho1)         private(rho,omega,num_iter,norm_of_residual,beta,alpha,rho1, convergeFlag,maxIterFlag,breakFlag)
121      {      {
122        num_iter =0;        num_iter =0;
123          convergeFlag=FALSE;
124          maxIterFlag=FALSE;
125          breakFlag=FALSE;
126    
127        /* initialize arrays */        /* initialize arrays */
128        
# Line 158  err_t Paso_Solver_BiCGStab( Line 172  err_t Paso_Solver_BiCGStab(
172      /*        Compute direction adjusting vector PHAT and scalar ALPHA. */      /*        Compute direction adjusting vector PHAT and scalar ALPHA. */
173        
174          Paso_Solver_solvePreconditioner(A,&phat[0], &p[0]);          Paso_Solver_solvePreconditioner(A,&phat[0], &p[0]);
175      Paso_SystemMatrix_MatrixVector(ONE, A, &phat[0],ZERO, &v[0]);      Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(ONE, A, &phat[0],ZERO, &v[0]);
176        
177          #pragma omp for private(i0) reduction(+:sum_2) schedule(static)          #pragma omp for private(i0) reduction(+:sum_2) schedule(static)
178      for (i0 = 0; i0 < n; i0++) sum_2 += rtld[i0] * v[i0];      for (i0 = 0; i0 < n; i0++) sum_2 += rtld[i0] * v[i0];
# Line 182  err_t Paso_Solver_BiCGStab( Line 196  err_t Paso_Solver_BiCGStab(
196         } else {         } else {
197           /*           Compute stabilizer vector SHAT and scalar OMEGA. */           /*           Compute stabilizer vector SHAT and scalar OMEGA. */
198               Paso_Solver_solvePreconditioner(A,&shat[0], &s[0]);               Paso_Solver_solvePreconditioner(A,&shat[0], &s[0]);
199           Paso_SystemMatrix_MatrixVector(ONE, A, &shat[0],ZERO,&t[0]);           Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(ONE, A, &shat[0],ZERO,&t[0]);
200        
201               #pragma omp for private(i0) reduction(+:omegaNumtr,omegaDenumtr) schedule(static)               #pragma omp for private(i0) reduction(+:omegaNumtr,omegaDenumtr) schedule(static)
202           for (i0 = 0; i0 < n; i0++) {           for (i0 = 0; i0 < n; i0++) {

Legend:
Removed from v.150  
changed lines
  Added in v.1028

  ViewVC Help
Powered by ViewVC 1.1.26