Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_ANP_OutputMgrAdapter.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 // Filename : $RCSfile: N_ANP_OutputMgrAdapter.h,v $
26 //
27 // Purpose :
28 //
29 // Special Notes :
30 //
31 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
32 //
33 // Creation Date : 01/24/08
34 //
35 // Revision Information:
36 // ---------------------
37 //
38 // Revision Number: $Revision: 1.52.2.2 $
39 //
40 // Revision Date : $Date: 2014/08/25 20:12:48 $
41 //
42 // Current Owner : $Author: dgbaur $
43 //-----------------------------------------------------------------------------
44 
45 #ifndef Xyce_N_ANP_OutputMgrAdapter_h
46 #define Xyce_N_ANP_OutputMgrAdapter_h
47 
48 #include <Teuchos_SerialDenseMatrix.hpp>
49 
50 #include <N_ANP_fwd.h>
51 #include <N_IO_fwd.h>
52 #include <N_LAS_fwd.h>
53 #include <N_PDS_fwd.h>
54 #include <N_UTL_fwd.h>
55 
56 #include <N_UTL_Listener.h>
57 #include <N_ANP_StepEvent.h>
58 
59 namespace Xyce {
60 namespace Analysis {
61 
62 //-------------------------------------------------------------------------
63 // Class : OutputMgrAdapter
64 // Purpose : Inteface class for the output manager
65 // Special Notes :
66 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
67 // Creation Date : 01/24/08
68 //-------------------------------------------------------------------------
69 class OutputMgrAdapter : public Util::ListenerAutoSubscribe<StepEvent>
70 {
71 public:
72  OutputMgrAdapter(Parallel::Machine comm, Util::Notifier<StepEvent> &step_notifier);
73 
74  virtual ~OutputMgrAdapter();
75 
76  void notify(const StepEvent &event);
77 
78  void registerOutputMgr(IO::OutputMgr * outputMgrPtr)
79  {
80  outputManager_ = outputMgrPtr;
81  }
82 
83  void addOutputResults(const Util::OptionBlock & option_block);
84  void addOutputResponse(const Util::OptionBlock & option_block);
85 
86  void setStepParamVec(const std::vector<SweepParam> & paramVec);
87 
88  void setDCParamVec(const std::vector<SweepParam> & paramVec);
89 
90  const std::vector<SweepParam> &getStepParamVec() const
91  {
92  return *stepParamVector_;
93  }
94 
95  const std::vector<SweepParam> &getDCParamVec() const
96  {
97  return dcParamVector_;
98  }
99 
100  // accessor methods
102  {
104  }
105 
107  {
108  return dcAnalysisStepNumber_;
109  }
110 
112  {
113  return dcAnalysisMaxSteps_;
114  }
115 
116  IO::OutputMgr &getOutputManager()
117  {
118  return *outputManager_;
119  }
120 
121  void setDCAnalysisStepNumber( int num )
122  {
123  dcAnalysisStepNumber_ = num;
124  }
125 
126  void setDCAnalysisMaxSteps( int num )
127  {
128  dcAnalysisMaxSteps_ = num;
129  }
130 
131  void tranOutput(
132  double time, N_LAS_Vector & currSolutionPtr, N_LAS_Vector & stateVecPtr, N_LAS_Vector & storeVecPtr,
133  std::vector<double> & objectiveVec_,
134  std::vector<double> & dOdpVec_,
135  std::vector<double> & dOdpAdjVec_,
136  std::vector<double> & scaled_dOdpVec_,
137  std::vector<double> & scaled_dOdpAdjVec_,
138  bool skipPrintLineOutput = false);
139 
140  void dcOutput(
141  int dcStepNumber,
142  N_LAS_Vector & currSolutionPtr, N_LAS_Vector & stateVecPtr, N_LAS_Vector & storeVecPtr,
143  std::vector<double> & objectiveVec_,
144  std::vector<double> & dOdpVec_,
145  std::vector<double> & dOdpAdjVec_,
146  std::vector<double> & scaled_dOdpVec_,
147  std::vector<double> & scaled_dOdpAdjVec_);
148 
149  void outputResult(const N_LAS_Vector &currSolutionPtr, const N_LAS_Vector &currStatePtr, const N_LAS_Vector &currStorePtr );
150 
151  void steppingComplete();
152 
153  void finishOutput();
154 
155  bool setupInitialConditions ( N_LAS_Vector & solnVec, N_LAS_Vector & flagVec);
156 
157  void outputDCOP(const N_LAS_Vector &solution);
158 
159  void outputMPDE( double time, const std::vector<double> &fast_time_points, const N_LAS_Vector & solution_vector);
160 
161  void outputHB(
162  const std::vector< double > & timePoints, const std::vector< double > & freqPoints,
163  const N_LAS_BlockVector & timeDomainSolnVec, const N_LAS_BlockVector & freqDomainSolnVecReal,
164  const N_LAS_BlockVector & freqDomainSolnVecImaginary, const N_LAS_BlockVector & timeDomainStoreVec,
165  const N_LAS_BlockVector & freqDomainStoreVecReal, const N_LAS_BlockVector & freqDomainStoreVecImaginary);
166 
167  void outputAC(double freq, const N_LAS_Vector & solnVecRealPtr, const N_LAS_Vector & solnVecImaginaryPtr);
168 
169  void outputMORTF(bool origSys, double freq, const Teuchos::SerialDenseMatrix<int, std::complex<double> >& H );
170 
171  void resetOutputMORTF();
172 
173  void outputROM(
174  const Teuchos::SerialDenseMatrix<int, double>& Ghat, const Teuchos::SerialDenseMatrix<int, double>& Chat,
175  const Teuchos::SerialDenseMatrix<int, double>& Bhat, const Teuchos::SerialDenseMatrix<int, double>& Lhat );
176 
177  void outputROM(
178  const N_LAS_Matrix& Ghat, const N_LAS_Matrix& Chat,
179  const Teuchos::SerialDenseMatrix<int, double>& Bhat,
180  const Teuchos::SerialDenseMatrix<int, double>& Lhat );
181 
182  bool getOutputIntervals(double & initialInterval, std::vector<std::pair< double, double > > * intervalPairs) const;
183 
184  void outputHomotopy( const std::vector<std::string> & paramNames, const std::vector<double> & paramVals, N_LAS_Vector & solnVecPtr );
185 
186  const Xyce::NodeNamePairMap & getAllNodes() const;
187 
188 private:
189  Parallel::Machine comm_;
190  IO::OutputMgr * outputManager_;
191  IO::Measure::Manager * measureManager_;
192  IO::FourierMgr * fourierManager_;
193  IO::OutputMOR * outputMOR_;
194  IO::OutputResults * outputResults_;
195  IO::OutputResponse * outputResponse_;
196 
197  std::vector<SweepParam> emptyParamVector_;
198  const std::vector<SweepParam> * stepParamVector_;
199  std::vector<SweepParam> dcParamVector_;
200 
205 };
206 
207 } // namespace Analysis
208 } // namespace Xyce
209 
211 
212 #endif // Xyce_N_ANP_OutputMgrAdapter_h