az_ifpack_iterate.c

```00001 /*@HEADER
00002 // ***********************************************************************
00003 //
00004 //       Ifpack: Object-Oriented Algebraic Preconditioner Package
00005 //                 Copyright (2002) Sandia Corporation
00006 //
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 //
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00014 //
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00025 //
00026 // ***********************************************************************
00028 */
00029
00030 /*
00031  * This code is a wrapper layer around AZTEC.  It takes the real and imaginary
00032  * parts of a complex valued linear system and forms an equivalent real system,
00033  * calls AZTEC to solve the real system and returns the solution.
00034  */
00035
00036 #include <stdio.h>
00037 #include <stdlib.h>
00038 #include <math.h>
00039 #include <string.h>
00040 #include "az_aztec.h"
00041 #include "az_ifpack.h"
00042
00043 void AZ_ifpack_iterate(double *x, double *b,
00044             int *options, double *params,
00045             double *status, int *proc_config,
00046             AZ_MATRIX *Amat )
00047
00048 /*******************************************************************************
00049
00050   Author:          Mike Heroux, SNL, 9222
00051   =======
00052
00053   Return code:     void
00054   ============
00055
00056   Parameter list:
00057   ===============
00058
00059   x:               On input, contains the initial guess, On output
00060                    contains the solution to
00061                    the linear system.
00062
00063   b:               Right hand side of linear system.
00064
00065   options:         Determines specific solution method and other parameters.
00066
00067   params:          Drop tolerance and convergence tolerance info.
00068
00069   status:          On output, indicates termination status:
00070                     0:  terminated normally.
00071                    -1:  maximum number of iterations taken without achieving
00072                         convergence.
00073                    -2:  Breakdown. The algorithm can not proceed due to
00074                         numerical difficulties (usually a divide by zero).
00075                    -3:  Internal residual differs from the computed residual due
00076                         to a significant loss of precision.
00077
00078   proc_config:     Machine configuration.  proc_config[AZ_node] is the node
00079                    number.  proc_config[AZ_N_procs] is the number of processors.
00080
00081  Amat:             The matrix operator, stored as an AZ_MATRIX structure.
00082
00083   Internal Parameter list:
00084   ========================
00085
00086  x:                Komplex version of initial guess and solution.
00087  b:                Komplex version of RHS.
00088  Prec:             Preconditioner stored as an AZ_PRECOND structure.
00089
00090   Overview
00091   ========
00092
00093 *******************************************************************************/
00094
00095
00096 {
00097
00098 AZ_PRECOND *Prec;    /* Structure representing entire preconditioner.        */
00099                     /*                                                      */
00100
00101    AZ_ifpack_prec_create (x, b, options,  params, proc_config, Amat, &Prec);
00102
00103    /* solve linear system using Aztec. */
00104
00105    AZ_iterate(x, b, options, params, status, proc_config, Amat, Prec, NULL);
00106
00107    AZ_ifpack_prec_destroy (options,  params, proc_config, Amat, Prec);
00108
00109 /* AZ_ifpack_iterate*/
00110 }
```

Generated on Tue Jul 13 09:27:12 2010 for IFPACK by  1.4.7