Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_NLS_ReturnCodes.C
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.C,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.4 $
58 //
59 // Revision Date : $Date: 2014/08/07 23:08:54 $
60 //
61 // Current Owner : $Author $
62 //-------------------------------------------------------------------------
63 
64 #include <iostream>
65 
66 #include <N_NLS_ReturnCodes.h>
67 #include <N_ERH_ErrorMgr.h>
68 
69 namespace Xyce {
70 namespace Nonlinear {
71 
72 //-----------------------------------------------------------------------------
73 // Function : ReturnCodes::operator<<
74 // Purpose : "<<" operator
75 // Special Notes :
76 // Scope : public
77 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
78 // Creation Date : 7/02/03
79 //-----------------------------------------------------------------------------
80 std::ostream & operator<<(std::ostream & os, const ReturnCodes & rc)
81 {
82  os << "\n\n-----------------------------------------" << std::endl
83  << "\tNonlinear Solver Return Codes:\n"
84  << "\t\tnormTooSmall = " << rc.normTooSmall << "\n"
85  << "\t\tnormalConvergence = " << rc.normalConvergence << "\n"
86  << "\t\tnearConvergence = " << rc.nearConvergence << "\n"
87  << "\t\tsmallUpdate = " << rc.smallUpdate << "\n"
88  << "\t\tnanFail = " << rc.nanFail << "\n"
89  << "\t\ttooManySteps = " << rc.tooManySteps << "\n"
90  << "\t\ttooManyTranSteps = " << rc.tooManyTranSteps << "\n"
91  << "\t\tupdateTooBig = " << rc.updateTooBig << "\n"
92  << "\t\tstalled = " << rc.stalled << "\n"
93  << "\t\twrmsExactZero = " << rc.wrmsExactZero << "\n"
94  << Xyce::section_divider << std::endl
95  << std::endl;
96 
97  return os;
98 }
99 
100 } // namespace Nonlinear
101 } // namespace Xyce