Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

Functional.hh

Go to the documentation of this file.
00001 #ifndef FUNCTIONAL
00002 #define FUNCTIONAL
00003 
00015 #include "IotrRefCount.hh"
00016 #include "IotrHandle.hh"
00017 #include "PrimalDualSystem.hh"
00018 #include <iostream>
00019 
00020 class EvaluationContext;
00021 class ConcreteEvaluationContext;
00022 class IotrVector;
00023 class GenMatrix;
00024 class SymMatrix;
00025 class IotrMask;
00026 
00030 class Functional : public IotrRefCount {
00031 public:
00039   virtual EvaluationContext * evaluate(IotrVector * x, IotrVector * Lm ) = 0;
00040 
00041   virtual IotrVector * newPrimalVector()   const = 0;
00042   virtual IotrVector * newDualVector()     const = 0;
00043   virtual GenMatrix  * newJacobianMatrix() const = 0;
00044   virtual SymMatrix  * newHessianMatrix()  const = 0;
00045   virtual PrimalDualSystem *
00046   newPrimalDualSystem( ElementGather * iclow, ElementGather * icupp,
00047                        ElementGather * ieq,
00048                        ElementGather * ixlow, ElementGather * ixupp,
00049                        IotrMask * aXmask ) = 0;
00050 };
00051 typedef Handle<Functional> FunctionalHandle;
00052 
00053 
00058 class ConcreteFunctional : public Functional {
00059 friend class ConcreteEvaluationContext;
00060 protected:
00069   virtual void concreteValues( double& obj, IotrVector & c,
00070                                IotrVector & x )  = 0;
00080   virtual void concreteGrads( IotrVector & g, GenMatrix & J,
00081                               IotrVector & x ) = 0;
00091   virtual void concreteHess( SymMatrix & H,
00092                              IotrVector & x, IotrVector & Lm) = 0;
00093 public:
00094   // specializes Functional::values
00095   //virtual void values( double& obj, IotrVector & c, IotrVector & x );
00104   virtual EvaluationContext * evaluate(IotrVector * x, IotrVector * Lm );
00105 };
00106 typedef Handle<ConcreteFunctional> ConcreteFunctionalHandle;
00107 
00108 
00115 class EvaluationContext : public IotrRefCount {
00116 public:
00121   virtual void values( double& obj, IotrVector & c) = 0;
00127   virtual void grads( IotrVector & g, GenMatrix & J ) = 0;
00131   virtual void hessian( SymMatrix & H) = 0;
00132 };
00133 
00134 typedef Handle<EvaluationContext> EvaluationContextHandle;
00135 
00144 class ConcreteEvaluationContext : public EvaluationContext {
00145 protected:
00148   IotrVectorHandle mX;
00151   IotrVectorHandle mLm;
00155   ConcreteFunctionalHandle mFunc;
00156 public:
00159   ConcreteEvaluationContext(IotrVector * x, IotrVector * Lm,
00160                            ConcreteFunctional * func );
00161   //specializes EvaluationContext::values
00162   virtual void values( double & obj, IotrVector & c);
00163   //specializes EvaluationContext::grads
00164   virtual void grads( IotrVector & g, GenMatrix & J );
00165   //specializes EvalutationContext::hessian
00166   virtual void hessian( SymMatrix & H);
00167 };
00168 typedef Handle<ConcreteEvaluationContext> ConcreteEvaluationContextHandle;
00169 
00174 #endif

Generated on Wed Aug 27 10:03:41 2003 for iotr by doxygen1.2.18