Xyce  6.1
N_NLS_ReturnCodes.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // Copyright Notice
3 //
4 // Copyright 2002 Sandia Corporation. Under the terms
5 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
6 // Government retains certain rights in this software.
7 //
8 // Xyce(TM) Parallel Electrical Simulator
9 // Copyright (C) 2002-2015 Sandia Corporation
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //-----------------------------------------------------------------------------
24 
25 //-------------------------------------------------------------------------
26 // Filename : $RCSfile: N_NLS_ReturnCodes.h,v $
27 //
28 // Purpose : This is a simple container class for different convergence
29 // status "return codes".
30 //
31 // Special Notes : This point of having a class like this is to make the
32 // code more flexible in terms of what is considered to be
33 // a successful Newton solve.
34 //
35 // In the class N_NLS_DampedNewton, the function
36 // "converged_" performs a series of tests to determine
37 // convergence status, and depending on the results of
38 // these tests, it returns a value. If the value is
39 // positive, then the solve is considered to be converged,
40 // and if it is <=0, it isn't.
41 //
42 // This convention is used both inside the damped newton
43 // class, and outside. It is used inside when the solver
44 // is trying to determine for itself whether or not to
45 // continue with the solve, or exit. It is used outside
46 // by the time integrator, and also by continuation loops
47 // in the 2-level solver, in determining if the step was
48 // successful.
49 //
50 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
51 //
52 // Creation Date : 03/27/03
53 //
54 // Revision Information:
55 // ----------------------
56 //
57 // Revision Number: $Revision: 1.17.2.1 $
58 //
59 // Revision Date : $Date: 2015/04/02 18:20:17 $
60 //
61 // Current Owner : $Author $
62 //-------------------------------------------------------------------------
63 
64 #ifndef Xyce_N_NLS_ReturnCodes_h
65 #define Xyce_N_NLS_ReturnCodes_h
66 
67 #include <iosfwd>
68 
69 namespace Xyce {
70 namespace Nonlinear {
71 
72 //-----------------------------------------------------------------------------
73 // Class : ReturnCodes
74 // Purpose : Container class for solver success/failure return codes.
75 //
76 // Special Notes : Any result that you want the code to perceive as a
77 // "failure" should be <= 0. Any result you want to code
78 // to perceive as a "success" should be >0.
79 //
80 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
81 // Creation Date : 03/27/03
82 //-----------------------------------------------------------------------------
84 {
85 public:
87  : normTooSmall (1),
89  nearConvergence (-3), // (near convergence, but assume failure)
90  smallUpdate (4),
91  nanFail (-6),
92  tooManySteps (-1),
93  tooManyTranSteps (3),
94  updateTooBig (-2),
95  stalled (-3), // (near convergence, but fail anyway)
96  wrmsExactZero (-4),
97  innerSolveFailed (-5)
98  {}
99 
100 public:
101  int normTooSmall; // default = 1
102  int normalConvergence; // default = 2
103  int nearConvergence; // default = 3
104  int smallUpdate; // default = 4
105  int nanFail; // default = -6
106  int tooManySteps; // default = -1
107  int tooManyTranSteps; // default = 3
108  int updateTooBig; // default = -2
109  int stalled; // default = -3;
110  int wrmsExactZero; // default = -4;
111  int innerSolveFailed; // default = -5;
112 };
113 
114 std::ostream & operator<<(std::ostream & os, const ReturnCodes & rc);
115 
116 } // namespace Nonlinear
117 } // namespace Xyce
118 
119 #endif // Xyce_N_NLS_ReturnCodes_h
120 
Pure virtual class to augment a linear system.
std::ostream & operator<<(std::ostream &os, const ReturnCodes &rc)