Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_NLS_NOX_FastTests.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_NOX_FastTests.h,v $
27 //
28 // Purpose : Status tests based designed for faster, spice-like convergence
29 //
30 // Special Notes :
31 //
32 // Creator : Richard Schiek
33 //
34 // Creation Date : 12/03/08
35 //
36 // Revision Information:
37 // ---------------------
38 //
39 // Revision Number: $Revision: 1.8 $
40 //
41 // Revision Date : $Date: 2014/02/24 23:49:24 $
42 //
43 // Current Owner : $Author: tvrusso $
44 //-------------------------------------------------------------------------
45 #ifndef Xyce_N_NLS_NOX_FastTests_h
46 #define Xyce_N_NLS_NOX_FastTests_h
47 
48 // ---------- Standard Includes ----------
49 
50 // ---------- Xyce Includes ----------
51 #include <N_NLS_ReturnCodes.h>
52 
53 // ---------- NOX Includes ----------
54 
55 #include <N_NLS_NOX_XyceTests.h> // base class
56 
57 // ---------- Forward Declarations ----------
58 
59 
60 // ---------- Namespace Declarations ----------
61 
62 // N_NLS namespace is for the Xyce Nonlinear Solver Package
63 namespace N_NLS_NOX {
64 
65 //-----------------------------------------------------------------------------
66 // Class : N_NLS_NOX::FastTests
67 //
68 // Purpose :
69 //
70 // NOX Vector Interface for Xyce vectors.
71 //
72 // Creator : Tammy Kolda, SNL, 8950
73 //
74 // Creation Date : 2/1/02
75 //-----------------------------------------------------------------------------
76 
77 class FastTests : public XyceTests {
78 
79 public:
80 
81  //---------------------------------------------------------------------------
82  // Function : FastTests (constructor)
83  //
84  // Purpose : Constructs a NOX-compatiable status test based
85  // the weighted norm of the update.
86  //
87  //---------------------------------------------------------------------------
88  FastTests(bool isTransient,
89  double normF,
90  double machPrec,
91  N_LAS_Vector** currSolVectorPtrPtr,
92  double epsilon_a,
93  double epsilon_r,
94  double tol,
95  int maxIters,
96  double convRate,
97  double relConvRate,
98  double maxConvRate,
99  double stagnationTol,
100  int maxBadSteps,
101  int checkDeviceConvergence,
102  double smallUpdateTol,
103  N_LOA_Loader* loader,
104  std::vector<char> & varTypeVec,
105  double voltZeroTol,
106  double currZeroTol
107 #ifdef Xyce_NLS_MASKED_WRMS_NORMS
108  , bool nonTrivialDeviceMaskFlag,
109  N_LAS_Vector * maskVectorPtr
110 #endif
111  );
112 
113  //---------------------------------------------------------------------------
114  // Function : Destructor
115  //---------------------------------------------------------------------------
116  ~FastTests();
117 
118  //---------------------------------------------------------------------------
119  // Purpose : Test stopping criterion given the current
120  // nonlinear problem
121  //---------------------------------------------------------------------------
122  NOX::StatusTest::StatusType
123  checkStatus(const NOX::Solver::Generic& problem,
124  NOX::StatusTest::CheckType checkType);
125 
126  //---------------------------------------------------------------------------
127  // Purpose : Test stopping criterion given the current
128  // nonlinear problem
129  //---------------------------------------------------------------------------
130  NOX::StatusTest::StatusType getStatus() const { return status_; };
131 
132  //---------------------------------------------------------------------------
133  // Purpose : Get the return code to send to the time stepper.
134  //
135  //---------------------------------------------------------------------------
136  int getXyceReturnCode() const;
137 
138  //---------------------------------------------------------------------------
139  // Purpose : Output formatted description of stopping test to
140  // output stream.
141  //---------------------------------------------------------------------------
142  std::ostream& print(std::ostream& stream, int indent = 0) const;
143 
144  //---------------------------------------------------------------------------
145  // Purpose : Set a specific set of return codes to be used.
146  //---------------------------------------------------------------------------
147  void setReturnCodes (const N_NLS_ReturnCodes & retCodesTmp);
148 
149 private:
150 
151  // vector of variable types
152  std::vector<char> varTypeVec_;
153 
154  // zero tolerances for voltage and current
155  double voltZeroTol_;
156  double currZeroTol_;
157 
158 }; // class FastTests
159 
160 
161 } // namespace N_NLS_NOX
162 
163 #endif // Xyce_N_NLS_NOX_FastTests_h
164 
165