1 /**
2  *  @ingroup PMGC
3  *  @author  Tucker Beck [fortran ->c translation], Michael Holst [original]
4  *  @brief Driver routines for the Newton method
5  *
6  *  @attention
7  *  @verbatim
8  *
9  * APBS -- Adaptive Poisson-Boltzmann Solver
10  *
11  * Nathan A. Baker (nathan.baker@pnl.gov)
12  * Pacific Northwest National Laboratory
13  *
14  * Additional contributing authors listed in the code documentation.
15  *
16  * Copyright (c) 2010-2014 Battelle Memorial Institute. Developed at the Pacific Northwest National Laboratory, operated by Battelle Memorial Institute, Pacific Northwest Division for the U.S. Department Energy.  Portions Copyright (c) 2002-2010, Washington University in St. Louis.  Portions Copyright (c) 2002-2010, Nathan A. Baker.  Portions Copyright (c) 1999-2002, The Regents of the University of California. Portions Copyright (c) 1995, Michael Holst.
17  * All rights reserved.
18  *
19  *
20  * Redistribution and use in source and binary forms, with or without
21  * modification, are permitted provided that the following conditions are met:
22  *
23  * -  Redistributions of source code must retain the above copyright notice, this
24  * list of conditions and the following disclaimer.
25  *
26  * - Redistributions in binary form must reproduce the above copyright notice,
27  * this list of conditions and the following disclaimer in the documentation
28  * and/or other materials provided with the distribution.
29  *
30  * - Neither the name of Washington University in St. Louis nor the names of its
31  * contributors may be used to endorse or promote products derived from this
32  * software without specific prior written permission.
33  *
34  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
35  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
36  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
37  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
38  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
39  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
40  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
41  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
42  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
43  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
44  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45  *
46  * @endverbatim
47  */
48 
49 #ifndef _NEWTOND_H_
50 #define _NEWTOND_H_
51 
52 #include "apbscfg.h"
53 
54 #include "maloc/maloc.h"
55 
56 #include "generic/vhal.h"
57 #include "generic/vmatrix.h"
58 #include "pmgc/matvecd.h"
59 #include "pmgc/mikpckd.h"
60 #include "pmgc/mgcsd.h"
61 #include "pmgc/mgsubd.h"
62 #include "pmgc/powerd.h"
63 
64 /** @brief   Nested iteration for an inexact-newton-multilevel method.
65  *  @ingroup PMGC
66  *  @author  Tucker Beck [C Translation], Michael Holst [Original]
67  *
68  *  @note    Replaces fnewton from newtond.f
69  */
70 VPUBLIC void Vfnewton(
71         int *nx,        ///< @todo: Doc
72         int *ny,        ///< @todo: Doc
73         int *nz,        ///< @todo: Doc
74         double *x,      ///< @todo: Doc
75         int *iz,        ///< @todo: Doc
76         double *w0,     ///< @todo: Doc
77         double *w1,     ///< @todo: Doc
78         double *w2,     ///< @todo: Doc
79         double *w3,     ///< @todo: Doc
80         int *istop,     ///< @todo: Doc
81         int *itmax,     ///< @todo: Doc
82         int *iters,     ///< @todo: Doc
83         int *ierror,    ///< @todo: Doc
84         int *nlev,      ///< @todo: Doc
85         int *ilev,      ///< @todo: Doc
86         int *nlev_real, ///< @todo: Doc
87         int *mgsolv,    ///< @todo: Doc
88         int *iok,       ///< @todo: Doc
89         int *iinfo,     ///< @todo: Doc
90         double *epsiln, ///< @todo: Doc
91         double *errtol, ///< @todo: Doc
92         double *omega,  ///< @todo: Doc
93         int *nu1,       ///< @todo: Doc
94         int *nu2,       ///< @todo: Doc
95         int *mgsmoo,    ///< @todo: Doc
96         double *cprime, ///< @todo: Doc
97         double *rhs,    ///< @todo: Doc
98         double *xtmp,   ///< @todo: Doc
99         int *ipc,       ///< @todo: Doc
100         double *rpc,    ///< @todo: Doc
101         double *pc,     ///< @todo: Doc
102         double *ac,     ///< @todo: Doc
103         double *cc,     ///< @todo: Doc
104         double *fc,     ///< @todo: Doc
105         double *tru     ///< @todo: Doc
106         );
107 
108 /** @brief   Inexact-newton-multilevel method.
109  *  @ingroup PMGC
110  *  @author  Tucker Beck [C Translation], Michael Holst [Original]
111  *
112  *  @note    Replaces newton from newtond.f
113  */
114 VEXTERNC void Vnewton(
115         int *nx,        ///< @todo: Doc
116         int *ny,        ///< @todo: Doc
117         int *nz,        ///< @todo: Doc
118         double *x,      ///< @todo: Doc
119         int *iz,        ///< @todo: Doc
120         double *w0,     ///< @todo: Doc
121         double *w1,     ///< @todo: Doc
122         double *w2,     ///< @todo: Doc
123         double *w3,     ///< @todo: Doc
124         int *istop,     ///< @todo: Doc
125         int *itmax,     ///< @todo: Doc
126         int *iters,     ///< @todo: Doc
127         int *ierror,    ///< @todo: Doc
128         int *nlev,      ///< @todo: Doc
129         int *ilev,      ///< @todo: Doc
130         int *nlev_real, ///< @todo: Doc
131         int *mgsolv,    ///< @todo: Doc
132         int *iok,       ///< @todo: Doc
133         int *iinfo,     ///< @todo: Doc
134         double *epsiln, ///< @todo: Doc
135         double *errtol, ///< @todo: Doc
136         double *omega,  ///< @todo: Doc
137         int *nu1,       ///< @todo: Doc
138         int *nu2,       ///< @todo: Doc
139         int *mgsmoo,    ///< @todo: Doc
140         double *cprime, ///< @todo: Doc
141         double *rhs,    ///< @todo: Doc
142         double *xtmp,   ///< @todo: Doc
143         int *ipc,       ///< @todo: Doc
144         double *rpc,    ///< @todo: Doc
145         double *pc,     ///< @todo: Doc
146         double *ac,     ///< @todo: Doc
147         double *cc,     ///< @todo: Doc
148         double *fc,     ///< @todo: Doc
149         double *tru     ///< @todo: Doc
150         );
151 
152 
153 /** @brief   Form the jacobian system.
154  *  @ingroup PMGC
155  *  @author  Tucker Beck [C Translation], Michael Holst [Original]
156  *
157  *  @note    Replaces getjac from newtond.f
158  */
159 VEXTERNC void Vgetjac(
160         int *nx,        ///< @todo: Doc
161         int *ny,        ///< @todo: Doc
162         int *nz,        ///< @todo: Doc
163         int *nlev_real, ///< @todo: Doc
164         int *iz,        ///< @todo: Doc
165         int *lev,       ///< @todo: Doc
166         int *ipkey,     ///< @todo: Doc
167         double *x,      ///< @todo: Doc
168         double *r,      ///< @todo: Doc
169         double *cprime, ///< @todo: Doc
170         double *rhs,    ///< @todo: Doc
171         double *cc,     ///< @todo: Doc
172         double *pc      ///< @todo: Doc
173         );
174 
175 #endif /* _NEWTOND_H_ */
176