Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_ANP_AC.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_AC.h,v $
27 //
28 // Purpose : AC 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.16 $
41 // Revision Date : $Date: 2014/02/24 23:49:11 $
42 // Current Owner : $Author: tvrusso $
43 //-----------------------------------------------------------------------------
44 
45 #ifndef Xyce_N_ANP_AC_h
46 #define Xyce_N_ANP_AC_h
47 
48 #include <Teuchos_RCP.hpp>
49 using Teuchos::RCP;
50 using Teuchos::rcp;
51 
52 #include <N_ANP_fwd.h>
53 #include <N_UTL_fwd.h>
54 
55 #include <N_ANP_AnalysisBase.h>
56 #include <N_UTL_FixedQueue.h>
57 
58 
59 // ---------- Forward Declarations ----------
60 class N_LAS_Matrix;
61 class N_LAS_Vector;
62 class N_LAS_BlockMatrix;
63 class N_LAS_BlockVector;
64 class Amesos_BaseSolver;
65 class Epetra_LinearProblem;
66 
67 namespace Xyce {
68 namespace Analysis {
69 
70 //-------------------------------------------------------------------------
71 // Class : AC
72 // Purpose : AC analysis class
73 // Special Notes :
74 // Creator : Ting Mei
75 // Creation Date : 05/24/11
76 //-------------------------------------------------------------------------
77 class AC: public AnalysisBase
78 {
79  public:
80  AC( AnalysisManager * anaManagerPtr );
81 
82  ~AC();
83 
84  bool setAnalysisParams(const N_UTL_OptionBlock & paramsBlock);
85 
86  bool run();
87  bool init();
88  bool loopProcess();
89  bool processSuccessfulStep();
90  bool processFailedStep();
91  bool finish();
92  bool handlePredictor();
93  bool resetForStepAnalysis();
94 
95  void printStepHeader(std::ostream &os)
96  {}
97 
98  void printProgress(std::ostream &os)
99  {}
100 
101  void setDCOPFlag(bool flag) { dcopFlag_ = flag; }
102  bool getDCOPFlag() { return dcopFlag_; }
103 
104  private:
105 
106  bool dcopFlag_; // true if this is a DCOP calculation.
107 
108  N_LAS_Vector * bVecRealPtr;
109  N_LAS_Vector * bVecImagPtr;
110 // double startDCOPtime, endTRANtime; // startTRANtime
112 
113  std::list < int > acSweepFailures_;
114 
115  double stepMult_;
116  double fstep_;
117 
118  double currentFreq_;
119 
120  int setupSweepParam_();
121 
122  bool updateCurrentFreq_(int stepNumber);
123 
124  bool createLinearSystem_();
125 
127 
128  bool solveLinearSystem_();
129 
130  RCP<N_LAS_Matrix> CPtr_;
131  RCP<N_LAS_Matrix> GPtr_;
132  RCP<N_LAS_BlockMatrix> ACMatrixPtr_;
133  RCP<N_LAS_BlockVector> BPtr_;
134  RCP<N_LAS_BlockVector> XPtr_;
135 
136  RCP<Amesos_BaseSolver> blockSolver;
137 
138  RCP<Epetra_LinearProblem> blockProblem;
139 
140  std::vector<double> objectiveVec_;
141  std::vector<double> dOdpVec_;
142  std::vector<double> dOdpAdjVec_;
143  std::vector<double> scaled_dOdpVec_;
144  std::vector<double> scaled_dOdpAdjVec_;
145 };
146 
147 } // namespace Analysis
148 } // namespace Xyce
149 
151 
152 #endif // Xyce_N_ANP_AC_h