| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// Trilinos: An Object-Oriented Solver Framework |
| 4 |
// |
| 5 |
// Copyright 2001-2024 NTESS and the Trilinos contributors. |
| 6 |
// SPDX-License-Identifier: BSD-3-Clause |
| 7 |
// ***************************************************************************** |
| 8 |
// @HEADER |
| 9 |
|
| 10 |
/* ******************************************************************** */ |
| 11 |
/* See the file COPYRIGHT for a complete copyright notice, contact */ |
| 12 |
/* person and disclaimer. */ |
| 13 |
/* ******************************************************************** */ |
| 14 |
/*! |
| 15 |
* \file nlnml_preconditioner1.cpp |
| 16 |
* |
| 17 |
* \class ML_Nox_Preconditioner |
| 18 |
* |
| 19 |
* \brief ML nonlinear preconditioner and solver |
| 20 |
* |
| 21 |
* \date Last update do Doxygen: 31-Mar-05 |
| 22 |
* |
| 23 |
*/ |
| 24 |
#include "ml_common.h" |
| 25 |
#include "TrilinosCouplings_config.h" |
| 26 |
|
| 27 |
#if defined(HAVE_ML_NOX) && defined(HAVE_ML_EPETRA) && defined(HAVE_ML_AZTECOO) && defined(HAVE_ML_TEUCHOS) && defined(HAVE_ML_IFPACK) && defined(HAVE_ML_AMESOS) && defined(HAVE_ML_EPETRAEXT) |
| 28 |
|
| 29 |
// ---------- Includes ---------- |
| 30 |
#include <ctime> |
| 31 |
#include <iostream> |
| 32 |
|
| 33 |
// this class |
| 34 |
#include "nlnml_ConstrainedMultiLevelOperator.H" |
| 35 |
|
| 36 |
/*----------------------------------------------------------------------* |
| 37 |
| ctor (public) m.gee 3/06| |
| 38 |
*----------------------------------------------------------------------*/ |
| 39 |
NLNML::NLNML_ConstrainedMultiLevelOperator::NLNML_ConstrainedMultiLevelOperator( |
| 40 |
RefCountPtr<ML_Epetra::MultiLevelOperator> ml_operator, |
| 41 |
RefCountPtr<NLNML::NLNML_CoarseLevelNoxInterface> coarseinterface, |
| 42 |
bool applyconstraints) : |
| 43 |
comm_(ml_operator->Comm()), |
| 44 |
coarseinterface_(coarseinterface), |
| 45 |
ml_operator_(ml_operator), |
| 46 |
applyconstraints_(applyconstraints) |
| 47 |
{ |
| 48 |
label_ = "NLNML_ConstrainedMultiLevelOperator"; |
| 49 |
return; |
| 50 |
} |
| 51 |
|
| 52 |
|
| 53 |
/*----------------------------------------------------------------------* |
| 54 |
| m.gee 3/06| |
| 55 |
*----------------------------------------------------------------------*/ |
| 56 |
int NLNML::NLNML_ConstrainedMultiLevelOperator::ApplyInverse( |
| 57 |
const Epetra_MultiVector& X, Epetra_MultiVector& Y) const |
| 58 |
{ |
| 59 |
int err = ml_operator_->ApplyInverse(X,Y); |
| 60 |
if (applyconstraints_) |
| 61 |
{ |
| 62 |
Epetra_Vector tmp(View,Y,0); |
| 63 |
coarseinterface_->ApplyAllConstraints(tmp); |
| 64 |
} |
| 65 |
return err; |
| 66 |
} |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
#endif |