46 #include <Xyce_config.h>
55 #include "N_LAS_Vector.h"
56 #include "N_LAS_Matrix.h"
57 #include "N_LAS_System.h"
58 #include "N_LAS_Builder.h"
59 #include "N_ERH_ErrorMgr.h"
60 #include "Epetra_CrsMatrix.h"
61 #include "Ifpack_IlukGraph.h"
62 #include "Ifpack_CrsRiluk.h"
85 Linear::Matrix& jacobian,
86 Linear::Vector& newton,
87 Linear::Vector& gradient,
88 Linear::System& lasSys,
98 matrixFreeFlag_(false),
100 ownerOfStateVectors_(0),
102 ifpackPreconditionerPtr_(0)
104 reset(soln, f, jacobian, newton, gradient, lasSys, interface);
134 Linear::Matrix& jacobian,
135 Linear::Vector& newton,
136 Linear::Vector& gradient,
137 Linear::System& lasSys,
176 #ifdef Xyce_NOX_USE_VECTOR_COPY
183 if (status ==
false) {
184 const string message =
"Error: SharedSystem::computeF() - compute F failed!";
185 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
188 #ifdef Xyce_NOX_USE_VECTOR_COPY
207 #ifdef Xyce_NOX_USE_VECTOR_COPY
212 #ifdef Xyce_VERBOSE_NOX
214 dout() <<
"Warning: SharedSystem::computeJacobian() - State "
215 <<
"Vectors are not valid wrt solution!" << std::endl;
216 dout() <<
"Calling computeResidual to fix this!" << std::endl;
222 NOX::Abstract::Group::ReturnType status = grp->
computeF();
224 if (status != NOX::Abstract::Group::Ok) {
225 const string message =
"SharedSystem::computeJacobian() - compute F failed!";
226 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
231 #ifdef Xyce_NOX_USE_VECTOR_COPY
235 (dynamic_cast<const Vector &> (grp->
getX()));
238 if (status ==
false) {
239 const string message =
"SharedSystem::computeJacobian() - compute Jac failed!";
240 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
256 Teuchos::ParameterList& params)
296 bool NoTranspose =
false;
300 #ifndef Xyce_NOX_USE_VECTOR_COPY
301 const string message =
"SharedSystem::applyJacobian() - ERROR, Xyce_NOX_USE_VECTOR_COPY required";
302 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
305 if (status ==
false) {
306 const string message =
"SharedSystem::applyJacobian() - apply Jac failed!";
307 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
324 bool Transpose =
true;
327 const string message =
"SharedSystem::applyJacobianTranspose() - Not Supported for Matrix Free Loads!";
328 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
343 Epetra_CrsMatrix* crs =
dynamic_cast<Epetra_CrsMatrix*
>
347 dout() <<
"SharedSystem::computePreconditioner() - "
348 <<
"Dynamic cast to CRS Matrix failed!" << std::endl;
388 Teuchos::ParameterList& params,
393 const string message =
"SharedSystem::applyRightPreconditioning - Preconditioner is 0!";
394 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
400 Linear::Vector& nonConstInput =
402 Epetra_MultiVector& epVecInput =
403 const_cast<Epetra_MultiVector&
>(nonConstInput.epetraObj());
405 Linear::Vector& nonConstResult =
407 Epetra_MultiVector& epVecResult =
408 const_cast<Epetra_MultiVector&
>(nonConstResult.epetraObj());
411 ApplyInverse(epVecInput, epVecResult);
500 if (tmpVectorPtr == 0) {
501 const string message =
502 "SharedSystem::cloneSolutionVector() - dynamic cast/ memory allocation failure!";
503 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
506 return (tmpVectorPtr);
531 (Linear::Matrix & jacobian, Linear::Vector & rhs)
533 xyceInterfacePtr_->debugOutput1(jacobian, rhs);
545 (Linear::Vector & dxVector, Linear::Vector & xVector)
547 xyceInterfacePtr_->debugOutput3(dxVector, xVector);
Teuchos::RCP< NOX::Abstract::Vector > clone(NOX::CopyType type=NOX::DeepCopy) const
bool areStateVectors(const Group *grp) const
bool applyJacobian(const Vector &input, Vector &result) const
bool deletePreconditioner()
void reset(Xyce::Linear::Vector &x, Xyce::Linear::Vector &f, Xyce::Linear::Matrix &jacobian, Xyce::Linear::Vector &newton, Xyce::Linear::Vector &gradient, Xyce::Linear::System &lasSys, Interface &interface)
const NOX::Abstract::Vector & getX() const
const Xyce::Linear::Vector & getNativeVectorRef_() const
bool computeNewton(const Vector &F, Vector &Newton, Teuchos::ParameterList ¶ms)
Pure virtual class to augment a linear system.
Ifpack_CrsRiluk * ifpackPreconditionerPtr_
bool applyJacobianTranspose(const Vector &input, Vector &result) const
Interface * xyceInterfacePtr_
NOX::Abstract::Group::ReturnType computeF()
Vector & getSolutionVector()
const Xyce::Linear::Vector & getNativeVectorRef() const
bool computeNewton(Teuchos::ParameterList &p)
void debugOutput3(Xyce::Linear::Vector &dxVector, Xyce::Linear::Vector &xVector)
bool computePreconditioner()
NOX::Abstract::Vector & scale(double gamma)
bool applyRightPreconditioning(bool useTranspose, Teuchos::ParameterList ¶ms, const Vector &input, Vector &result)
Xyce::Linear::System * getLasSystem()
SharedSystem(Xyce::Linear::Vector &x, Xyce::Linear::Vector &f, Xyce::Linear::Matrix &jacobian, Xyce::Linear::Vector &newton, Xyce::Linear::Vector &gradient, Xyce::Linear::System &lasSys, Interface &interface)
Vector * xyceGradientPtr_
const Xyce::Linear::Matrix & getJacobian() const
bool applyJacobian(const Xyce::Linear::Vector &input, Xyce::Linear::Vector &result)
bool computeJacobian(Group *grp)
const Vector & getNewtonVector() const
void getStateVectors(const Group *grp)
bool computeGradient(const Vector &F, Vector &Gradient)
bool computeF(const Vector &solution, Vector &F, const Group *grp)
const Group * ownerOfJacobian_
Xyce::Linear::System * xyceLasSysPtr_
void debugOutput1(Xyce::Linear::Matrix &jacobian, Xyce::Linear::Vector &rhs)
const Group * ownerOfStateVectors_
Vector * cloneSolutionVector() const
Xyce::Linear::Matrix * xyceJacobianPtr_
Ifpack_IlukGraph * ifpackGraphPtr_