Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_ANP_MOR.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_ANP_MOR.h,v $
27 //
28 // Purpose : MOR 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 : Ting Mei
34 //
35 // Creation Date : 01/11
36 //
37 // Revision Information:
38 // ---------------------
39 //
40 // Revision Number: $Revision: 1.15 $
41 // Revision Date : $Date: 2014/02/24 23:49:12 $
42 // Current Owner : $Author: tvrusso $
43 //-----------------------------------------------------------------------------
44 
45 #ifndef Xyce_N_ANP_MOR_h
46 #define Xyce_N_ANP_MOR_h
47 
48 #include <Teuchos_RCP.hpp>
49 using Teuchos::RCP;
50 using Teuchos::rcp;
51 #include <Teuchos_SerialDenseMatrix.hpp>
52 
53 
54 // ---------- Xyce Includes ----------
55 #include <N_ANP_fwd.h>
56 #include <N_UTL_fwd.h>
57 
58 #include <N_ANP_AnalysisBase.h>
59 #include <N_UTL_FixedQueue.h>
60 
61 // ---------- Forward Declarations ----------
62 class N_LAS_Matrix;
63 class N_LAS_Vector;
64 class N_LAS_BlockMatrix;
65 class N_LAS_BlockVector;
66 class Amesos_BaseSolver;
67 class Epetra_LinearProblem;
68 
69 namespace Xyce {
70 namespace Analysis {
71 
72 //-------------------------------------------------------------------------
73 // Class : MOR
74 // Purpose : MOR analysis class
75 // Special Notes :
76 // Creator : Ting Mei
77 // Creation Date : 05/24/11
78 //-------------------------------------------------------------------------
79 class MOR: public AnalysisBase
80 {
81  public:
82  MOR( AnalysisManager * anaManagerPtr );
83 
84  ~MOR();
85 
86  bool setAnalysisParams(const N_UTL_OptionBlock & paramsBlock);
87 
88  bool run();
89  bool init();
90  bool reduceSystem();
93 
94  bool processSuccessfulStep(bool origSys);
95 
96  virtual bool processSuccessfulStep() /* override */ {
97  return true;
98  }
99 
100  virtual bool loopProcess() /* override */ {
101  return true;
102  }
103 
104  virtual bool processFailedStep(); /* override */
105  virtual bool finish(); /* override */
106  virtual bool handlePredictor(); /* override */
107 
108  void setDCOPFlag(bool flag) { dcopFlag_ = flag; }
109  bool getDCOPFlag() { return dcopFlag_; }
110 
111  private:
112 
113  bool isPaused;
114  bool dcopFlag_; // true if this is a DCOP calculation.
117 
118  std::list < int > morEvalFailures_;
119  std::vector<std::string> portList_;
120 
121  double stepMult_;
122  double fStep_;
123  double currentFreq_;
124  double s0_;
125 
126  int setupSweepParam_();
127 
128  bool updateCurrentFreq_(int stepNumber);
129 
131  bool createRedLinearSystem_();
132 
135 
136  bool solveOrigLinearSystem_();
137  bool solveRedLinearSystem_();
138 
139  bool sparsifyRedSystem_();
140 
141  // Original system
142  RCP<N_LAS_Matrix> CPtr_;
143  RCP<N_LAS_Matrix> GPtr_;
144  RCP<N_LAS_Matrix> sCpG_MatrixPtr_;
145  RCP<N_LAS_Matrix> redCPtr_, redGPtr_;
146  RCP<N_LAS_MultiVector> RPtr_, BPtr_, VPtr_;
148 
149  // Original system, real-equivalent form
150  RCP<N_LAS_BlockMatrix> sCpG_REFMatrixPtr_;
151  RCP<N_LAS_BlockVector> REFBPtr_;
152  RCP<N_LAS_BlockVector> REFXPtr_; // Store solution from Amesos here.
153  //RCP<N_LAS_BlockVector> LPtr_;
154 
155  // Reduced system
156  Teuchos::SerialDenseMatrix<int, double> redC_;
157  Teuchos::SerialDenseMatrix<int, double> redG_;
158  Teuchos::SerialDenseMatrix<int, double> redB_;
159  Teuchos::SerialDenseMatrix<int, double> redL_; // redL_ != redB_
160 
161  // Reduced system, real-equivalent form
162  Teuchos::SerialDenseMatrix<int, double> sCpG_redMatrix_, sCpG_tmpMatrix_;
163  Teuchos::SerialDenseMatrix<int, double> ref_redB_;
164 
165  // Transfer functions
166  Teuchos::SerialDenseMatrix<int, std::complex<double> > origH_;
167  Teuchos::SerialDenseMatrix<int, std::complex<double> > redH_;
168 
169  // Original system solver objects
170  RCP<Amesos_BaseSolver> blockSolver_, origSolver_;
171  RCP<Epetra_LinearProblem> blockProblem_, origProblem_;
172 };
173 
174 } // namespace Analysis
175 } // namespace Xyce
176 
178 
179 #endif // Xyce_N_ANP_MOR_h