Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-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_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.12 $
43 //
44 // Revision Date : $Date: 2014/02/24 23:49:12 $
45 //
46 // Current Owner : $Author: tvrusso $
47 //-------------------------------------------------------------------------
48 #ifndef N_ANP_MODEL_EVALUATOR_H
49 #define N_ANP_MODEL_EVALUATOR_H
50 
51 #undef HAVE_LIBPARMETIS
52 #include <EpetraExt_ModelEvaluator.h>
53 #include <N_CIR_Xyce.h>
54 
55 // Forward Declarations
56 class Epetra_Map;
57 class Epetra_Vector;
58 class Epetra_CrsGraph;
59 class Epetra_Operator;
60 class N_LAS_Vector;
61 class N_LAS_BlockVector;
62 
63 using Teuchos::RCP;
64 
65 namespace Xyce {
66 namespace Analysis {
67 
68 RCP<N_LAS_BlockVector> convertEpetraToNLASBlockVectorView(
69  const RCP<const Epetra_Vector>& vec,
70  const RCP<Epetra_Map>& map
71  );
72 RCP<N_LAS_Vector> convertEpetraToNLASVectorView(
73  const RCP<const Epetra_Vector>& vec
74  );
75 
76 
77 class ModelEvaluator : public EpetraExt::ModelEvaluator {
78 public:
80  virtual ~ModelEvaluator();
81 
82  void initialize(int iargs, char* cargs[]);
83 
84  /** \name Overridden from EpetraExt::ModelEvaluator . */
85  //@{
86  Teuchos::RCP<const Epetra_Map> get_x_map() const;
87  Teuchos::RCP<const Epetra_Map> get_f_map() const;
88  Teuchos::RCP<const Epetra_Map> get_p_map(int p) const;
89  Teuchos::RCP<const Epetra_Map> get_g_map(int p) const;
90  Teuchos::RCP<const Epetra_Map> get_small_x_map() const;
91  Teuchos::RCP<Epetra_Operator> create_W() const;
92  EpetraExt::ModelEvaluator::InArgs createInArgs() const;
93  EpetraExt::ModelEvaluator::OutArgs createOutArgs() const;
94  void evalModel( const InArgs& inArgs, const OutArgs& outArgs ) const;
95  //@}
96 
97  std::vector<std::string> getVariableNames();
98 
99  bool isInitialized() const;
100 
101 private:
102  // Private member functions:
103  void setupInOutArgs_();
104  void setupMapsAndGraphs_();
105 
106  // Private data:
108  RCP<N_CIR_Xyce> xycePtr_;
109  EpetraExt::ModelEvaluator::InArgs inArgs_;
110  EpetraExt::ModelEvaluator::OutArgs outArgs_;
111  RCP<N_PDS_ParMap> x_map_;
112  RCP<N_PDS_ParMap> x_ognd_map_;
113  RCP<N_PDS_ParMap> s_map_;
114  RCP<N_PDS_ParMap> store_map_;
115  RCP<Epetra_CrsGraph> dQdx_graph_;
116  RCP<Epetra_CrsGraph> dQdx_ognd_graph_;
117  RCP<Epetra_CrsGraph> dFdx_graph_;
118  RCP<Epetra_CrsGraph> dFdx_graph_with_diagonal_;
119  RCP<Epetra_CrsGraph> dFdx_ognd_graph_;
120  int Np_;
121  int Ng_;
122  mutable RCP<N_LAS_Vector> tempVoltLimFVector_;
123  mutable RCP<N_LAS_Vector> tempVoltLimQVector_;
124  RCP<N_LAS_Vector> eVec_; // Used for filling diagonal on identity matrices
125  RCP<N_PDS_ParMap> blockMap_;
126 
127  // Used for Xyce loads where overlap_gnd map is required, so we copy the data in & out.
128  RCP<N_LAS_Vector> x_gnd_;
129  RCP<N_LAS_Vector> z_gnd_;
130  RCP<N_LAS_Vector> xdot_gnd_;
131  RCP<N_LAS_Vector> zdot_gnd_;
132  RCP<N_LAS_Vector> f_0_gnd_;
133  RCP<N_LAS_Vector> f_1_gnd_;
134  RCP<N_LAS_Matrix> dQdx_gnd_matrix_;
135  RCP<N_LAS_Matrix> dFdx_gnd_matrix_;
136 
137 };
138 
139 } // namespace Analysis
140 } // namespace Xyce
141 
143 
144 #endif // N_ANP_MODEL_EVALUATOR_H
145