-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge Pull Request #3448 from rppawlo/Trilinos/nox-observer-refactor
Automatically Merged using Trilinos Pull Request AutoTester PR Title: NOX: observer refactor PR Author: rppawlo
- Loading branch information
Showing
30 changed files
with
368 additions
and
536 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,114 +39,19 @@ | |
// | ||
// Questions? Contact Roger Pawlowski ([email protected]) or | ||
// Eric Phipps ([email protected]), Sandia National Laboratories. | ||
// ************************************************************************ | ||
// CVS Information | ||
// $Source$ | ||
// $Author$ | ||
// $Date$ | ||
// $Revision$ | ||
// ************************************************************************ | ||
//@HEADER | ||
|
||
#ifndef NOX_ABSTRACT_PREPOSTOPERATOR_H | ||
#define NOX_ABSTRACT_PREPOSTOPERATOR_H | ||
|
||
#include "NOX_Common.H" // for NOX_Config.h | ||
#include "NOX_Observer.hpp" | ||
|
||
// Forward Declarations | ||
// Backwards compatibility for renaming the PrePostOperator to | ||
// Observer. | ||
namespace NOX { | ||
namespace Solver { | ||
class Generic; | ||
} | ||
namespace Abstract { | ||
class Vector; | ||
using PrePostOperator = NOX::Observer; | ||
} | ||
} | ||
|
||
namespace NOX { | ||
namespace Abstract { | ||
|
||
/** \brief %NOX's pure virtual class to allow users to insert user | ||
defined operations into nox's solvers (before and after the | ||
NOX::Solver::Generic::iterate() and NOX::Solver::Generic::solve() | ||
methods). This is an Observer from GoF design pattern book. | ||
The user should implement their own concrete implementation of this | ||
class and register it as a | ||
Teuchos::RCP<NOX::Abstract::PrePostoperator> in the "Solver | ||
Options" sublist. | ||
To create and register a user defined pre/post operator: | ||
<ol> | ||
<li> Create a pre/post operator that derives from | ||
NOX::Abstract::PrePostOperator. For example, the pre/post operator \c | ||
Foo might be defined as shown below. | ||
\code | ||
class Foo : public NOX::Abstract::PrePostOperator { | ||
// Insert class definition here | ||
} | ||
\endcode | ||
<li> Create the appropriate entries in the parameter list, as follows. | ||
\code | ||
Teuchos::RCP<NOX::Abstract::PrePostOperator> foo = Teuchos::rcp(new Foo); | ||
params.sublist("Solver Options").set("User Defined Pre/Post Operator", foo); | ||
\endcode | ||
</ol> | ||
*/ | ||
|
||
class PrePostOperator { | ||
|
||
public: | ||
|
||
//! Constructor | ||
PrePostOperator() {} | ||
|
||
//! Copy constructor | ||
PrePostOperator(const NOX::Abstract::PrePostOperator& /*source*/) {} | ||
|
||
//! Destructor | ||
virtual ~PrePostOperator() {} | ||
|
||
//! User defined method that will be executed at the start of a call to NOX::Solver::Generic::iterate(). | ||
virtual void runPreIterate(const NOX::Solver::Generic& solver) {} | ||
|
||
//! User defined method that will be executed at the end of a call to NOX::Solver::Generic::iterate(). | ||
virtual void runPostIterate(const NOX::Solver::Generic& solver) {} | ||
|
||
//! User defined method that will be executed at the start of a call to NOX::Solver::Generic::solve(). | ||
virtual void runPreSolve(const NOX::Solver::Generic& solver) {} | ||
|
||
//! User defined method that will be executed at the end of a call to NOX::Solver::Generic::solve(). | ||
virtual void runPostSolve(const NOX::Solver::Generic& solver) {} | ||
|
||
/** \brief User defined method that will be executed prior to the | ||
update of the solution vector during a call to | ||
NOX::Solver::Generic::step(). This is intended to allow users to | ||
adjust the direction before the solution update, typically based | ||
on knowledge of the problem formulation. The direction is const | ||
as we can't guarantee that changes to the direction won't | ||
violate assumptions of the solution algorithm. Users can change | ||
the update/direciton after a const cast, but NOX may not | ||
function as expected. Use at your own risk! | ||
\param [in] update - the direction vector that will be used to update the solution. This will not | ||
\param [in] solver - the nox solver | ||
*/ | ||
virtual void runPreSolutionUpdate(const NOX::Abstract::Vector& update, const NOX::Solver::Generic& solver) {} | ||
|
||
//! User defined method that will be executed before a call to NOX::LineSearch::Generic::compute(). Only to be used in NOX::Solver::LineSearchBased! | ||
virtual void runPreLineSearch(const NOX::Solver::Generic& solver) {} | ||
|
||
//! User defined method that will be executed after a call to NOX::LineSearch::Generic::compute(). Only to be used in NOX::Solver::LineSearchBased! | ||
virtual void runPostLineSearch(const NOX::Solver::Generic& solver) {} | ||
}; // class PrePostOperator | ||
} // namespace Abstract | ||
} // namespace NOX | ||
|
||
#endif |
Oops, something went wrong.