Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_NLS_NOX_ParameterSet.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_ParameterSet.h,v $
27 //
28 // Purpose : Specification file which declares an interface common to
29 // all supported nonlinear solver algorithms. The Manager
30 // class uses this interface to call a concrete algorithm.
31 //
32 // Special Notes : This is the "Strategy" class in the Strategy design
33 // pattern.
34 //
35 // Creator : Scott A. Hutchinson, SNL, Parallel Computational Sciences
36 //
37 // Creation Date : 04/28/00
38 //
39 // Revision Information:
40 // ---------------------
41 //
42 // Revision Number: $Revision: 1.46 $
43 //
44 // Revision Date : $Date: 2014/02/24 23:49:24 $
45 //
46 // Current Owner : $Author: tvrusso $
47 //-------------------------------------------------------------------------
48 
49 #ifndef Xyce_N_NLS_NOX_ParameterSet_h
50 #define Xyce_N_NLS_NOX_ParameterSet_h
51 
52 #include <vector>
53 
54 #include <N_UTL_Misc.h>
55 #include <N_PDS_fwd.h>
56 #include <N_UTL_NoCase.h>
57 
58 #include "NOX.H"
59 #include "Teuchos_RefCountPtr.hpp"
60 
61 class N_LAS_Vector;
62 class N_LAS_System;
63 class N_NLS_ReturnCodes;
64 class N_LOA_Loader;
65 
66 namespace N_NLS_NOX {
67  class AugmentLinSys;
68 }
69 namespace NOX {
70  namespace Status {
71  class Test;
72  }
73 }
74 
75 
76 //-----------------------------------------------------------------------------
77 // Class : N_NLS_NonLinearSolver
78 // Purpose : Nonlinear Solver Abstract Class
79 // Creator : Tammy Kolda, SNL, 8950
80 // Creation Date : 2/5/02
81 //-----------------------------------------------------------------------------
82 
83 namespace N_NLS_NOX {
84 class ParameterSet {
85 
86 public:
87 
89  ~ParameterSet();
90  bool setOptions(const N_UTL_OptionBlock& OB);
91  bool setLocaOptions(const N_UTL_OptionBlock& OB, bool saveCopy=true);
93  {
94  bool ret=true;
96  {
97  ret=setLocaOptions(savedLocaOB_, false);
98  }
99  return ret;
100  }
101 
102  bool setOutputOptions(int myPID, int outputProcess);
103 #ifdef Xyce_NLS_MASKED_WRMS_NORMS
104  bool createStatusTests(N_LAS_Vector** currSolnVectorPtrPtr,
105  N_LOA_Loader& l, vector<char> & varTypeVec,
106  bool nonTrivialDeviceMaskFlag, N_LAS_Vector * maskVectorPtr);
107 #else
108  bool createStatusTests(N_LAS_Vector** currSolnVectorPtrPtr,
109  N_LOA_Loader& l, std::vector<char> & varTypeVec);
110 #endif
111  Teuchos::RefCountPtr<NOX::StatusTest::Generic> getStatusTests();
112  bool getVectorParam (const std::string &, int, double &);
113  bool getVectorParam (const std::string &, int, std::string &);
114  int getVectorParamSize(const std::string& vectorName);
115  int getStatusTestReturnCode() const;
116  void setStatusTestReturnCodes (const N_NLS_ReturnCodes & retCodesTmp);
117 
118  Teuchos::RefCountPtr<Teuchos::ParameterList> getAllParams();
119  Teuchos::RefCountPtr<Teuchos::ParameterList> getNoxParams();
120  Teuchos::RefCountPtr<Teuchos::ParameterList> getLocaParams();
121  Teuchos::RefCountPtr<Teuchos::ParameterList> getDebugParams();
122  int getNoxSolverType() const;
123 
124  inline int getDebugLevel() const
125  {
126  return debugLevel_;
127  };
128 
129  inline int getDebugMinTimeStep() const
130  {
131  return debugMinTimeStep_;
132  };
133 
134  inline int getDebugMaxTimeStep() const
135  {
136  return debugMaxTimeStep_;
137  };
138 
139  inline double getDebugMinTime() const
140  {
141  return debugMinTime_;
142  };
143 
144  inline double getDebugMaxTime() const
145  {
146  return debugMaxTime_;
147  };
148 
149  inline bool getScreenOutputFlag () const
150  {
151  return screenOutputFlag_;
152  };
153 
154  double getMaxNormF() const;
155  int getMaxNormFindex () const;
156 
157  inline bool isParamsSet() const
158  {
159  return isParamsSet_;
160  };
161 
162  inline void set_gstepping_min_value (double val)
163  {
165  }
166 
167  inline void set_gstepping_minimum_conductance (double val)
168  {
170  }
171 
172  Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys>
173  createAugmentLinearSystem(N_LAS_System* ls) const;
174 
175  // Create augmented linear system, DCOP restart version
176 #ifdef Xyce_PARALLEL_MPI
177  Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys>
178  createAugmentLinearSystem(N_LAS_System* ls,
179  Xyce::NodeNamePairMap & op,
180  Xyce::NodeNamePairMap & allNodes, N_PDS_Comm * pdsCommPtr) const;
181 #else
182  Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys>
183  createAugmentLinearSystem(N_LAS_System* ls,
184  Xyce::NodeNamePairMap & op,
185  Xyce::NodeNamePairMap & allNodes) const;
186 #endif
187 
188  // Create augmented linear system, IC version
189  Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys>
190  createAugmentLinearSystem(N_LAS_System* ls,
191  Xyce::NodeNamePairMap & op,
192  bool gminStepping=false) const;
193 
194 private:
195 
196  void unsupportedOption_(const std::string& tag);
197  bool parseOptionBlock_(const N_UTL_OptionBlock& OB);
198 
199 private:
200 
201  Teuchos::RefCountPtr<Teuchos::ParameterList> allParams_;
202  Teuchos::ParameterList& noxParams_;
203  Teuchos::ParameterList& locaParams_;
204  Teuchos::ParameterList& debugParams_;
205  Teuchos::ParameterList statusTestParams_;
206 
207  std::map<std::string, std::vector<N_UTL_Param> > vectorParams;
208 
209  // Combo of all tests
210  Teuchos::RefCountPtr<NOX::StatusTest::Combo> comboPtr_;
211 
212  // Vector containing all the tests we create
213  std::vector< Teuchos::RefCountPtr<NOX::StatusTest::Generic> > tests_;
214 
217 
219 
220  // For special Xyce specific directions (solvers 7 and 8).
221  //NOX::Parameter::DirectionConstructorT<N_NLS_NOX::FastNewton> dirFN;
222  //NOX::Parameter::DirectionConstructorT<N_NLS_NOX::NewtonSDCombo> dirNSDCombo;
223 
225 
226  // This object acts as a factory for the augment system strategy.
231  };
232 
234 
236 
237  // Minimum parameter value used in gstepping
239 
240  // Evil, evil gmin stepping hack, a residual conductance that should almost
241  // always be zero.
243 
245  N_UTL_OptionBlock savedLocaOB_;
246 
247  // debug info:
254 };
255 
256 } // namespace N_NLS_NOX
257 
258 #endif
259