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.49 $
43 //
44 // Revision Date : $Date: 2014/08/07 23:08:54 $
45 //
46 // Current Owner : $Author: dgbaur $
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_NLS_fwd.h>
57 #include <N_UTL_NoCase.h>
58 
59 #include "NOX.H"
60 #include "Teuchos_RefCountPtr.hpp"
61 
62 class N_LAS_Vector;
63 class N_LAS_System;
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 namespace N_NLS_NOX {
83 
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  void setNoxSolverType(int type);
124 
126  {
127  return continuationSpecified_;
128  }
129 
130  inline int getDebugLevel() const
131  {
132  return debugLevel_;
133  };
134 
135  inline int getDebugMinTimeStep() const
136  {
137  return debugMinTimeStep_;
138  };
139 
140  inline int getDebugMaxTimeStep() const
141  {
142  return debugMaxTimeStep_;
143  };
144 
145  inline double getDebugMinTime() const
146  {
147  return debugMinTime_;
148  };
149 
150  inline double getDebugMaxTime() const
151  {
152  return debugMaxTime_;
153  };
154 
155  inline bool getScreenOutputFlag () const
156  {
157  return screenOutputFlag_;
158  };
159 
160  double getMaxNormF() const;
161  int getMaxNormFindex () const;
162 
163  inline bool isParamsSet() const
164  {
165  return isParamsSet_;
166  };
167 
168  inline void set_gstepping_min_value (double val)
169  {
171  }
172 
173  inline void set_gstepping_minimum_conductance (double val)
174  {
176  }
177 
178  Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys>
179  createAugmentLinearSystem(N_LAS_System* ls) const;
180 
181  // Create augmented linear system, DCOP restart version
182 #ifdef Xyce_PARALLEL_MPI
183  Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys>
184  createAugmentLinearSystem(N_LAS_System* ls,
185  Xyce::NodeNamePairMap & op,
186  const Xyce::NodeNamePairMap & allNodes, N_PDS_Comm * pdsCommPtr) const;
187 #else
188  Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys>
189  createAugmentLinearSystem(N_LAS_System* ls,
190  Xyce::NodeNamePairMap & op,
191  const Xyce::NodeNamePairMap & allNodes) const;
192 #endif
193 
194  // Create augmented linear system, IC version
195  Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys>
196  createAugmentLinearSystem(N_LAS_System* ls,
197  Xyce::NodeNamePairMap & op,
198  bool gminStepping=false) const;
199 
200 private:
201 
202  void unsupportedOption_(const std::string& tag);
203  bool parseOptionBlock_(const N_UTL_OptionBlock& OB);
204 
205 private:
206 
207  Teuchos::RefCountPtr<Teuchos::ParameterList> allParams_;
208  Teuchos::ParameterList& noxParams_;
209  Teuchos::ParameterList& locaParams_;
210  Teuchos::ParameterList& debugParams_;
211  Teuchos::ParameterList statusTestParams_;
212 
213  std::map<std::string, std::vector<N_UTL_Param> > vectorParams;
214 
215  // Combo of all tests
216  Teuchos::RefCountPtr<NOX::StatusTest::Combo> comboPtr_;
217 
218  // Vector containing all the tests we create
219  std::vector< Teuchos::RefCountPtr<NOX::StatusTest::Generic> > tests_;
220 
223 
225 
227 
228  // For special Xyce specific directions (solvers 7 and 8).
229  //NOX::Parameter::DirectionConstructorT<N_NLS_NOX::FastNewton> dirFN;
230  //NOX::Parameter::DirectionConstructorT<N_NLS_NOX::NewtonSDCombo> dirNSDCombo;
231 
233 
234  // This object acts as a factory for the augment system strategy.
239  };
240 
242 
244 
245  // Minimum parameter value used in gstepping
247 
248  // Evil, evil gmin stepping hack, a residual conductance that should almost
249  // always be zero.
251 
253  N_UTL_OptionBlock savedLocaOB_;
254 
255  // debug info:
262 };
263 
264 } // namespace N_NLS_NOX
265 
266 #endif
267