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;
80 N_LAS_Matrix& jacobian,
82 N_LAS_Vector& gradient,
93 matrixFreeFlag_(false),
95 ownerOfStateVectors_(0),
97 ifpackPreconditionerPtr_(0)
99 reset(soln, f, jacobian, newton, gradient, lasSys, interface);
129 N_LAS_Matrix& jacobian,
130 N_LAS_Vector& newton,
131 N_LAS_Vector& gradient,
132 N_LAS_System& lasSys,
169 #ifdef Xyce_NOX_USE_VECTOR_COPY
176 if (status ==
false) {
177 const string message =
"Error: N_NLS_NOX::SharedSystem::computeF() - compute F failed!";
178 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
181 #ifdef Xyce_NOX_USE_VECTOR_COPY
199 #ifdef Xyce_NOX_USE_VECTOR_COPY
204 #ifdef Xyce_VERBOSE_NOX
206 cout <<
"Warning: N_NLS_NOX::SharedSystem::computeJacobian() - State "
207 <<
"Vectors are not valid wrt solution!" << endl;
208 cout <<
"Calling computeResidual to fix this!" << endl;
214 NOX::Abstract::Group::ReturnType status = grp->
computeF();
216 if (status != NOX::Abstract::Group::Ok) {
217 const string message =
"N_NLS_NOX::SharedSystem::computeJacobian() - compute F failed!";
218 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
223 #ifdef Xyce_NOX_USE_VECTOR_COPY
227 (dynamic_cast<const N_NLS_NOX::Vector &> (grp->
getX()));
230 if (status ==
false) {
231 const string message =
"N_NLS_NOX::SharedSystem::computeJacobian() - compute Jac failed!";
232 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
247 Teuchos::ParameterList& params)
286 bool NoTranspose =
false;
290 #ifndef Xyce_NOX_USE_VECTOR_COPY
291 const string message =
"N_NLS_NOX::SharedSystem::applyJacobian() - ERROR, Xyce_NOX_USE_VECTOR_COPY required";
292 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
295 if (status ==
false) {
296 const string message =
"N_NLS_NOX::SharedSystem::applyJacobian() - apply Jac failed!";
297 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
314 bool Transpose =
true;
317 const string message =
"N_NLS_NOX::SharedSystem::applyJacobianTranspose() - Not Supported for Matrix Free Loads!";
318 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
333 Epetra_CrsMatrix* crs =
dynamic_cast<Epetra_CrsMatrix*
>
337 cout <<
"N_NLS_NOX::SharedSystem::computePreconditioner() - "
338 <<
"Dynamic cast to CRS Matrix failed!" << endl;
378 Teuchos::ParameterList& params,
383 const string message =
"N_NLS_NOX::SharedSystem::applyRightPreconditioning - Preconditioner is 0!";
384 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
390 N_LAS_Vector& nonConstInput =
392 Epetra_MultiVector& epVecInput =
393 const_cast<Epetra_MultiVector&
>(nonConstInput.epetraObj());
395 N_LAS_Vector& nonConstResult =
397 Epetra_MultiVector& epVecResult =
398 const_cast<Epetra_MultiVector&
>(nonConstResult.epetraObj());
401 ApplyInverse(epVecInput, epVecResult);
490 if (tmpVectorPtr == 0) {
491 const string message =
492 "N_NLS_NOX::SharedSystem::cloneSolutionVector() - dynamic cast/ memory allocation failure!";
493 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
496 return (tmpVectorPtr);
512 #ifdef Xyce_DEBUG_NONLINEAR
521 void SharedSystem::debugOutput1
522 (N_LAS_Matrix & jacobian, N_LAS_Vector & rhs)
535 void SharedSystem::debugOutput3
536 (N_LAS_Vector & dxVector, N_LAS_Vector & xVector)