Xyce  6.1
N_ANP_ModelEvaluator.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-2015 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_ModelEvaluator.h,v $
27 //
28 // Purpose :
29 //
30 //
31 //
32 // Special Notes :
33 //
34 //
35 // Creator :
36 //
37 // Creation Date :
38 //
39 // Revision Information:
40 // ---------------------
41 //
42 // Revision Number: $Revision: 1.18 $
43 //
44 // Revision Date : $Date: 2015/10/27 19:24:39 $
45 //
46 // Current Owner : $Author: tvrusso $
47 //-------------------------------------------------------------------------
48 #ifndef N_ANP_MODEL_EVALUATOR_H
49 #define N_ANP_MODEL_EVALUATOR_H
50 
51 #include <N_CIR_fwd.h>
52 #include <N_LAS_fwd.h>
53 #include <N_PDS_fwd.h>
54 
55 #undef HAVE_LIBPARMETIS
56 #include <EpetraExt_ModelEvaluator.h>
57 
58 // Forward Declarations
59 class Epetra_Map;
60 class Epetra_Vector;
61 class Epetra_CrsGraph;
62 class Epetra_Operator;
63 
64 #include <Teuchos_RCP.hpp>
65 using Teuchos::RCP;
66 
67 namespace Xyce {
68 namespace Analysis {
69 
70 RCP<Linear::BlockVector> convertEpetraToNLASBlockVectorView(
71  const RCP<const Epetra_Vector>& vec,
72  const RCP<Epetra_Map>& map
73  );
74 RCP<Linear::Vector> convertEpetraToNLASVectorView(
75  const RCP<const Epetra_Vector>& vec
76  );
77 
78 
79 class ModelEvaluator : public EpetraExt::ModelEvaluator
80 {
81 public:
83  virtual ~ModelEvaluator();
84 
85  void initialize(int iargs, char* cargs[]);
86 
87  /** \name Overridden from EpetraExt::ModelEvaluator . */
88  //@{
89  Teuchos::RCP<const Epetra_Map> get_x_map() const;
90  Teuchos::RCP<const Epetra_Map> get_f_map() const;
91  Teuchos::RCP<const Epetra_Map> get_p_map(int p) const;
92  Teuchos::RCP<const Epetra_Map> get_g_map(int p) const;
93  Teuchos::RCP<const Epetra_Map> get_small_x_map() const;
94  Teuchos::RCP<Epetra_Operator> create_W() const;
95  EpetraExt::ModelEvaluator::InArgs createInArgs() const;
96  EpetraExt::ModelEvaluator::OutArgs createOutArgs() const;
97  void evalModel( const InArgs& inArgs, const OutArgs& outArgs ) const;
98  //@}
99 
100  std::vector<std::string> getVariableNames();
101 
102  bool isInitialized() const;
103 
104 private:
105  // Private member functions:
106  void setupInOutArgs_();
107  void setupMapsAndGraphs_();
108 
109  // Private data:
111  RCP<Circuit::Simulator> xycePtr_;
112  EpetraExt::ModelEvaluator::InArgs inArgs_;
113  EpetraExt::ModelEvaluator::OutArgs outArgs_;
114  RCP<N_PDS_ParMap> x_map_;
115  RCP<N_PDS_ParMap> x_ognd_map_;
116  RCP<N_PDS_ParMap> s_map_;
117  RCP<N_PDS_ParMap> store_map_;
118  RCP<Epetra_CrsGraph> dQdx_graph_;
119  RCP<Epetra_CrsGraph> dQdx_ognd_graph_;
120  RCP<Epetra_CrsGraph> dFdx_graph_;
121  RCP<Epetra_CrsGraph> dFdx_graph_with_diagonal_;
122  RCP<Epetra_CrsGraph> dFdx_ognd_graph_;
123  int Np_;
124  int Ng_;
125  mutable RCP<Linear::Vector> tempVoltLimFVector_;
126  mutable RCP<Linear::Vector> tempVoltLimQVector_;
127  RCP<Linear::Vector> eVec_; // Used for filling diagonal on identity matrices
128  RCP<N_PDS_ParMap> blockMap_;
129 
130  // Used for Xyce loads where overlap_gnd map is required, so we copy the data in & out.
131  RCP<Linear::Vector> x_gnd_;
132  RCP<Linear::Vector> z_gnd_;
133  RCP<Linear::Vector> xdot_gnd_;
134  RCP<Linear::Vector> zdot_gnd_;
135  RCP<Linear::Vector> f_0_gnd_;
136  RCP<Linear::Vector> f_1_gnd_;
137  RCP<Linear::Matrix> dQdx_gnd_matrix_;
138  RCP<Linear::Matrix> dFdx_gnd_matrix_;
139 
140 };
141 
142 } // namespace Analysis
143 } // namespace Xyce
144 
145 #endif // N_ANP_MODEL_EVALUATOR_H
146 
EpetraExt::ModelEvaluator::InArgs createInArgs() const
Teuchos::RCP< const Epetra_Map > get_p_map(int p) const
RCP< Linear::Vector > convertEpetraToNLASVectorView(const RCP< const Epetra_Vector > &vec)
RCP< Epetra_CrsGraph > dFdx_graph_
EpetraExt::ModelEvaluator::OutArgs outArgs_
Pure virtual class to augment a linear system.
Teuchos::RCP< Epetra_Operator > create_W() const
EpetraExt::ModelEvaluator::InArgs inArgs_
RCP< Epetra_CrsGraph > dQdx_graph_
RCP< Circuit::Simulator > xycePtr_
void initialize(int iargs, char *cargs[])
RCP< Linear::Matrix > dQdx_gnd_matrix_
std::vector< std::string > getVariableNames()
RCP< Linear::Vector > tempVoltLimFVector_
Teuchos::RCP< const Epetra_Map > get_f_map() const
RCP< Linear::Vector > tempVoltLimQVector_
Teuchos::RCP< const Epetra_Map > get_small_x_map() const
RCP< Epetra_CrsGraph > dFdx_ognd_graph_
RCP< Epetra_CrsGraph > dQdx_ognd_graph_
EpetraExt::ModelEvaluator::OutArgs createOutArgs() const
Teuchos::RCP< const Epetra_Map > get_g_map(int p) const
void evalModel(const InArgs &inArgs, const OutArgs &outArgs) const
RCP< Linear::BlockVector > convertEpetraToNLASBlockVectorView(const RCP< const Epetra_Vector > &vec, const RCP< Epetra_Map > &map)
Teuchos::RCP< const Epetra_Map > get_x_map() const
RCP< Epetra_CrsGraph > dFdx_graph_with_diagonal_
RCP< Linear::Matrix > dFdx_gnd_matrix_