Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_NLS_ParamMgr.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_ParamMgr.h,v $
27 //
28 // Purpose :
29 //
30 // Special Notes :
31 //
32 // Creator : Eric R. Keiter
33 //
34 // Creation Date : 10/25/02
35 //
36 // Revision Information:
37 // ----------------------
38 //
39 // Revision Number: $Revision: 1.15 $
40 //
41 // Revision Date : $Date: 2014/08/07 23:08:54 $
42 //
43 // Current Owner : $Author $
44 //-------------------------------------------------------------------------
45 
46 #ifndef Xyce_N_NLS_ParamMgr_h
47 #define Xyce_N_NLS_ParamMgr_h
48 
49 #include <vector>
50 
51 #include <N_IO_fwd.h>
52 
53 #include <N_NLS_NLParams.h>
54 
55 namespace Xyce {
56 namespace Nonlinear {
57 
58 //-----------------------------------------------------------------------------
59 // Class : ParamMgr
60 //
61 // Purpose : It is not unusual for a Xyce simulation to have several
62 // different parameter sets. Each parameter set (for dcop,
63 // transient, etc.) is stored in a NLParams data
64 // structure.
65 //
66 // The management of which parameter set is currently being
67 // used is handled by this class.
68 //
69 // Special Notes :
70 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
71 // Creation Date : 10/26/02
72 //-----------------------------------------------------------------------------
73 class ParamMgr
74 {
75 public:
76  ParamMgr(N_IO_CmdParse & cp);
77  ~ParamMgr();
78 
79  bool addParameterSet (AnalysisMode mode, NLParams & nlp);
80 
81  bool getParams (AnalysisMode mode, NLParams & nlp);
82 
83  bool getCurrentParams (NLParams & nlp);
84  inline bool setAnalysisMode (AnalysisMode mode);
85  inline void resetAnalysisMode();
86  inline AnalysisMode getAnalysisMode() const;
87 
88 protected:
89 private:
90 
91 public:
92 
93 protected:
94 
95 private:
96  std::vector<NLParams> paramVector_;
98 
102 };
103 
104 //-----------------------------------------------------------------------------
105 // Function : ParamMgr::setAnalysisMode
106 // Purpose :
107 // Special Notes :
108 // Scope : public
109 // Creator : Eric R. Keiter, SNL, Computational Sciences
110 // Creation Date : 10/26/02
111 //-----------------------------------------------------------------------------
113 {
114  if (currentMode_ != mode)
115  {
116  paramsChanged_ = true;
117  currentMode_ = mode;
118  }
119  return true;
120 }
121 
122 //-----------------------------------------------------------------------------
123 // Function : ParamMgr::resetAnalysisMode
124 // Purpose :
125 // Special Notes :
126 // Scope : public
127 // Creator : Eric R. Keiter, SNL, Computational Sciences
128 // Creation Date : 10/26/02
129 //-----------------------------------------------------------------------------
131 {
132  if (currentMode_ != DC_OP)
133  {
134  paramsChanged_ = true;
136  }
137 }
138 
139 //-----------------------------------------------------------------------------
140 // Function : ParamMgr::getAnalysisMode
141 // Purpose :
142 // Special Notes :
143 // Scope : public
144 // Creator : Eric R. Keiter, SNL, Computational Sciences
145 // Creation Date : 10/26/02
146 //-----------------------------------------------------------------------------
148 {
149  return currentMode_;
150 }
151 
152 } // namespace Nonlinear
153 } // namespace Xyce
154 
156 
157 #endif
158