NOX Development
Loading...
Searching...
No Matches
NOX::Direction::Factory Class Reference

Factory to build direction objects derived from NOX::Direction::Generic. More...

#include <NOX_Direction_Factory.H>

Public Member Functions

 Factory ()
 Constructor.
 ~Factory ()
 Destructor.
Teuchos::RCP< NOX::Direction::GenericbuildDirection (const Teuchos::RCP< NOX::GlobalData > &gd, Teuchos::ParameterList &params)
 Factory to build a direction object.

(Note that these are not member symbols.)

Teuchos::RCP< NOX::Direction::GenericbuildDirection (const Teuchos::RCP< NOX::GlobalData > &gd, Teuchos::ParameterList &params)

Detailed Description

Factory to build direction objects derived from NOX::Direction::Generic.

Parameters

  • "Method" <std::string> Name of the direction. Valid choices are:

  • "User Defined Constructor" - see below

  • "Newton" <sublist> Parameters to build a NOX::Direction::Newton object.
  • "Steepest Descent" <sublist> Parameters to build a NOX::Direction::SteepestDescent object.
  • "NonlinearCG" <sublist> Parameters to build a NOX::Direction::NonlinearCG object.
  • "Broyden" <sublist> Parameters to build a NOX::Direction::Broyden object.
  • "Tensor" <sublist> Parameters to build a NOX::Direction::Tensor object.
  • "Modified-Newton" <sublist> Parameters to build a NOX::Direction::ModifiedNewton object.
  • "Quasi-Newton" <sublist> Parameters to build a NOX::Direction::QuasiNewton object.
  • "User Defined Direction Factory" < RCP<NOX::Direction::UserDefinedFactory> > RCP to a NOX::Direction::UserDefinedFactory derived object. This factory object is used to build user defined direction objects.

Using a User-Defined Direction

The user has the option of passing in a user-defined direction. First, they must implement their own direction, deriving from the base class interface NOX::Direction::Generic:

class MyDirection : public NOX::Direction::Generic {
// Ctor that takes the standard direction arguments.
MyDirection(const Teuchos::RCP<NOX::GlobalData>& gd,
Teuchos::ParameterList& params);
.
.
.
};
Generic direction interface
Definition NOX_Direction_Generic.H:46

Next they must write a factory to build their object, deriving from the NOX::Direction::UserDefinedFactory base class interface:

class MyFactory {
MyDirFactory();
~MyDirFactory();
Teuchos::RCP<NOX::Direction::Generic> buildDirection(const Teuchos::RCP< NOX::GlobalData > &gd, Teuchos::ParameterList &params)
.
.
.
};
Teuchos::RCP< NOX::Direction::Generic > buildDirection(const Teuchos::RCP< NOX::GlobalData > &gd, Teuchos::ParameterList &params)
Factory to build a direction object.
Definition NOX_Direction_Factory.C:42

Then under the "Direction" parameter sublist, they need to set the method to "User Defined" and register the factory:

using namespace Teuchos; // for RCP and ParameterList
ParameterList& dir_params = p.sublist("Direction");
RCP<NOX::Direction::UserDefinedFactory> dir_facotry = rcp(new MyDirectionFactory);
dir_params.set("Method", "User Defined");
dir_params.set("User Defined Direction Factory", dir_factory);

It is critical that the user defined factory be set in the parameter list as a base class type object: NOX::Direction::UserDefinedFactory.

Member Function Documentation

◆ buildDirection()

Teuchos::RCP< NOX::Direction::Generic > NOX::Direction::Factory::buildDirection ( const Teuchos::RCP< NOX::GlobalData > & gd,
Teuchos::ParameterList & params )

Factory to build a direction object.

Parameters
gdA global data pointer that contains the top level parameter list. Without storing this inside the direction object, there is no guarantee that the second parameter params will still exist. It can be deleted by the top level RCP.
paramsSublist with direction construction parameters.

◆ buildDirection()

Teuchos::RCP< NOX::Direction::Generic > buildDirection ( const Teuchos::RCP< NOX::GlobalData > & gd,
Teuchos::ParameterList & params )
related

Nonmember function to build a direction object.


The documentation for this class was generated from the following files: