Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-2014 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.14 $
58 //
59 // Revision Date : $Date: 2014/08/07 23:08:54 $
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 #include <N_UTL_Xyce.h>
70 
71 namespace Xyce {
72 namespace Nonlinear {
73 
74 //-----------------------------------------------------------------------------
75 // Class : ReturnCodes
76 // Purpose : Container class for solver success/failure return codes.
77 //
78 // Special Notes : Any result that you want the code to perceive as a
79 // "failure" should be <= 0. Any result you want to code
80 // to perceive as a "success" should be >0.
81 //
82 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
83 // Creation Date : 03/27/03
84 //-----------------------------------------------------------------------------
86 {
87 public:
89  normTooSmall (1),
91  nearConvergence (3), // (near convergence, but assume success)
92  smallUpdate (4),
93  nanFail (-6),
94  tooManySteps (-1),
95  tooManyTranSteps (3),
96  updateTooBig (-2),
97  stalled (-3), // (near convergence, but fail anyway)
98  wrmsExactZero (-4),
99  innerSolveFailed (-5)
100  {};
101 
102 public:
103  int normTooSmall; // default = 1
104  int normalConvergence; // default = 2
105  int nearConvergence; // default = 3
106  int smallUpdate; // default = 4
107  int nanFail; // default = -6
108  int tooManySteps; // default = -1
109  int tooManyTranSteps; // default = 3
110  int updateTooBig; // default = -2
111  int stalled; // default = -3;
112  int wrmsExactZero; // default = -4;
113  int innerSolveFailed; // default = -5;
114 };
115 
116 std::ostream & operator<<(std::ostream & os, const ReturnCodes & rc);
117 
118 } // namespace Nonlinear
119 } // namespace Xyce
120 
122 
123 
124 #endif // Xyce_N_NLS_ReturnCodes_h
125