Thyra::EpetraModelEvaluator Class Reference

Concrete Adapter subclass that takes an EpetraExt::ModelEvaluator object and wraps it as a Thyra::ModelEvaluator object. More...

#include <Thyra_EpetraModelEvaluator.hpp>

Inheritance diagram for Thyra::EpetraModelEvaluator:

Inheritance graph
[legend]
List of all members.

Constructors/initializers/accessors/utilities.

 EpetraModelEvaluator ()
 
 EpetraModelEvaluator (const RCP< const EpetraExt::ModelEvaluator > &epetraModel, const RCP< LinearOpWithSolveFactoryBase< double > > &W_factory)
 
void initialize (const RCP< const EpetraExt::ModelEvaluator > &epetraModel, const RCP< LinearOpWithSolveFactoryBase< double > > &W_factory)
 
RCP< const EpetraExt::ModelEvaluatorgetEpetraModel () const
 
void setNominalValues (const ModelEvaluatorBase::InArgs< double > &nominalValues)
 Set the nominal values.
void setStateVariableScalingVec (const RCP< const Epetra_Vector > &stateVariableScalingVec)
 Set the state variable scaling vector s_x (see above).
RCP< const Epetra_VectorgetStateVariableInvScalingVec () const
 Get the state variable scaling vector s_x (see above).
RCP< const Epetra_VectorgetStateVariableScalingVec () const
 Get the inverse state variable scaling vector inv_s_x (see above).
void setStateFunctionScalingVec (const RCP< const Epetra_Vector > &stateFunctionScalingVec)
 Set the state function scaling vector s_f (see above).
RCP< const Epetra_VectorgetStateFunctionScalingVec () const
 Get the state function scaling vector s_f (see above).
void uninitialize (RCP< const EpetraExt::ModelEvaluator > *epetraModel=NULL, RCP< LinearOpWithSolveFactoryBase< double > > *W_factory=NULL)
 
const ModelEvaluatorBase::InArgs<
double > & 
getFinalPoint () const
 
bool finalPointWasSolved () const
 

Public functions overridden from Teuchos::Describable.

std::string description () const
 

Overridden from ParameterListAcceptor

void setParameterList (RCP< Teuchos::ParameterList > const &paramList)
 
RCP< Teuchos::ParameterListgetNonconstParameterList ()
 
RCP< Teuchos::ParameterListunsetParameterList ()
 
RCP< const Teuchos::ParameterListgetParameterList () const
 
RCP< const Teuchos::ParameterListgetValidParameters () const
 

Public functions overridden from ModelEvaulator.

int Np () const
 
int Ng () const
 
RCP< const VectorSpaceBase<
double > > 
get_x_space () const
 
RCP< const VectorSpaceBase<
double > > 
get_f_space () const
 
RCP< const VectorSpaceBase<
double > > 
get_p_space (int l) const
 
RCP< const Teuchos::Array<
std::string > > 
get_p_names (int l) const
 
RCP< const VectorSpaceBase<
double > > 
get_g_space (int j) const
 
ModelEvaluatorBase::InArgs<
double > 
getNominalValues () const
 
ModelEvaluatorBase::InArgs<
double > 
getLowerBounds () const
 
ModelEvaluatorBase::InArgs<
double > 
getUpperBounds () const
 
RCP< LinearOpWithSolveBase<
double > > 
create_W () const
 
RCP< LinearOpBase< double > > create_W_op () const
 
RCP< const LinearOpWithSolveFactoryBase<
double > > 
get_W_factory () const
ModelEvaluatorBase::InArgs<
double > 
createInArgs () const
 
void reportFinalPoint (const ModelEvaluatorBase::InArgs< double > &finalPoint, const bool wasSolved)
 

Public Types

enum  EStateFunctionScaling

Related Functions

(Note that these are not member functions.)

RCP< EpetraModelEvaluatorepetraModelEvaluator (const RCP< const EpetraExt::ModelEvaluator > &epetraModel, const RCP< LinearOpWithSolveFactoryBase< double > > &W_factory)
 
ModelEvaluatorBase::EDerivativeMultiVectorOrientation convert (const EpetraExt::ModelEvaluator::EDerivativeMultiVectorOrientation &mvOrientation)
 
EpetraExt::ModelEvaluator::EDerivativeMultiVectorOrientation convert (const ModelEvaluatorBase::EDerivativeMultiVectorOrientation &mvOrientation)
 
ModelEvaluatorBase::DerivativeProperties convert (const EpetraExt::ModelEvaluator::DerivativeProperties &derivativeProperties)
 
ModelEvaluatorBase::DerivativeSupport convert (const EpetraExt::ModelEvaluator::DerivativeSupport &derivativeSupport)
 
EpetraExt::ModelEvaluator::Derivative convert (const ModelEvaluatorBase::Derivative< double > &derivative, const RCP< const Epetra_Map > &fnc_map, const RCP< const Epetra_Map > &var_map)
 

Detailed Description

Concrete Adapter subclass that takes an EpetraExt::ModelEvaluator object and wraps it as a Thyra::ModelEvaluator object.

This class takes care of the basic details of wrapping and unwrapping Epetra from Thyra objects. This class is highly configurable and will be maintained and modified in the future as the basic link between the Epetra world and the Thyra world for nonlinear models and nonlinear algorithms.

Scaling

This class can handle scaling of the state function f(...) and of the state variables x and all of the affected derivatives.

The scaling for the state function can be set manually using setStateFunctionScalingVec() or can be computed automatically using the parameter "State Function Scaling" (see documentation output from this->getValidParameters()->print(...)) in the input parameter list set by setParameterList(). Reguardless of how the state function scaling is computed, it will compute a positive vector s_f that defines a diagonal matrix S_f = diag(s_f) that transforms the state function:

    f(...) = S_f * f_orig(...)

 

where f_orig(...) is the original state function as computed by the underlying EpetraExt::ModelEvaluator object and f(...) is the state function as computed by evalModel().

The scaling for the state variables must be set manually using Thyra::setStateVariableScalingVec(). The vector that is set s_x>/tt> defines a diagonal scaling matrix S_x = diag(s_x) that transforms the variables as:

    x = S_x * x_orig

 

where x_orig is the original unscaled state variable vector as defined by the underlying EpetraExt::ModelEvaluator object and x is the scaled state varaible vector as returned from getNominalValues() and as accepted by evalModel(). Note that when the scaled variables x are passed into evalModel that they are unscaled as:

    x_orig = inv(S_x) * x

 

where inv(S_x) is the inverse of the diagonals of S_x which is stored as a vector inv_s_x.

Note how these scalings affect the state function:

    f(x,...) = S_f * f_orig( inv(S_x)*x...)

 

which as the state/state Jacobian:

    W = d(f)/d(x) = S_f * d(f_orig)/d(x_orig) * inv(S_x)

 

Currently, this class does not handle scalings of the parameters p(l) or of the auxilary response functions g(j)(...).

The state varaible and state function scaling gives the following scaled quantities:

    f = S_f * f_orig

    W = S_f * W_orig * inv(S_x)

    DfDp(l) = S_f * DfDp_orig(l)

    g(j) = g_orig(j)

    DgDx_dot(j) = DgDx_dot_orig(j) * inv(S_x)

    DgDx(j) = DgDx_orig(j) * inv(S_x)
    
    DgDp(j,l) = DgDp_orig(j,l)

 

Since the scaling is done explicitly, the client never even sees the orginal scaling and the linear solver (and contained preconditioner) are computed from the scaled W shown above.

ToDo: Describe how scaling affects the Hessian-vector products an how you just need to scale the Lagrange mutipliers as:

  u^T * f(...) = u^T * (S_f * f_orig(...)) = u_f^T * f_orig(...)

 

where u_f = S_f * u.

ToDo: Finish documentation!

Examples:

ForwardSolveEpetraModelEval2DSimMain.cpp.

Definition at line 160 of file Thyra_EpetraModelEvaluator.hpp.


Constructor & Destructor Documentation

Thyra::EpetraModelEvaluator::EpetraModelEvaluator (  ) 

Definition at line 110 of file Thyra_EpetraModelEvaluator.cpp.

Thyra::EpetraModelEvaluator::EpetraModelEvaluator ( const RCP< const EpetraExt::ModelEvaluator > &  epetraModel,
const RCP< LinearOpWithSolveFactoryBase< double > > &  W_factory 
)

Definition at line 116 of file Thyra_EpetraModelEvaluator.cpp.


Member Function Documentation

void Thyra::EpetraModelEvaluator::initialize ( const RCP< const EpetraExt::ModelEvaluator > &  epetraModel,
const RCP< LinearOpWithSolveFactoryBase< double > > &  W_factory 
)

Definition at line 127 of file Thyra_EpetraModelEvaluator.cpp.

RCP< const EpetraExt::ModelEvaluator > Thyra::EpetraModelEvaluator::getEpetraModel (  )  const

Definition at line 184 of file Thyra_EpetraModelEvaluator.cpp.

void Thyra::EpetraModelEvaluator::setNominalValues ( const ModelEvaluatorBase::InArgs< double > &  nominalValues  ) 

Set the nominal values.

Warning, if scaling is being used, these must be according to the scaled values, not the original unscaled values.

Definition at line 190 of file Thyra_EpetraModelEvaluator.cpp.

void Thyra::EpetraModelEvaluator::setStateVariableScalingVec ( const RCP< const Epetra_Vector > &  stateVariableScalingVec  ) 

Set the state variable scaling vector s_x (see above).

This function must be called after intialize() or the constructur in order to set the scaling vector correctly!

ToDo: Move this into an external strategy class object!

Definition at line 199 of file Thyra_EpetraModelEvaluator.cpp.

RCP< const Epetra_Vector > Thyra::EpetraModelEvaluator::getStateVariableInvScalingVec (  )  const

Get the state variable scaling vector s_x (see above).

Definition at line 221 of file Thyra_EpetraModelEvaluator.cpp.

RCP< const Epetra_Vector > Thyra::EpetraModelEvaluator::getStateVariableScalingVec (  )  const

Get the inverse state variable scaling vector inv_s_x (see above).

Definition at line 214 of file Thyra_EpetraModelEvaluator.cpp.

void Thyra::EpetraModelEvaluator::setStateFunctionScalingVec ( const RCP< const Epetra_Vector > &  stateFunctionScalingVec  ) 

Set the state function scaling vector s_f (see above).

Definition at line 228 of file Thyra_EpetraModelEvaluator.cpp.

RCP< const Epetra_Vector > Thyra::EpetraModelEvaluator::getStateFunctionScalingVec (  )  const

Get the state function scaling vector s_f (see above).

Definition at line 237 of file Thyra_EpetraModelEvaluator.cpp.

void Thyra::EpetraModelEvaluator::uninitialize ( RCP< const EpetraExt::ModelEvaluator > *  epetraModel = NULL,
RCP< LinearOpWithSolveFactoryBase< double > > *  W_factory = NULL 
)

Definition at line 243 of file Thyra_EpetraModelEvaluator.cpp.

const ModelEvaluatorBase::InArgs< double > & Thyra::EpetraModelEvaluator::getFinalPoint (  )  const

Definition at line 260 of file Thyra_EpetraModelEvaluator.cpp.

bool Thyra::EpetraModelEvaluator::finalPointWasSolved (  )  const

Definition at line 266 of file Thyra_EpetraModelEvaluator.cpp.

std::string Thyra::EpetraModelEvaluator::description (  )  const [virtual]

Reimplemented from Teuchos::Describable.

Definition at line 275 of file Thyra_EpetraModelEvaluator.cpp.

void Thyra::EpetraModelEvaluator::setParameterList ( RCP< Teuchos::ParameterList > const &  paramList  ) 

Definition at line 297 of file Thyra_EpetraModelEvaluator.cpp.

RCP< Teuchos::ParameterList > Thyra::EpetraModelEvaluator::getNonconstParameterList (  )  [virtual]

Implements Teuchos::ParameterListAcceptor.

Definition at line 318 of file Thyra_EpetraModelEvaluator.cpp.

RCP< Teuchos::ParameterList > Thyra::EpetraModelEvaluator::unsetParameterList (  )  [virtual]

Implements Teuchos::ParameterListAcceptor.

Definition at line 325 of file Thyra_EpetraModelEvaluator.cpp.

RCP< const Teuchos::ParameterList > Thyra::EpetraModelEvaluator::getParameterList (  )  const [virtual]

Reimplemented from Teuchos::ParameterListAcceptor.

Definition at line 334 of file Thyra_EpetraModelEvaluator.cpp.

RCP< const Teuchos::ParameterList > Thyra::EpetraModelEvaluator::getValidParameters (  )  const [virtual]

Reimplemented from Teuchos::ParameterListAcceptor.

Definition at line 341 of file Thyra_EpetraModelEvaluator.cpp.

int Thyra::EpetraModelEvaluator::Np (  )  const [virtual]

Reimplemented from Thyra::ModelEvaluatorDefaultBase< double >.

Definition at line 388 of file Thyra_EpetraModelEvaluator.cpp.

int Thyra::EpetraModelEvaluator::Ng (  )  const [virtual]

Reimplemented from Thyra::ModelEvaluatorDefaultBase< double >.

Definition at line 394 of file Thyra_EpetraModelEvaluator.cpp.

RCP< const VectorSpaceBase< double > > Thyra::EpetraModelEvaluator::get_x_space (  )  const [virtual]

Implements Thyra::ModelEvaluator< Scalar >.

Definition at line 401 of file Thyra_EpetraModelEvaluator.cpp.

RCP< const VectorSpaceBase< double > > Thyra::EpetraModelEvaluator::get_f_space (  )  const [virtual]

Implements Thyra::ModelEvaluator< Scalar >.

Definition at line 408 of file Thyra_EpetraModelEvaluator.cpp.

RCP< const VectorSpaceBase< double > > Thyra::EpetraModelEvaluator::get_p_space ( int  l  )  const [virtual]

Implements Thyra::ModelEvaluator< Scalar >.

Definition at line 415 of file Thyra_EpetraModelEvaluator.cpp.

RCP< const Teuchos::Array< std::string > > Thyra::EpetraModelEvaluator::get_p_names ( int  l  )  const [virtual]

Implements Thyra::ModelEvaluator< Scalar >.

Definition at line 425 of file Thyra_EpetraModelEvaluator.cpp.

RCP< const VectorSpaceBase< double > > Thyra::EpetraModelEvaluator::get_g_space ( int  j  )  const [virtual]

Implements Thyra::ModelEvaluator< Scalar >.

Definition at line 435 of file Thyra_EpetraModelEvaluator.cpp.

ModelEvaluatorBase::InArgs< double > Thyra::EpetraModelEvaluator::getNominalValues (  )  const [virtual]

Implements Thyra::ModelEvaluator< Scalar >.

Definition at line 443 of file Thyra_EpetraModelEvaluator.cpp.

ModelEvaluatorBase::InArgs< double > Thyra::EpetraModelEvaluator::getLowerBounds (  )  const [virtual]

Implements Thyra::ModelEvaluator< Scalar >.

Definition at line 451 of file Thyra_EpetraModelEvaluator.cpp.

ModelEvaluatorBase::InArgs< double > Thyra::EpetraModelEvaluator::getUpperBounds (  )  const [virtual]

Implements Thyra::ModelEvaluator< Scalar >.

Definition at line 459 of file Thyra_EpetraModelEvaluator.cpp.

RCP< LinearOpWithSolveBase< double > > Thyra::EpetraModelEvaluator::create_W (  )  const [virtual]

Reimplemented from Thyra::ModelEvaluatorDefaultBase< double >.

Definition at line 467 of file Thyra_EpetraModelEvaluator.cpp.

RCP< LinearOpBase< double > > Thyra::EpetraModelEvaluator::create_W_op (  )  const [virtual]

Implements Thyra::ModelEvaluator< Scalar >.

Definition at line 482 of file Thyra_EpetraModelEvaluator.cpp.

RCP< const LinearOpWithSolveFactoryBase< double > > Thyra::EpetraModelEvaluator::get_W_factory (  )  const [virtual]

.

Implements Thyra::ModelEvaluator< Scalar >.

Definition at line 489 of file Thyra_EpetraModelEvaluator.cpp.

ModelEvaluatorBase::InArgs< double > Thyra::EpetraModelEvaluator::createInArgs (  )  const [virtual]

Implements Thyra::ModelEvaluator< Scalar >.

Definition at line 495 of file Thyra_EpetraModelEvaluator.cpp.

void Thyra::EpetraModelEvaluator::reportFinalPoint ( const ModelEvaluatorBase::InArgs< double > &  finalPoint,
const bool  wasSolved 
)

Definition at line 503 of file Thyra_EpetraModelEvaluator.cpp.


Friends And Related Function Documentation

RCP< EpetraModelEvaluator > epetraModelEvaluator ( const RCP< const EpetraExt::ModelEvaluator > &  epetraModel,
const RCP< LinearOpWithSolveFactoryBase< double > > &  W_factory 
) [related]

Definition at line 1390 of file Thyra_EpetraModelEvaluator.cpp.

ModelEvaluatorBase::EDerivativeMultiVectorOrientation convert ( const EpetraExt::ModelEvaluator::EDerivativeMultiVectorOrientation mvOrientation  )  [related]

Definition at line 1400 of file Thyra_EpetraModelEvaluator.cpp.

EpetraExt::ModelEvaluator::EDerivativeMultiVectorOrientation convert ( const ModelEvaluatorBase::EDerivativeMultiVectorOrientation mvOrientation  )  [related]

ModelEvaluatorBase::DerivativeProperties convert ( const EpetraExt::ModelEvaluator::DerivativeProperties derivativeProperties  )  [related]

Definition at line 1434 of file Thyra_EpetraModelEvaluator.cpp.

ModelEvaluatorBase::DerivativeSupport convert ( const EpetraExt::ModelEvaluator::DerivativeSupport derivativeSupport  )  [related]

Definition at line 1472 of file Thyra_EpetraModelEvaluator.cpp.

EpetraExt::ModelEvaluator::Derivative convert ( const ModelEvaluatorBase::Derivative< double > &  derivative,
const RCP< const Epetra_Map > &  fnc_map,
const RCP< const Epetra_Map > &  var_map 
) [related]

Definition at line 1488 of file Thyra_EpetraModelEvaluator.cpp.


The documentation for this class was generated from the following files:
Generated on Wed May 12 21:27:26 2010 for EpetraExt/Thyra Adapters by  doxygen 1.4.7