NOX  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Related Functions | List of all members
NOX::LineSearch::Factory Class Reference

Factory to build line search objects derived from NOX::LineSearch::Generic. More...

#include <NOX_LineSearch_Factory.H>

Public Member Functions

 Factory ()
 Constructor.
 
 ~Factory ()
 Destructor.
 
Teuchos::RCP
< NOX::LineSearch::Generic
buildLineSearch (const Teuchos::RCP< NOX::GlobalData > &gd, Teuchos::ParameterList &params)
 Factory to build a line search object. More...
 

Related Functions

(Note that these are not member functions.)

Teuchos::RCP
< NOX::LineSearch::Generic
buildLineSearch (const Teuchos::RCP< NOX::GlobalData > &gd, Teuchos::ParameterList &params)
 

Detailed Description

Factory to build line search objects derived from NOX::LineSearch::Generic.

Parameters

Using a User-Defined Line Search

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

class MyLineSearch : public NOX::LineSearch::Generic {
// Ctor that takes the standard line search arguments.
MyLineSearch(const Teuchos::RCP<NOX::GlobalData>& gd,
.
.
.
};

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

class MyFactory {
MyDirFactory();
~MyDirFactory();
.
.
.
};

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

using namespace Teuchos; // for RCP and ParameterList
ParameterList& ls_params = p.sublist("Line Search");
RCP<NOX::LineSearch::UserDefinedFactory> ls_facotry = rcp(new MyLineSearchFactory);
ls_params.set("Method", "User Defined");
ls_params.set("User Defined Line Search Factory", ls_factory);

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

Member Function Documentation

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

Factory to build a line search object.

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

References NOX::LineSearch::UserDefinedFactory::buildLineSearch(), Teuchos::ParameterList::get(), Teuchos::rcp(), and TEUCHOS_TEST_FOR_EXCEPTION.

Friends And Related Function Documentation

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

Nonmember function to build a line search object.


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