Xyce  6.1
N_NLS_NOX_Group.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_NLS_NOX_Group.h,v $
27 //
28 // Purpose : Interface to Xyce for NOX groups.
29 //
30 // Special Notes :
31 //
32 // Creator : Tammy Kolda, NLS, 8950
33 //
34 // Creation Date : 01/31/02
35 //
36 // Revision Information:
37 // ---------------------
38 //
39 // Revision Number: $Revision: 1.22.2.1 $
40 //
41 // Revision Date : $Date: 2015/04/02 18:20:17 $
42 //
43 // Current Owner : $Author: tvrusso $
44 //-------------------------------------------------------------------------
45 
46 #ifndef Xyce_N_NLS_NOX_Group_h
47 #define Xyce_N_NLS_NOX_Group_h
48 
49 // ---------- Standard Includes ----------
50 
51 // ---------- Xyce Includes ----------
52 
53 // ---------- NOX Includes ----------
54 
55 #include "NOX_Abstract_Group.H"
56 #include "Teuchos_RCP.hpp"
57 
58 // ---------- Forward Declarations ----------
59 namespace Xyce {
60 namespace Nonlinear {
61 namespace N_NLS_NOX {
62  class Vector;
63  class SharedSystem;
64 }}}
65 namespace NOX {
66  namespace Abstract {
67  class Vector;
68  class Group;
69  }
70  namespace Parameter {
71  class List;
72  }
73 }
74 class Ifpack_IlukGraph;
75 class Ifpack_CrsRiluk;
76 
77 namespace Xyce {
78 namespace Nonlinear {
79 namespace N_NLS_NOX {
80 
81 //-----------------------------------------------------------------------------
82 // Class : N_NLS::NOX::Group
83 //
84 // Purpose :
85 //
86 // NOX Group Interface for Xyce
87 //
88 // Creator : Tammy Kolda, SNL, 8950
89 //
90 // Creation Date : 2/1/02
91 //-----------------------------------------------------------------------------
92 
93 class Group : public virtual NOX::Abstract::Group {
94 
95 public:
96 
97  Group(SharedSystem& s);
98  Group(const Group& source, NOX::CopyType type = NOX::DeepCopy);
99 
100  ~Group();
101 
102  NOX::Abstract::Group& operator=(const Group& source);
103  NOX::Abstract::Group& operator=(const NOX::Abstract::Group& source);
104 
105  void setX(const Vector& input);
106  void setX(const NOX::Abstract::Vector& input);
107 
108  void computeX(const Group& grp, const Vector& d, double step);
109  void computeX(const NOX::Abstract::Group& grp, const NOX::Abstract::Vector& d, double step);
110 
111  NOX::Abstract::Group::ReturnType computeF();
112  NOX::Abstract::Group::ReturnType computeJacobian();
113  NOX::Abstract::Group::ReturnType computeGradient();
114  NOX::Abstract::Group::ReturnType computeNewton(Teuchos::ParameterList& params);
115  NOX::Abstract::Group::ReturnType applyJacobian(const Vector& input, Vector& result) const;
116  NOX::Abstract::Group::ReturnType applyJacobian(const NOX::Abstract::Vector& input, NOX::Abstract::Vector& result) const;
117 
118  NOX::Abstract::Group::ReturnType applyJacobianTranspose(const Vector& input, Vector& result) const;
119  NOX::Abstract::Group::ReturnType applyJacobianTranspose(const NOX::Abstract::Vector& input, NOX::Abstract::Vector& result) const;
120  NOX::Abstract::Group::ReturnType
121  applyJacobianInverse(Teuchos::ParameterList& params,
122  const Vector& input, Vector& result) const;
123  NOX::Abstract::Group::ReturnType
124  applyJacobianInverse(Teuchos::ParameterList& params,
125  const NOX::Abstract::Vector& input,
126  NOX::Abstract::Vector& result) const;
127 
128  NOX::Abstract::Group::ReturnType
129  applyRightPreconditioning(bool useTranspose,
130  Teuchos::ParameterList& params,
131  const Vector& input,
132  Vector& result) const;
133  NOX::Abstract::Group::ReturnType
134  applyRightPreconditioning(bool useTranspose,
135  Teuchos::ParameterList& params,
136  const NOX::Abstract::Vector& input,
137  NOX::Abstract::Vector& result) const;
138 
139  bool isF() const;
140  bool isJacobian() const;
141  bool isGradient() const;
142  bool isNewton() const;
143 
144  const NOX::Abstract::Vector& getX() const;
145  const NOX::Abstract::Vector& getF() const;
146  double getNormF() const;
147  const NOX::Abstract::Vector& getGradient() const;
148  const NOX::Abstract::Vector& getNewton() const;
149 
150  Teuchos::RCP<NOX::Abstract::Group>
151  clone(NOX::CopyType type = NOX::DeepCopy) const;
152 
153 protected:
154 
155  // resets the isValid flags to false
156  void resetIsValid_();
157 
158  // Throws an error
159  void throwError(std::string method, std::string message) const;
160 
161 
162 protected:
163 
164  // Reference to the shared Newton system
166 
167  // NOX Vectors for storing values
168  Teuchos::RCP<Vector> xVecPtr_;
170  Teuchos::RCP<Vector> fVecPtr_;
172  Teuchos::RCP<Vector> newtonVecPtr_;
173  Teuchos::RCP<Vector> gradVecPtr_;
174 
175  // Booleans for tracking whether or not these values have been
176  // computed for the currect x.
177  bool isValidF_;
182 
183  // Value of the 2-Norm of F
184  double normF_;
185 
186  // Flag to determine if the solver should refactor the
187  // preconditioner (iterative) or Jacobian (direct).
188  mutable bool haveSolverFactors_;
189 
190 }; // class SharedSystem
191 
192 }}} // namespace N_NLS_NOX
193 
194 #endif // Xyce_N_NLS_NOX_SharedSystem_h
195 
const NOX::Abstract::Vector & getGradient() const
void setX(const Vector &input)
Teuchos::RCP< Vector > xVecPtr_
const NOX::Abstract::Vector & getX() const
Pure virtual class to augment a linear system.
Teuchos::RCP< Vector > newtonVecPtr_
NOX::Abstract::Group::ReturnType computeF()
void computeX(const Group &grp, const Vector &d, double step)
NOX::Abstract::Group::ReturnType applyJacobianInverse(Teuchos::ParameterList &params, const Vector &input, Vector &result) const
NOX::Abstract::Group::ReturnType computeGradient()
const NOX::Abstract::Vector & getF() const
NOX::Abstract::Group::ReturnType computeJacobian()
NOX::Abstract::Group::ReturnType computeNewton(Teuchos::ParameterList &params)
NOX::Abstract::Group::ReturnType applyRightPreconditioning(bool useTranspose, Teuchos::ParameterList &params, const Vector &input, Vector &result) const
NOX::Abstract::Group & operator=(const Group &source)
Teuchos::RCP< Vector > gradVecPtr_
NOX::Abstract::Group::ReturnType applyJacobian(const Vector &input, Vector &result) const
void throwError(std::string method, std::string message) const
Teuchos::RCP< Vector > fVecPtr_
Teuchos::RCP< NOX::Abstract::Group > clone(NOX::CopyType type=NOX::DeepCopy) const
const NOX::Abstract::Vector & getNewton() const
NOX::Abstract::Group::ReturnType applyJacobianTranspose(const Vector &input, Vector &result) const
Definition: N_NLS_fwd.h:107