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.21 $
41 // Revision Date : $Date: 2014/08/05 21:41:35 $
42 // Current Owner : $Author: dgbaur $
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 #include <N_LAS_fwd.h>
55 
56 #include <N_ANP_AnalysisBase.h>
57 #include <N_ANP_StepEvent.h>
58 #include <N_UTL_FixedQueue.h>
59 #include <N_UTL_Listener.h>
60 
61 // ---------- Forward Declarations ----------
62 class Amesos_BaseSolver;
63 class Epetra_LinearProblem;
64 
65 namespace Xyce {
66 namespace Analysis {
67 
68 //-------------------------------------------------------------------------
69 // Class : AC
70 // Purpose : AC analysis class
71 // Special Notes :
72 // Creator : Ting Mei
73 // Creation Date : 05/24/11
74 //-------------------------------------------------------------------------
75 class AC: public AnalysisBase, public Util::ListenerAutoSubscribe<StepEvent>
76 {
77  public:
78  AC(AnalysisManager &analysis_manager);
79 
80  ~AC();
81 
82  void notify(const StepEvent &event);
83 
84 
85  bool setAnalysisParams(const N_UTL_OptionBlock & paramsBlock);
86 
87  bool getDCOPFlag();
88 
89  bool run();
90  bool init();
91  bool loopProcess();
92  bool processSuccessfulStep();
93  bool processFailedStep();
94  bool finish();
95  bool handlePredictor();
96 
97  void printStepHeader(std::ostream &os)
98  {}
99 
100  void printProgress(std::ostream &os)
101  {}
102 
103  private:
104  N_LAS_Vector * bVecRealPtr;
105  N_LAS_Vector * bVecImagPtr;
107 
108  std::list < int > acSweepFailures_;
109 
110  double stepMult_;
111  double fstep_;
112 
113  double currentFreq_;
114 
115  int setupSweepParam_();
116 
117  bool updateCurrentFreq_(int stepNumber);
118 
119  bool createLinearSystem_();
120 
122 
123  bool solveLinearSystem_();
124 
125  RCP<N_LAS_Matrix> CPtr_;
126  RCP<N_LAS_Matrix> GPtr_;
127  RCP<N_LAS_BlockMatrix> ACMatrixPtr_;
128  RCP<N_LAS_BlockVector> BPtr_;
129  RCP<N_LAS_BlockVector> XPtr_;
130 
131  RCP<Amesos_BaseSolver> blockSolver;
132 
133  RCP<Epetra_LinearProblem> blockProblem;
134 
135  std::vector<double> objectiveVec_;
136  std::vector<double> dOdpVec_;
137  std::vector<double> dOdpAdjVec_;
138  std::vector<double> scaled_dOdpVec_;
139  std::vector<double> scaled_dOdpAdjVec_;
140 };
141 
142 } // namespace Analysis
143 } // namespace Xyce
144 
146 
147 #endif // Xyce_N_ANP_AC_h