Xyce  6.1
N_ANP_DCSweep.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-2015 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_ANP_DCSweep.h,v $
27 //
28 // Purpose : DC sweep analysis class
29 //
30 // Special Notes : Specify any "hidden" or subtle details of the class here.
31 // Portability details, error handling information, etc.
32 //
33 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
34 //
35 // Creation Date : 01/24/08
36 //
37 // Revision Information:
38 // ---------------------
39 //
40 // Revision Number: $Revision: 1.57 $
41 //
42 // Revision Date : $Date: 2015/10/27 19:24:39 $
43 //
44 // Current Owner : $Author: tvrusso $
45 //-----------------------------------------------------------------------------
46 
47 #ifndef Xyce_N_ANP_DCSweep_h
48 #define Xyce_N_ANP_DCSweep_h
49 
50 // ---------- Xyce Includes ----------
51 #include <N_ANP_fwd.h>
52 #include <N_TOP_fwd.h>
53 
54 #include <N_ANP_AnalysisBase.h>
55 #include <N_ANP_RegisterAnalysis.h>
56 #include <N_UTL_OptionBlock.h>
57 
58 namespace Xyce {
59 namespace Analysis {
60 
61 //-------------------------------------------------------------------------
62 // Class : DCSweep
63 // Purpose : Transient analysis class
64 // Special Notes :
65 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
66 // Creation Date : 01/24/08
67 //-------------------------------------------------------------------------
68 class DCSweep : public AnalysisBase
69 {
70 public:
71  DCSweep(
72  AnalysisManager & analysis_manager,
73  Nonlinear::Manager & nonlinear_manager,
74  Loader::Loader & loader,
75  Topo::Topology & topology,
76  IO::InitialConditionsManager & initial_conditions_manager,
77  HB * hb_analysis = 0); // HACK TO GET US MOVING FORWARD, should pass output adapter or something
78 
79  virtual ~DCSweep();
80 
81  void setTIAParams(const TimeIntg::TIAParams &tia_params)
82  {
83  tiaParams_ = tia_params;
84  }
85 
87  {
88  return tiaParams_;
89  }
90 
92  {
93  return tiaParams_;
94  }
95 
96  bool setAnalysisParams(const Util::OptionBlock & paramsBlock); // override;
97  bool setTimeIntegratorOptions(const Util::OptionBlock &option_block);
98 
99  bool outputFailureStats(std::ostream &os);
100 
101  bool getDCOPFlag() const // override
102  {
103  return true;
104  }
105 
106 protected:
107  bool doRun(); // override;
108  bool doInit(); // override;
109  bool doLoopProcess(); // override;
110  bool doProcessSuccessfulStep(); // override;
111  bool doProcessFailedStep(); // override;
112  bool doFinish(); // override;
113  bool doHandlePredictor(); // override;
114 
115 public:
116  // Two Level specific
117  bool twoLevelStep();
118 
119  void printStepHeader(std::ostream &os);
120  bool printLoopInfo(int start, int finish);
121 
122 private:
123  void dcSweepOutput();
124  void initializeSolution_();
125  void takeStep_ ();
126 
127 private:
131  Topo::Topology & topology_;
132  IO::InitialConditionsManager & initialConditionsManager_;
136  bool sensFlag_;
139  std::vector<int> dcSweepFailures_;
141  std::vector<double> objectiveVec_;
142  std::vector<double> dOdpVec_;
143  std::vector<double> dOdpAdjVec_;
144  std::vector<double> scaled_dOdpVec_;
145  std::vector<double> scaled_dOdpAdjVec_;
146 };
147 
148 bool registerDCSweepFactory(FactoryBlock &factory_block);
149 
150 } // namespace Analysis
151 } // namespace Xyce
152 
153 #endif
bool printLoopInfo(int start, int finish)
AnalysisManager & analysisManager_
std::vector< double > objectiveVec_
Pure virtual class to augment a linear system.
std::vector< double > dOdpVec_
IO::InitialConditionsManager & initialConditionsManager_
DCSweep(AnalysisManager &analysis_manager, Nonlinear::Manager &nonlinear_manager, Loader::Loader &loader, Topo::Topology &topology, IO::InitialConditionsManager &initial_conditions_manager, HB *hb_analysis=0)
Definition: N_ANP_DCSweep.C:83
OutputMgrAdapter & outputManagerAdapter_
void setTIAParams(const TimeIntg::TIAParams &tia_params)
Definition: N_ANP_DCSweep.h:81
std::vector< int > dcSweepFailures_
bool outputFailureStats(std::ostream &os)
std::vector< double > dOdpAdjVec_
const TimeIntg::TIAParams & getTIAParams() const
Definition: N_ANP_DCSweep.h:86
std::vector< double > scaled_dOdpAdjVec_
bool setTimeIntegratorOptions(const Util::OptionBlock &option_block)
Nonlinear::Manager & nonlinearManager_
The FactoryBlock contains parameters needed by the analysis creation functions.
Loader::Loader & loader_
void printStepHeader(std::ostream &os)
std::vector< double > scaled_dOdpVec_
TimeIntg::TIAParams tiaParams_
bool getDCOPFlag() const
std::vector< SweepParam > SweepVector
Definition: N_ANP_fwd.h:94
bool registerDCSweepFactory(FactoryBlock &factory_block)
bool setAnalysisParams(const Util::OptionBlock &paramsBlock)
TimeIntg::TIAParams & getTIAParams()
Definition: N_ANP_DCSweep.h:91
Topo::Topology & topology_