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.13 $
58 //
59 // Revision Date : $Date: 2014/02/24 23:49:24 $
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 //-----------------------------------------------------------------------------
72 // Class : N_NLS_ReturnCodes
73 // Purpose : Container class for solver success/failure return codes.
74 //
75 // Special Notes : Any result that you want the code to perceive as a
76 // "failure" should be <= 0. Any result you want to code
77 // to perceive as a "success" should be >0.
78 //
79 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
80 // Creation Date : 03/27/03
81 //-----------------------------------------------------------------------------
83 {
84 public:
86  normTooSmall (1),
88  nearConvergence (3), // (near convergence, but assume success)
89  smallUpdate (4),
90  nanFail (-6),
91  tooManySteps (-1),
92  tooManyTranSteps (3),
93  updateTooBig (-2),
94  stalled (-3), // (near convergence, but fail anyway)
95  wrmsExactZero (-4),
96  innerSolveFailed (-5)
97  {};
98 
99 public:
100  int normTooSmall; // default = 1
101  int normalConvergence; // default = 2
102  int nearConvergence; // default = 3
103  int smallUpdate; // default = 4
104  int nanFail; // default = -6
105  int tooManySteps; // default = -1
106  int tooManyTranSteps; // default = 3
107  int updateTooBig; // default = -2
108  int stalled; // default = -3;
109  int wrmsExactZero; // default = -4;
110  int innerSolveFailed; // default = -5;
111 };
112 
113 std::ostream & operator<<(std::ostream & os, const N_NLS_ReturnCodes & rc);
114 
115 #endif // Xyce_N_NLS_ReturnCodes_h
116