~ubuntu-branches/ubuntu/karmic/hypre/karmic

« back to all changes in this revision

Viewing changes to src/krylov/pcg.c

  • Committer: Bazaar Package Importer
  • Author(s): Adam C. Powell, IV
  • Date: 2009-03-20 11:40:12 UTC
  • mfrom: (4.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20090320114012-132h6ok9w2r6o609
Tags: 2.4.0b-2
Rebuild against new openmpi.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*BHEADER**********************************************************************
2
 
 * Copyright (c) 2006   The Regents of the University of California.
 
2
 * Copyright (c) 2008,  Lawrence Livermore National Security, LLC.
3
3
 * Produced at the Lawrence Livermore National Laboratory.
4
 
 * Written by the HYPRE team. UCRL-CODE-222953.
5
 
 * All rights reserved.
6
 
 *
7
 
 * This file is part of HYPRE (see http://www.llnl.gov/CASC/hypre/).
8
 
 * Please see the COPYRIGHT_and_LICENSE file for the copyright notice, 
9
 
 * disclaimer, contact information and the GNU Lesser General Public License.
10
 
 *
11
 
 * HYPRE is free software; you can redistribute it and/or modify it under the 
12
 
 * terms of the GNU General Public License (as published by the Free Software
13
 
 * Foundation) version 2.1 dated February 1999.
14
 
 *
15
 
 * HYPRE is distributed in the hope that it will be useful, but WITHOUT ANY 
16
 
 * WARRANTY; without even the IMPLIED WARRANTY OF MERCHANTABILITY or FITNESS 
17
 
 * FOR A PARTICULAR PURPOSE.  See the terms and conditions of the GNU General
18
 
 * Public License for more details.
19
 
 *
20
 
 * You should have received a copy of the GNU Lesser General Public License
21
 
 * along with this program; if not, write to the Free Software Foundation,
22
 
 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
 
 *
24
 
 * $Revision: 2.36 $
 
4
 * This file is part of HYPRE.  See file COPYRIGHT for details.
 
5
 *
 
6
 * HYPRE is free software; you can redistribute it and/or modify it under the
 
7
 * terms of the GNU Lesser General Public License (as published by the Free
 
8
 * Software Foundation) version 2.1 dated February 1999.
 
9
 *
 
10
 * $Revision: 2.41 $
25
11
 ***********************************************************************EHEADER*/
26
12
 
27
13
 
28
14
 
29
15
 
 
16
 
30
17
/******************************************************************************
31
18
 *
32
19
 * Preconditioned conjugate gradient (Omin) functions
51
38
 
52
39
hypre_PCGFunctions *
53
40
hypre_PCGFunctionsCreate(
54
 
   char * (*CAlloc)        ( int count, int elt_size ),
 
41
   char * (*CAlloc)        ( size_t count, size_t elt_size ),
55
42
   int    (*Free)          ( char *ptr ),
56
43
   int    (*CommInfo)      ( void  *A, int   *my_id, int   *num_procs ),
57
44
   void * (*CreateVector)  ( void *vector ),
110
97
   (pcg_data -> tol)          = 1.0e-06;
111
98
   (pcg_data -> atolf)        = 0.0;
112
99
   (pcg_data -> cf_tol)       = 0.0;
 
100
   (pcg_data -> a_tol)        = 0.0;
113
101
   (pcg_data -> max_iter)     = 1000;
114
102
   (pcg_data -> two_norm)     = 0;
115
103
   (pcg_data -> rel_change)   = 0;
 
104
   (pcg_data -> recompute_residual) = 0;
116
105
   (pcg_data -> stop_crit)    = 0;
117
106
   (pcg_data -> converged)    = 0;
118
107
   (pcg_data -> owns_matvec_data ) = 1;
138
127
{
139
128
   hypre_PCGData *pcg_data = pcg_vdata;
140
129
   hypre_PCGFunctions *pcg_functions = pcg_data->functions;
141
 
   int ierr = 0;
142
130
 
143
131
   if (pcg_data)
144
132
   {
176
164
      hypre_TFreeF( pcg_functions, pcg_functions );
177
165
   }
178
166
 
179
 
   return(ierr);
 
167
   return(hypre_error_flag);
180
168
}
181
169
 
182
170
/*--------------------------------------------------------------------------
186
174
int hypre_PCGGetResidual( void *pcg_vdata, void **residual )
187
175
{
188
176
   /* returns a pointer to the residual vector */
189
 
   int ierr = 0;
 
177
 
190
178
   hypre_PCGData  *pcg_data     = pcg_vdata;
191
179
   *residual = pcg_data->r;
192
 
   return ierr;
 
180
   return hypre_error_flag;
193
181
}
194
182
 
195
183
/*--------------------------------------------------------------------------
207
195
   int            max_iter         = (pcg_data -> max_iter);
208
196
   int          (*precond_setup)() = (pcg_functions -> precond_setup);
209
197
   void          *precond_data     = (pcg_data -> precond_data);
210
 
   int            ierr = 0;
 
198
 
211
199
 
212
200
   (pcg_data -> A) = A;
213
201
 
233
221
      (*(pcg_functions->MatvecDestroy))(pcg_data -> matvec_data);
234
222
   (pcg_data -> matvec_data) = (*(pcg_functions->MatvecCreate))(A, x);
235
223
 
236
 
   ierr = precond_setup(precond_data, A, b, x);
 
224
   precond_setup(precond_data, A, b, x);
237
225
 
238
226
   /*-----------------------------------------------------
239
227
    * Allocate space for log info
252
240
                                                pcg_functions );
253
241
   }
254
242
 
255
 
   return ierr;
 
243
   return hypre_error_flag;
256
244
}
257
245
 
258
246
/*--------------------------------------------------------------------------
282
270
   hypre_PCGData  *pcg_data     = pcg_vdata;
283
271
   hypre_PCGFunctions *pcg_functions = pcg_data->functions;
284
272
 
285
 
   double          tol          = (pcg_data -> tol);
 
273
   double          r_tol        = (pcg_data -> tol);
 
274
   double          a_tol        = (pcg_data -> a_tol);
286
275
   double          atolf        = (pcg_data -> atolf);
287
276
   double          cf_tol       = (pcg_data -> cf_tol);
288
277
   int             max_iter     = (pcg_data -> max_iter);
289
278
   int             two_norm     = (pcg_data -> two_norm);
290
279
   int             rel_change   = (pcg_data -> rel_change);
 
280
   int             recompute_residual = (pcg_data -> recompute_residual);
291
281
   int             stop_crit    = (pcg_data -> stop_crit);
292
282
/*
293
283
   int             converged    = (pcg_data -> converged);
315
305
   double          weight;
316
306
   double          ratio;
317
307
 
318
 
   double          guard_zero_residual, sdotp; 
 
308
   double          guard_zero_residual, sdotp;
 
309
   int             tentatively_converged = 0; 
319
310
 
320
311
   int             i = 0;
321
 
   int             ierr = 0;
322
312
   int             my_id, num_procs;
323
313
 
324
314
   (pcg_data -> converged) = 0;
374
364
        printf("Returning error flag += 101.  Program not terminated.\n");
375
365
        printf("ERROR detected by Hypre ...  END\n\n\n");
376
366
      }
377
 
      ierr += 101;
378
 
      return ierr;
 
367
      hypre_error(HYPRE_ERROR_GENERIC);
 
368
      return hypre_error_flag;
379
369
   }
380
370
 
381
 
   eps = tol*tol;
 
371
   eps = r_tol*r_tol; /* note: this may be re-assigned below */
382
372
   if ( bi_prod > 0.0 ) {
383
373
      if ( stop_crit && !rel_change && atolf<=0 ) {  /* pure absolute tolerance */
384
374
         eps = eps / bi_prod;
388
378
      }
389
379
      else if ( atolf>0 )  /* mixed relative and absolute tolerance */
390
380
         bi_prod += atolf;
 
381
      else /* DEFAULT (stop_crit and atolf exist for backwards compatibilty
 
382
              and are not in the reference manual) */
 
383
      {
 
384
        /* convergence criteria:  <C*r,r>  <= max( a_tol^2, r_tol^2 * <C*b,b> )
 
385
            note: default for a_tol is 0.0, so relative residual criteria is used unless
 
386
            user specifies a_tol, or sets r_tol = 0.0, which means absolute
 
387
            tol only is checked  */
 
388
         eps = hypre_max(r_tol*r_tol, a_tol*a_tol/bi_prod);
 
389
         
 
390
      }
391
391
   }
392
392
   else    /* bi_prod==0.0: the rhs vector b is zero */
393
393
   {
398
398
         norms[0]     = 0.0;
399
399
         rel_norms[i] = 0.0;
400
400
      }
401
 
      ierr = 0;
402
 
      return ierr;
 
401
 
 
402
      return hypre_error_flag;
403
403
      /* In this case, for the original parcsr pcg, the code would take special
404
404
         action to force iterations even though the exact value was known. */
405
405
   };
433
433
        printf("Returning error flag += 101.  Program not terminated.\n");
434
434
        printf("ERROR detected by Hypre ...  END\n\n\n");
435
435
      }
436
 
      ierr += 101;
437
 
      return ierr;
 
436
      hypre_error(HYPRE_ERROR_GENERIC);
 
437
      return hypre_error_flag;
438
438
   }
439
439
 
440
440
   /* Set initial residual norm */
447
447
 
448
448
      if ( logging>0 || print_level>0 ) norms[0] = sqrt(i_prod_0);
449
449
   }
450
 
   if ( print_level > 1 && my_id==0 )  /* formerly for par_csr only */
 
450
   if ( print_level > 1 && my_id==0 )
451
451
   {
452
452
      printf("\n\n");
453
453
      if (two_norm)
470
470
 
471
471
   while ((i+1) <= max_iter)
472
472
   {
 
473
      /*--------------------------------------------------------------------
 
474
       * the core CG calculations...
 
475
       *--------------------------------------------------------------------*/
473
476
      i++;
474
477
 
475
478
      /* s = A*p */
479
482
      sdotp = (*(pcg_functions->InnerProd))(s, p);
480
483
      if ( sdotp==0.0 )
481
484
      {
482
 
         ++ierr;
 
485
         /* ++ierr;*/
483
486
         if (i==1) i_prod=i_prod_0;
484
487
         break;
485
488
      }
506
509
      else
507
510
         i_prod = gamma;
508
511
 
 
512
      /*--------------------------------------------------------------------
 
513
       * optional output
 
514
       *--------------------------------------------------------------------*/
509
515
#if 0
510
516
      if (two_norm)
511
517
         printf("Iter (%d): ||r||_2 = %e, ||r||_2/||b||_2 = %e\n",
543
549
      }
544
550
 
545
551
 
546
 
      /* check for convergence */
547
 
      if (i_prod / bi_prod < eps)
 
552
      /*--------------------------------------------------------------------
 
553
       * check for convergence
 
554
       *--------------------------------------------------------------------*/
 
555
      if (i_prod / bi_prod < eps)  /* the basic convergence test */
 
556
            tentatively_converged = 1;
 
557
      if ( tentatively_converged && recompute_residual )
 
558
         /* At user request, don't trust the convergence test until we've recomputed
 
559
            the residual from scratch.  This is expensive in the usual case where an
 
560
            the norm is the energy norm.
 
561
            This calculation is coded on the assumption that r's accuracy is only a
 
562
            concern for problems where CG takes many iterations. */
548
563
      {
549
 
         if (rel_change && i_prod > guard_zero_residual)
 
564
         /* r = b - Ax */
 
565
         (*(pcg_functions->CopyVector))(b, r);
 
566
         (*(pcg_functions->Matvec))(matvec_data, -1.0, A, x, 1.0, r);
 
567
 
 
568
         /* set i_prod for convergence test */
 
569
         if (two_norm)
 
570
            i_prod = (*(pcg_functions->InnerProd))(r,r);
 
571
         else
550
572
         {
 
573
            /* s = C*r */
 
574
            (*(pcg_functions->ClearVector))(s);
 
575
            precond(precond_data, A, r, s);
 
576
            /* iprod = gamma = <r,s> */
 
577
            i_prod = (*(pcg_functions->InnerProd))(r, s);
 
578
         }
 
579
         if (i_prod / bi_prod >= eps) tentatively_converged = 0;
 
580
      }
 
581
      if ( tentatively_converged && rel_change && (i_prod > guard_zero_residual ))
 
582
         /* At user request, don't treat this as converged unless x didn't change
 
583
            much in the last iteration. */
 
584
      {
551
585
            pi_prod = (*(pcg_functions->InnerProd))(p,p); 
552
586
            xi_prod = (*(pcg_functions->InnerProd))(x,x);
553
587
            ratio = alpha*alpha*pi_prod/xi_prod;
554
 
            if (ratio < eps)
555
 
            {
556
 
               (pcg_data -> converged) = 1;
557
 
               break;
558
 
            }
559
 
         }
560
 
         else
561
 
         {
562
 
            (pcg_data -> converged) = 1;
563
 
            break;
564
 
         }
 
588
            if (ratio >= eps) tentatively_converged = 0;
 
589
      }
 
590
      if ( tentatively_converged )
 
591
         /* we've passed all the convergence tests, it's for real */
 
592
      {
 
593
         (pcg_data -> converged) = 1;
 
594
         break;
565
595
      }
566
596
 
567
597
      if ( (gamma<1.0e-292) && ((-gamma)<1.0e-292) ) {
568
 
         ierr = 1;
 
598
         /* ierr = 1;*/
 
599
         hypre_error(HYPRE_ERROR_CONV);
 
600
         
569
601
         break;
570
602
      }
571
603
      /* ... gamma should be >=0.  IEEE subnormal numbers are < 2**(-1022)=2.2e-308
590
622
               enough to pass the convergence test.  Therefore initial guess was good,
591
623
               and we're just calculating garbage - time to bail out before the
592
624
               next step, which will be a divide by zero (or close to it). */
593
 
            ierr = 1;
 
625
            /* ierr = 1; */
 
626
            hypre_error(HYPRE_ERROR_CONV);
 
627
            
594
628
            break;
595
629
         }
596
630
         cf_ave_1 = pow( i_prod / i_prod_0, 1.0/(2.0*i)); 
605
639
         if (weight * cf_ave_1 > cf_tol) break;
606
640
      }
607
641
 
 
642
      /*--------------------------------------------------------------------
 
643
       * back to the core CG calculations
 
644
       *--------------------------------------------------------------------*/
 
645
 
608
646
      /* beta = gamma / gamma_old */
609
647
      beta = gamma / gamma_old;
610
648
 
613
651
      (*(pcg_functions->Axpy))(1.0, s, p);
614
652
   }
615
653
 
616
 
   if ( print_level > 1 && my_id==0 )  /* formerly for par_csr only */
 
654
   /*--------------------------------------------------------------------
 
655
    * Finish up with some outputs.
 
656
    *--------------------------------------------------------------------*/
 
657
 
 
658
   if ( print_level > 1 && my_id==0 )
617
659
      printf("\n\n");
618
660
 
619
661
   (pcg_data -> num_iterations) = i;
622
664
   else /* actually, we'll never get here... */
623
665
      (pcg_data -> rel_residual_norm) = 0.0;
624
666
 
625
 
   return ierr;
 
667
   return hypre_error_flag;
626
668
}
627
669
 
628
670
/*--------------------------------------------------------------------------
634
676
                 double  tol       )
635
677
{
636
678
   hypre_PCGData *pcg_data = pcg_vdata;
637
 
   int            ierr = 0;
638
679
 
639
680
   (pcg_data -> tol) = tol;
640
681
 
641
 
   return ierr;
 
682
   return hypre_error_flag;
642
683
}
643
684
 
644
685
int
646
687
                 double * tol       )
647
688
{
648
689
   hypre_PCGData *pcg_data = pcg_vdata;
649
 
   int            ierr = 0;
650
690
 
651
691
   *tol = (pcg_data -> tol);
652
692
 
653
 
   return ierr;
 
693
   return hypre_error_flag;
 
694
}
 
695
/*--------------------------------------------------------------------------
 
696
 * hypre_PCGSetAbsoluteTol, hypre_PCGGetAbsoluteTol
 
697
 *--------------------------------------------------------------------------*/
 
698
 
 
699
int
 
700
hypre_PCGSetAbsoluteTol( void   *pcg_vdata,
 
701
                 double  a_tol       )
 
702
{
 
703
   hypre_PCGData *pcg_data = pcg_vdata;
 
704
 
 
705
   (pcg_data -> a_tol) = a_tol;
 
706
 
 
707
   return hypre_error_flag;
 
708
}
 
709
 
 
710
int
 
711
hypre_PCGGetAbsoluteTol( void   *pcg_vdata,
 
712
                 double * a_tol       )
 
713
{
 
714
   hypre_PCGData *pcg_data = pcg_vdata;
 
715
 
 
716
   *a_tol = (pcg_data -> a_tol);
 
717
 
 
718
   return hypre_error_flag;
654
719
}
655
720
 
656
721
/*--------------------------------------------------------------------------
662
727
                               double  atolf   )
663
728
{
664
729
   hypre_PCGData *pcg_data = pcg_vdata;
665
 
   int            ierr = 0;
666
730
 
667
731
   (pcg_data -> atolf) = atolf;
668
732
 
669
 
   return ierr;
 
733
   return hypre_error_flag;
670
734
}
671
735
 
672
736
int
674
738
                               double  * atolf   )
675
739
{
676
740
   hypre_PCGData *pcg_data = pcg_vdata;
677
 
   int            ierr = 0;
678
741
 
679
742
   *atolf = (pcg_data -> atolf);
680
743
 
681
 
   return ierr;
 
744
   return hypre_error_flag;
682
745
}
683
746
 
684
747
/*--------------------------------------------------------------------------
690
753
                                  double  cf_tol   )
691
754
{
692
755
   hypre_PCGData *pcg_data = pcg_vdata;
693
 
   int            ierr = 0;
694
756
 
695
757
   (pcg_data -> cf_tol) = cf_tol;
696
758
 
697
 
   return ierr;
 
759
   return hypre_error_flag;
698
760
}
699
761
 
700
762
int
702
764
                                  double * cf_tol   )
703
765
{
704
766
   hypre_PCGData *pcg_data = pcg_vdata;
705
 
   int            ierr = 0;
706
767
 
707
768
   *cf_tol = (pcg_data -> cf_tol);
708
769
 
709
 
   return ierr;
 
770
   return hypre_error_flag;
710
771
}
711
772
 
712
773
/*--------------------------------------------------------------------------
718
779
                     int   max_iter  )
719
780
{
720
781
   hypre_PCGData *pcg_data = pcg_vdata;
721
 
   int            ierr = 0;
722
782
 
723
783
   (pcg_data -> max_iter) = max_iter;
724
784
 
725
 
   return ierr;
 
785
   return hypre_error_flag;
726
786
}
727
787
 
728
788
int
730
790
                     int * max_iter  )
731
791
{
732
792
   hypre_PCGData *pcg_data = pcg_vdata;
733
 
   int            ierr = 0;
 
793
 
734
794
 
735
795
   *max_iter = (pcg_data -> max_iter);
736
796
 
737
 
   return ierr;
 
797
   return hypre_error_flag;
738
798
}
739
799
 
740
800
/*--------------------------------------------------------------------------
746
806
                     int   two_norm  )
747
807
{
748
808
   hypre_PCGData *pcg_data = pcg_vdata;
749
 
   int            ierr = 0;
 
809
 
750
810
 
751
811
   (pcg_data -> two_norm) = two_norm;
752
812
 
753
 
   return ierr;
 
813
   return hypre_error_flag;
754
814
}
755
815
 
756
816
int
758
818
                     int * two_norm  )
759
819
{
760
820
   hypre_PCGData *pcg_data = pcg_vdata;
761
 
   int            ierr = 0;
 
821
 
762
822
 
763
823
   *two_norm = (pcg_data -> two_norm);
764
824
 
765
 
   return ierr;
 
825
   return hypre_error_flag;
766
826
}
767
827
 
768
828
/*--------------------------------------------------------------------------
774
834
                       int   rel_change  )
775
835
{
776
836
   hypre_PCGData *pcg_data = pcg_vdata;
777
 
   int            ierr = 0;
 
837
 
778
838
 
779
839
   (pcg_data -> rel_change) = rel_change;
780
840
 
781
 
   return ierr;
 
841
   return hypre_error_flag;
782
842
}
783
843
 
784
844
int
786
846
                       int * rel_change  )
787
847
{
788
848
   hypre_PCGData *pcg_data = pcg_vdata;
789
 
   int            ierr = 0;
 
849
 
790
850
 
791
851
   *rel_change = (pcg_data -> rel_change);
792
852
 
793
 
   return ierr;
 
853
   return hypre_error_flag;
 
854
}
 
855
 
 
856
/*--------------------------------------------------------------------------
 
857
 * hypre_PCGSetRecomputeResidual, hypre_PCGGetRecomputeResidual
 
858
 *--------------------------------------------------------------------------*/
 
859
 
 
860
int
 
861
hypre_PCGSetRecomputeResidual( void *pcg_vdata,
 
862
                       int   recompute_residual  )
 
863
{
 
864
   hypre_PCGData *pcg_data = pcg_vdata;
 
865
 
 
866
 
 
867
   (pcg_data -> recompute_residual) = recompute_residual;
 
868
 
 
869
   return hypre_error_flag;
 
870
}
 
871
 
 
872
int
 
873
hypre_PCGGetRecomputeResidual( void *pcg_vdata,
 
874
                       int * recompute_residual  )
 
875
{
 
876
   hypre_PCGData *pcg_data = pcg_vdata;
 
877
 
 
878
 
 
879
   *recompute_residual = (pcg_data -> recompute_residual);
 
880
 
 
881
   return hypre_error_flag;
794
882
}
795
883
 
796
884
/*--------------------------------------------------------------------------
802
890
                       int   stop_crit  )
803
891
{
804
892
   hypre_PCGData *pcg_data = pcg_vdata;
805
 
   int            ierr = 0;
 
893
 
806
894
 
807
895
   (pcg_data -> stop_crit) = stop_crit;
808
896
 
809
 
   return ierr;
 
897
   return hypre_error_flag;
810
898
}
811
899
 
812
900
int
814
902
                       int * stop_crit  )
815
903
{
816
904
   hypre_PCGData *pcg_data = pcg_vdata;
817
 
   int            ierr = 0;
 
905
 
818
906
 
819
907
   *stop_crit = (pcg_data -> stop_crit);
820
908
 
821
 
   return ierr;
 
909
   return hypre_error_flag;
822
910
}
823
911
 
824
912
/*--------------------------------------------------------------------------
830
918
                     HYPRE_Solver *precond_data_ptr )
831
919
{
832
920
   hypre_PCGData *pcg_data = pcg_vdata;
833
 
   int            ierr = 0;
 
921
 
834
922
 
835
923
   *precond_data_ptr = (HYPRE_Solver)(pcg_data -> precond_data);
836
924
 
837
 
   return ierr;
 
925
   return hypre_error_flag;
838
926
}
839
927
 
840
928
/*--------------------------------------------------------------------------
849
937
{
850
938
   hypre_PCGData *pcg_data = pcg_vdata;
851
939
   hypre_PCGFunctions *pcg_functions = pcg_data->functions;
852
 
   int            ierr = 0;
 
940
 
853
941
 
854
942
   (pcg_functions -> precond)       = precond;
855
943
   (pcg_functions -> precond_setup) = precond_setup;
856
944
   (pcg_data -> precond_data)  = precond_data;
857
945
 
858
 
   return ierr;
 
946
   return hypre_error_flag;
859
947
}
860
948
 
861
949
/*--------------------------------------------------------------------------
867
955
                        int   level)
868
956
{
869
957
   hypre_PCGData *pcg_data = pcg_vdata;
870
 
   int            ierr = 0;
 
958
 
871
959
 
872
960
   (pcg_data -> print_level) = level;
873
961
 
874
 
   return ierr;
 
962
   return hypre_error_flag;
875
963
}
876
964
 
877
965
int
879
967
                        int * level)
880
968
{
881
969
   hypre_PCGData *pcg_data = pcg_vdata;
882
 
   int            ierr = 0;
 
970
 
883
971
 
884
972
   *level = (pcg_data -> print_level);
885
973
 
886
 
   return ierr;
 
974
   return hypre_error_flag;
887
975
}
888
976
 
889
977
/*--------------------------------------------------------------------------
895
983
                      int   level)
896
984
{
897
985
   hypre_PCGData *pcg_data = pcg_vdata;
898
 
   int            ierr = 0;
899
986
 
900
987
   (pcg_data -> logging) = level;
901
988
 
902
 
   return ierr;
 
989
   return hypre_error_flag;
903
990
}
904
991
 
905
992
int
907
994
                      int * level)
908
995
{
909
996
   hypre_PCGData *pcg_data = pcg_vdata;
910
 
   int            ierr = 0;
911
997
 
912
998
   *level = (pcg_data -> logging);
913
999
 
914
 
   return ierr;
 
1000
   return hypre_error_flag;
915
1001
}
916
1002
 
917
1003
/*--------------------------------------------------------------------------
923
1009
                           int  *num_iterations )
924
1010
{
925
1011
   hypre_PCGData *pcg_data = pcg_vdata;
926
 
   int            ierr = 0;
927
1012
 
928
1013
   *num_iterations = (pcg_data -> num_iterations);
929
1014
 
930
 
   return ierr;
 
1015
   return hypre_error_flag;
931
1016
}
932
1017
 
933
1018
/*--------------------------------------------------------------------------
939
1024
                       int  *converged)
940
1025
{
941
1026
   hypre_PCGData *pcg_data = pcg_vdata;
942
 
   int            ierr = 0;
943
1027
 
944
1028
   *converged = (pcg_data -> converged);
945
1029
 
946
 
   return ierr;
 
1030
   return hypre_error_flag;
947
1031
}
948
1032
 
949
1033
/*--------------------------------------------------------------------------
962
1046
   double        *rel_norms       = (pcg_data -> rel_norms);
963
1047
 
964
1048
   int            i;
965
 
   int            ierr = 0;
966
1049
 
967
1050
   if (myid == 0)
968
1051
   {
976
1059
      }
977
1060
   }
978
1061
  
979
 
   return ierr;
 
1062
   return hypre_error_flag;
980
1063
}
981
1064
 
982
1065
/*--------------------------------------------------------------------------
989
1072
{
990
1073
   hypre_PCGData *pcg_data = pcg_vdata;
991
1074
 
992
 
   int            ierr = 0;
993
 
   
994
1075
   double         rel_residual_norm = (pcg_data -> rel_residual_norm);
995
1076
 
996
1077
  *relative_residual_norm = rel_residual_norm;
997
1078
   
998
 
   return ierr;
 
1079
   return hypre_error_flag;
999
1080
}
1000
1081