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.38 $
39 //
40 // Revision Date : $Date: 2014/02/24 23:49:12 $
41 //
42 // Current Owner : $Author: tvrusso $
43 //-----------------------------------------------------------------------------
44 
45 #ifndef Xyce_N_ANP_OutputMgrAdapter_h
46 #define Xyce_N_ANP_OutputMgrAdapter_h
47 
48 #include <Teuchos_RefCountPtr.hpp>
49 using Teuchos::RefCountPtr;
50 using Teuchos::rcp;
51 #include <Teuchos_SerialDenseMatrix.hpp>
52 
53 #include <N_UTL_Xyce.h>
54 #include <N_ANP_fwd.h>
55 #include <N_PDS_fwd.h>
56 
57 #include <N_IO_OutputMgr.h>
58 
59 class N_LAS_Vector;
60 
61 namespace Xyce {
62 namespace Analysis {
63 
64 //-------------------------------------------------------------------------
65 // Class : OutputMgrAdapter
66 // Purpose : Inteface class for the output manager
67 // Special Notes :
68 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
69 // Creation Date : 01/24/08
70 //-------------------------------------------------------------------------
72 {
73 
74  public:
76 
77  virtual ~OutputMgrAdapter() {}
78 
79  void registerOutputMgr( N_IO_OutputMgr * outputMgrPtr )
80  {
81  outputManager_ = outputMgrPtr;
82  }
83 
84  void setStepParamVec( const RefCountPtr< std::vector<SweepParam> > & paramVec )
85  {
86  stepParamVecRCPtr_ = paramVec;
87  }
88 
89  void setDCParamVec( const RefCountPtr< std::vector<SweepParam> > & paramVec )
90  {
91  dcParamVecRCPtr_ = paramVec;
92  }
93 
94  // accessor methods
96  { return stepAnalysisStepNumber_; }
97 
99  { return stepAnalysisMaxSteps_; }
100 
102  { return dcAnalysisStepNumber_; }
103 
105  { return dcAnalysisMaxSteps_; }
106 
107  N_PDS_Comm * getCommPtr () {
108  return outputManager_->getCommPtr();
109  }
110 
111  // this is only used to construct ExpressionData objects so they have a way
112  // to connect to the OutputMgr. Need to refactor this so they can take
113  // an OutputMgrAdapter reference or RCP.
114  N_IO_OutputMgr * getOutputMgrPtr() {
115  return outputManager_;
116  }
117 
119  { stepAnalysisStepNumber_ = num; }
120 
121  void setStepAnalysisMaxSteps( int num )
122  { stepAnalysisMaxSteps_ = num; }
123 
124  void setDCAnalysisStepNumber( int num )
125  { dcAnalysisStepNumber_ = num; }
126 
127  void setDCAnalysisMaxSteps( int num )
128  { dcAnalysisMaxSteps_ = num; }
129 
131  {
132  outputManager_->prepareOutput(analysis_mode, *stepParamVecRCPtr_, *dcParamVecRCPtr_);
133  }
134 
135  void tranOutput(double time, N_LAS_Vector & currSolutionPtr,
136  N_LAS_Vector & stateVecPtr, N_LAS_Vector & storeVecPtr,
137  std::vector<double> & objectiveVec_,
138  std::vector<double> & dOdpVec_,
139  std::vector<double> & dOdpAdjVec_,
140  std::vector<double> & scaled_dOdpVec_,
141  std::vector<double> & scaled_dOdpAdjVec_,
142  bool skipPrintLineOutput=false )
143  {
144  outputManager_->output(time,
147  & currSolutionPtr, & stateVecPtr, & storeVecPtr, objectiveVec_,
148  dOdpVec_, dOdpAdjVec_, scaled_dOdpVec_, scaled_dOdpAdjVec_,
149  skipPrintLineOutput);
150  }
151 
152  void dcOutput(
153  int dcStepNumber,
154  N_LAS_Vector & currSolutionPtr, N_LAS_Vector & stateVecPtr, N_LAS_Vector & storeVecPtr,
155  std::vector<double> & objectiveVec_,
156  std::vector<double> & dOdpVec_,
157  std::vector<double> & dOdpAdjVec_,
158  std::vector<double> & scaled_dOdpVec_,
159  std::vector<double> & scaled_dOdpAdjVec_)
160  {
161  outputManager_->output(0.0,
163  dcStepNumber, dcAnalysisMaxSteps_, *dcParamVecRCPtr_,
164  & currSolutionPtr, & stateVecPtr, & storeVecPtr, objectiveVec_,
165  dOdpVec_, dOdpAdjVec_, scaled_dOdpVec_, scaled_dOdpAdjVec_);
166  }
167 
168 
169  void outputRESULT( N_LAS_Vector & currSolutionPtr, N_LAS_Vector & currStatePtr, N_LAS_Vector & currStorePtr )
170  {
171  outputManager_->outputRESULT( & currSolutionPtr, & currStatePtr, & currStorePtr );
172  }
173 
175  {
176  outputManager_->finishOutputSTEP ();
177  }
178 
180  {
181  outputManager_->finishOutput();
182  }
183 
184  bool setupInitialConditions ( N_LAS_Vector & solnVec, N_LAS_Vector & flagVec)
185  {
186  return outputManager_->setupInitialConditions( solnVec, flagVec);
187  }
188 
189  void outputDCOP( N_LAS_Vector & currSolutionPtr )
190  {
191  outputManager_->outputDCOP( currSolutionPtr );
192  }
193 
194 
195  void outputMPDE ( double time, const N_LAS_Vector & solnVecPtr )
196  {
197  outputManager_->outputMPDE(time, & solnVecPtr);
198  }
199 
200  void outputHB (
201  const std::vector< double > & timePoints, const std::vector< double > & freqPoints,
202  const N_LAS_BlockVector & timeDomainSolnVec, const N_LAS_BlockVector & freqDomainSolnVecReal,
203  const N_LAS_BlockVector & freqDomainSolnVecImaginary, const N_LAS_BlockVector & timeDomainStoreVec,
204  const N_LAS_BlockVector & freqDomainStoreVecReal, const N_LAS_BlockVector & freqDomainStoreVecImaginary)
205  {
206  outputManager_->outputHB(
208  timePoints, freqPoints, timeDomainSolnVec, freqDomainSolnVecReal, freqDomainSolnVecImaginary);
209  }
210 
211  void outputAC (double freq, const N_LAS_Vector & solnVecRealPtr, const N_LAS_Vector & solnVecImaginaryPtr)
212  {
213  outputManager_->outputAC(freq, & solnVecRealPtr, & solnVecImaginaryPtr);
214  }
215 
216  void outputMORTF ( bool origSys, const double & freq, const Teuchos::SerialDenseMatrix<int, std::complex<double> >& H )
217  {
218  outputManager_->outputMORTF( origSys, freq, H );
219  }
220 
222  {
223  outputManager_->resetOutput();
224  }
225 
226  void outputROM( const Teuchos::SerialDenseMatrix<int, double>& Ghat, const Teuchos::SerialDenseMatrix<int, double>& Chat,
227  const Teuchos::SerialDenseMatrix<int, double>& Bhat, const Teuchos::SerialDenseMatrix<int, double>& Lhat )
228  {
229  outputManager_->outputROM( Ghat, Chat, Bhat, Lhat );
230  }
231 
232  void outputROM( const N_LAS_Matrix& Ghat, const N_LAS_Matrix& Chat,
233  const Teuchos::SerialDenseMatrix<int, double>& Bhat,
234  const Teuchos::SerialDenseMatrix<int, double>& Lhat )
235  {
236  outputManager_->outputROM( Ghat, Chat, Bhat, Lhat );
237  }
238 
239  bool getOutputIntervals(double & initialInterval, std::vector<std::pair< double, double > > * intervalPairs)
240  {
241  return outputManager_->getOutputIntervals( initialInterval, *intervalPairs );
242  }
243 
244 
245  void outputHomotopy( const std::vector<std::string> & paramNames, const std::vector<double> & paramVals, N_LAS_Vector & solnVecPtr )
246  {
247  outputManager_->outputHomotopy ( paramNames, paramVals, & solnVecPtr );
248  }
249 
250  Xyce::NodeNamePairMap & getAllNodes ( )
251  {
252  return outputManager_->getAllNodes ();
253  }
254 
255  private:
256  N_IO_OutputMgr * outputManager_;
257 
258  RefCountPtr< std::vector<SweepParam> > stepParamVecRCPtr_;
259  RefCountPtr< std::vector<SweepParam> > dcParamVecRCPtr_;
260 
265 
266 };
267 
268 } // namespace Analysis
269 } // namespace Xyce
270 
272 
273 #endif // Xyce_N_ANP_OutputMgrAdapter_h
274