46 #include <Xyce_config.h>
52 #include <N_UTL_Misc.h>
56 #include "N_LAS_Vector.h"
57 #include "N_LAS_Matrix.h"
58 #include "N_LAS_System.h"
59 #include "N_LAS_Builder.h"
60 #include "N_ERH_ErrorMgr.h"
61 #include "Epetra_CrsMatrix.h"
62 #include "Ifpack_IlukGraph.h"
63 #include "Ifpack_CrsRiluk.h"
68 using namespace N_NLS_NOX;
84 N_LAS_Matrix& jacobian,
86 N_LAS_Vector& gradient,
97 matrixFreeFlag_(false),
99 ownerOfStateVectors_(0),
101 ifpackPreconditionerPtr_(0)
103 reset(soln, f, jacobian, newton, gradient, lasSys, interface);
133 N_LAS_Matrix& jacobian,
134 N_LAS_Vector& newton,
135 N_LAS_Vector& gradient,
136 N_LAS_System& lasSys,
175 #ifdef Xyce_NOX_USE_VECTOR_COPY
182 if (status ==
false) {
183 const string message =
"Error: N_NLS_NOX::SharedSystem::computeF() - compute F failed!";
184 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
187 #ifdef Xyce_NOX_USE_VECTOR_COPY
206 #ifdef Xyce_NOX_USE_VECTOR_COPY
211 #ifdef Xyce_VERBOSE_NOX
213 cout <<
"Warning: N_NLS_NOX::SharedSystem::computeJacobian() - State "
214 <<
"Vectors are not valid wrt solution!" << endl;
215 cout <<
"Calling computeResidual to fix this!" << endl;
221 NOX::Abstract::Group::ReturnType status = grp->
computeF();
223 if (status != NOX::Abstract::Group::Ok) {
224 const string message =
"N_NLS_NOX::SharedSystem::computeJacobian() - compute F failed!";
225 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
230 #ifdef Xyce_NOX_USE_VECTOR_COPY
234 (dynamic_cast<const N_NLS_NOX::Vector &> (grp->
getX()));
237 if (status ==
false) {
238 const string message =
"N_NLS_NOX::SharedSystem::computeJacobian() - compute Jac failed!";
239 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
255 Teuchos::ParameterList& params)
295 bool NoTranspose =
false;
299 #ifndef Xyce_NOX_USE_VECTOR_COPY
300 const string message =
"N_NLS_NOX::SharedSystem::applyJacobian() - ERROR, Xyce_NOX_USE_VECTOR_COPY required";
301 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
304 if (status ==
false) {
305 const string message =
"N_NLS_NOX::SharedSystem::applyJacobian() - apply Jac failed!";
306 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
323 bool Transpose =
true;
326 const string message =
"N_NLS_NOX::SharedSystem::applyJacobianTranspose() - Not Supported for Matrix Free Loads!";
327 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
342 Epetra_CrsMatrix* crs =
dynamic_cast<Epetra_CrsMatrix*
>
346 cout <<
"N_NLS_NOX::SharedSystem::computePreconditioner() - "
347 <<
"Dynamic cast to CRS Matrix failed!" << endl;
387 Teuchos::ParameterList& params,
392 const string message =
"N_NLS_NOX::SharedSystem::applyRightPreconditioning - Preconditioner is 0!";
393 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
399 N_LAS_Vector& nonConstInput =
401 Epetra_MultiVector& epVecInput =
402 const_cast<Epetra_MultiVector&
>(nonConstInput.epetraObj());
404 N_LAS_Vector& nonConstResult =
406 Epetra_MultiVector& epVecResult =
407 const_cast<Epetra_MultiVector&
>(nonConstResult.epetraObj());
410 ApplyInverse(epVecInput, epVecResult);
499 if (tmpVectorPtr == 0) {
500 const string message =
501 "N_NLS_NOX::SharedSystem::cloneSolutionVector() - dynamic cast/ memory allocation failure!";
502 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
505 return (tmpVectorPtr);
521 #ifdef Xyce_DEBUG_NONLINEAR
530 void SharedSystem::debugOutput1
531 (N_LAS_Matrix & jacobian, N_LAS_Vector & rhs)
544 void SharedSystem::debugOutput3
545 (N_LAS_Vector & dxVector, N_LAS_Vector & xVector)