Ifpack Package Browser (Single Doxygen Collection)
Development
src
az_ifpack_iterate.c
Go to the documentation of this file.
1
/*@HEADER
2
// ***********************************************************************
3
//
4
// Ifpack: Object-Oriented Algebraic Preconditioner Package
5
// Copyright (2002) Sandia Corporation
6
//
7
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8
// license for use of this work by or on behalf of the U.S. Government.
9
//
10
// Redistribution and use in source and binary forms, with or without
11
// modification, are permitted provided that the following conditions are
12
// met:
13
//
14
// 1. Redistributions of source code must retain the above copyright
15
// notice, this list of conditions and the following disclaimer.
16
//
17
// 2. Redistributions in binary form must reproduce the above copyright
18
// notice, this list of conditions and the following disclaimer in the
19
// documentation and/or other materials provided with the distribution.
20
//
21
// 3. Neither the name of the Corporation nor the names of the
22
// contributors may be used to endorse or promote products derived from
23
// this software without specific prior written permission.
24
//
25
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
//
37
// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38
//
39
// ***********************************************************************
40
//@HEADER
41
*/
42
43
/*
44
* This code is a wrapper layer around AZTEC. It takes the real and imaginary
45
* parts of a complex valued linear system and forms an equivalent real system,
46
* calls AZTEC to solve the real system and returns the solution.
47
*/
48
49
#include <stdio.h>
50
#include <stdlib.h>
51
#include <math.h>
52
#include <std::string.h>
53
#include "az_aztec.h"
54
#include "
az_ifpack.h
"
55
56
void
AZ_ifpack_iterate
(
double
*x,
double
*b,
57
int
*options,
double
*params,
58
double
*status,
int
*proc_config,
59
AZ_MATRIX *Amat )
60
61
/*******************************************************************************
62
63
Author: Mike Heroux, SNL, 9222
64
=======
65
66
Return code: void
67
============
68
69
Parameter list:
70
===============
71
72
x: On input, contains the initial guess, On output
73
contains the solution to
74
the linear system.
75
76
b: Right hand side of linear system.
77
78
options: Determines specific solution method and other parameters.
79
80
params: Drop tolerance and convergence tolerance info.
81
82
status: On output, indicates termination status:
83
0: terminated normally.
84
-1: maximum number of iterations taken without achieving
85
convergence.
86
-2: Breakdown. The algorithm can not proceed due to
87
numerical difficulties (usually a divide by zero).
88
-3: Internal residual differs from the computed residual due
89
to a significant loss of precision.
90
91
proc_config: Machine configuration. proc_config[AZ_node] is the node
92
number. proc_config[AZ_N_procs] is the number of processors.
93
94
Amat: The matrix operator, stored as an AZ_MATRIX structure.
95
96
Internal Parameter list:
97
========================
98
99
x: Komplex version of initial guess and solution.
100
b: Komplex version of RHS.
101
Prec: Preconditioner stored as an AZ_PRECOND structure.
102
103
Overview
104
========
105
106
*******************************************************************************/
107
108
109
{
110
111
AZ_PRECOND *Prec;
/* Structure representing entire preconditioner. */
112
/* */
113
114
AZ_ifpack_prec_create
(x, b, options, params, proc_config, Amat, &Prec);
115
116
/* solve linear system using Aztec. */
117
118
AZ_iterate(x, b, options, params, status, proc_config, Amat, Prec, NULL);
119
120
AZ_ifpack_prec_destroy
(options, params, proc_config, Amat, Prec);
121
122
/* AZ_ifpack_iterate*/
123
}
AZ_ifpack_iterate
void AZ_ifpack_iterate(double *x, double *b, int *options, double *params, double *status, int *proc_config, AZ_MATRIX *Amat)
Definition:
az_ifpack_iterate.c:56
AZ_ifpack_prec_destroy
void AZ_ifpack_prec_destroy(int *options, double *params, int *proc_config, AZ_MATRIX *Amat, AZ_PRECOND *Prec)
Definition:
az_ifpack_prec_destroy.c:52
AZ_ifpack_prec_create
void AZ_ifpack_prec_create(double *x, double *b, int *options, double *params, int *proc_config, AZ_MATRIX *Amat, AZ_PRECOND **Prec)
Definition:
az_ifpack_prec_create.c:52
az_ifpack.h
Generated by
1.8.16