Debian Codegraph @

packages/trilinoscouplings/src/ml/NonlinML/nlnml_prepostoperator.cpp

raw
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 // ML-headers
15 #include "ml_common.h"
16 #include "TrilinosCouplings_config.h"
17
18 #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)
19
20 // ---------- Includes ----------
21 #include <ctime>
22 #include <iostream>
23 #include "nlnml_prepostoperator.H"
24
25 /*----------------------------------------------------------------------*
26 | ctor (public) m.gee 3/06|
27 *----------------------------------------------------------------------*/
28 NLNML::NLNML_PrePostOperator::NLNML_PrePostOperator(
29 RefCountPtr<NLNML::NLNML_CoarseLevelNoxInterface> coarseinterface,
30 RefCountPtr<NLNML::NLNML_FineLevelNoxInterface> finterface) :
31 fineinterface_(finterface),
32 coarseinterface_(coarseinterface)
33 {
34 type_ = "NLNML::NLNML_PrePostOperator";
35 return;
36 }
37
38
39 /*----------------------------------------------------------------------*
40 | ctor (public) m.gee 3/06|
41 *----------------------------------------------------------------------*/
42 NLNML::NLNML_PrePostOperator::NLNML_PrePostOperator(
43 const NLNML::NLNML_PrePostOperator& old) :
44 type_(old.type_),
45 fineinterface_(old.fineinterface_),
46 coarseinterface_(old.coarseinterface_)
47 {
48 return;
49 }
50
51
52 /*----------------------------------------------------------------------*
53 | dtor (public) m.gee 3/06|
54 *----------------------------------------------------------------------*/
55 NLNML::NLNML_PrePostOperator::~NLNML_PrePostOperator()
56 {
57 return;
58 }
59
60
61 /*----------------------------------------------------------------------*
62 | dtor (public) m.gee 3/06|
63 *----------------------------------------------------------------------*/
64 void NLNML::NLNML_PrePostOperator::runPreSolve(const NOX::Solver::Generic& solver)
65 {
66 const NOX::Epetra::Group& solgroup =
67 dynamic_cast<const NOX::Epetra::Group&>(solver.getSolutionGroup());
68 const NOX::Epetra::Vector* noxsolution =
69 dynamic_cast<const NOX::Epetra::Vector*>(&solgroup.getX());
70 Epetra_Vector& epetrasolution =
71 const_cast<Epetra_Vector&>(noxsolution->getEpetraVector());
72
73 coarseinterface_->ApplyAllConstraints(epetrasolution);
74
75 // put the vector back into place
76 const NOX::Epetra::Group& solgroup2 =
77 dynamic_cast<const NOX::Epetra::Group&>(solver.getSolutionGroup());
78 const NOX::Epetra::Vector* noxsolution2 =
79 dynamic_cast<const NOX::Epetra::Vector*>(&solgroup2.getX());
80 Epetra_Vector& epetrasolution2 =
81 const_cast<Epetra_Vector&>(noxsolution2->getEpetraVector());
82 epetrasolution2.Scale(1.0,epetrasolution);
83 return;
84 }
85
86
87
88
89
90
91
92
93
94
95 #endif