Thyra_ModelEvaluatorDelegatorBase.hpp

Go to the documentation of this file.
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 //    Thyra: Interfaces and Support for Abstract Numerical Algorithms
00005 //                 Copyright (2004) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 
00029 #ifndef THYRA_DEFAULT_MODEL_EVALUATOR_DELEGETOR_BASE_HPP
00030 #define THYRA_DEFAULT_MODEL_EVALUATOR_DELEGETOR_BASE_HPP
00031 
00032 #include "Thyra_ModelEvaluator.hpp"
00033 #include "Teuchos_ConstNonconstObjectContainer.hpp"
00034 
00035 namespace Thyra {
00036 
00061 template<class Scalar>
00062 class ModelEvaluatorDelegatorBase : virtual public ModelEvaluator<Scalar> {
00063 public:
00064 
00067 
00069   ModelEvaluatorDelegatorBase();
00070 
00072   ModelEvaluatorDelegatorBase(
00073     const Teuchos::RefCountPtr<ModelEvaluator<Scalar> >   &model
00074     );
00075 
00077   ModelEvaluatorDelegatorBase(
00078     const Teuchos::RefCountPtr<const ModelEvaluator<Scalar> >   &model
00079     );
00080 
00082   void initialize(
00083     const Teuchos::RefCountPtr<ModelEvaluator<Scalar> >   &model
00084     );
00085 
00087   void initialize(
00088     const Teuchos::RefCountPtr<const ModelEvaluator<Scalar> >   &model
00089     );
00090 
00092   void uninitialize();
00093 
00095 
00098 
00100   virtual bool isUnderlyingModelConst() const;
00101 
00103   virtual Teuchos::RefCountPtr<ModelEvaluator<Scalar> > getNonconstUnderlyingModel();
00104 
00106   virtual Teuchos::RefCountPtr<const ModelEvaluator<Scalar> > getUnderlyingModel() const;
00107 
00109 
00112 
00114   int Np() const;
00116   int Ng() const;
00118   Teuchos::RefCountPtr<const VectorSpaceBase<Scalar> > get_x_space() const;
00120   Teuchos::RefCountPtr<const VectorSpaceBase<Scalar> > get_f_space() const;
00122   Teuchos::RefCountPtr<const VectorSpaceBase<Scalar> > get_p_space(int l) const;
00124   Teuchos::RefCountPtr<const VectorSpaceBase<Scalar> > get_g_space(int j) const;
00126   ModelEvaluatorBase::InArgs<Scalar> getNominalValues() const;
00128   ModelEvaluatorBase::InArgs<Scalar> getLowerBounds() const;
00130   ModelEvaluatorBase::InArgs<Scalar> getUpperBounds() const;
00132   Teuchos::RefCountPtr<LinearOpWithSolveBase<Scalar> > create_W() const;
00134   Teuchos::RefCountPtr<LinearOpBase<Scalar> > create_W_op() const;
00136   Teuchos::RefCountPtr<LinearOpBase<Scalar> > create_DfDp_op(int l) const;
00138   Teuchos::RefCountPtr<LinearOpBase<Scalar> > create_DgDx_op(int j) const;
00140   Teuchos::RefCountPtr<LinearOpBase<Scalar> > create_DgDp_op( int j, int l ) const;
00142   ModelEvaluatorBase::InArgs<Scalar> createInArgs() const;
00144   ModelEvaluatorBase::OutArgs<Scalar> createOutArgs() const;
00146   void reportFinalPoint(
00147     const ModelEvaluatorBase::InArgs<Scalar>      &finalPoint
00148     ,const bool                                   wasSolved
00149     );
00150 
00152 
00153 private:
00154 
00155   Teuchos::ConstNonconstObjectContainer<ModelEvaluator<Scalar> > model_;
00156   
00157 };
00158 
00159 // /////////////////////////////////
00160 // Implementations
00161 
00162 // Constructors/initializers
00163 
00164 template<class Scalar>
00165 ModelEvaluatorDelegatorBase<Scalar>::ModelEvaluatorDelegatorBase()
00166 {}
00167 
00168 template<class Scalar>
00169 ModelEvaluatorDelegatorBase<Scalar>::ModelEvaluatorDelegatorBase(
00170   const Teuchos::RefCountPtr<ModelEvaluator<Scalar> >   &model
00171   )
00172 {
00173   this->initialize(model);
00174 }
00175 
00176 template<class Scalar>
00177 ModelEvaluatorDelegatorBase<Scalar>::ModelEvaluatorDelegatorBase(
00178   const Teuchos::RefCountPtr<const ModelEvaluator<Scalar> >   &model
00179   )
00180 {
00181   this->initialize(model);
00182 }
00183 
00184 template<class Scalar>
00185 void ModelEvaluatorDelegatorBase<Scalar>::initialize(
00186   const Teuchos::RefCountPtr<ModelEvaluator<Scalar> >   &model
00187   )
00188 {
00189   model_.initialize(model);
00190 }
00191 
00192 template<class Scalar>
00193 void ModelEvaluatorDelegatorBase<Scalar>::initialize(
00194   const Teuchos::RefCountPtr<const ModelEvaluator<Scalar> >   &model
00195   )
00196 {
00197   model_.initialize(model);
00198 }
00199 
00200 template<class Scalar>
00201 void ModelEvaluatorDelegatorBase<Scalar>::uninitialize()
00202 {
00203   model_.uninitialize();
00204 }
00205 
00206 // Virtual functions that can overriden
00207 
00208 template<class Scalar>
00209 bool ModelEvaluatorDelegatorBase<Scalar>::isUnderlyingModelConst() const
00210 {
00211   return model_.isConst();
00212 }
00213 
00214 template<class Scalar>
00215 Teuchos::RefCountPtr<ModelEvaluator<Scalar> >
00216 ModelEvaluatorDelegatorBase<Scalar>::getNonconstUnderlyingModel()
00217 {
00218   return model_.getNonconstObj();
00219 }
00220 
00221 template<class Scalar>
00222 Teuchos::RefCountPtr<const ModelEvaluator<Scalar> >
00223 ModelEvaluatorDelegatorBase<Scalar>::getUnderlyingModel() const
00224 {
00225   return model_.getConstObj();
00226 }
00227 
00228 // Overridden from ModelEvaulator.
00229 
00230 template<class Scalar>
00231 int ModelEvaluatorDelegatorBase<Scalar>::Np() const
00232 {
00233   return getUnderlyingModel()->Np();
00234 }
00235 
00236 template<class Scalar>
00237 int ModelEvaluatorDelegatorBase<Scalar>::Ng() const
00238 {
00239   return getUnderlyingModel()->Ng();
00240 }
00241 
00242 template<class Scalar>
00243 Teuchos::RefCountPtr<const VectorSpaceBase<Scalar> >
00244 ModelEvaluatorDelegatorBase<Scalar>::get_x_space() const
00245 {
00246   return getUnderlyingModel()->get_x_space();
00247 }
00248 
00249 template<class Scalar>
00250 Teuchos::RefCountPtr<const VectorSpaceBase<Scalar> >
00251 ModelEvaluatorDelegatorBase<Scalar>::get_f_space() const
00252 {
00253   return getUnderlyingModel()->get_f_space();
00254 }
00255 
00256 template<class Scalar>
00257 Teuchos::RefCountPtr<const VectorSpaceBase<Scalar> >
00258 ModelEvaluatorDelegatorBase<Scalar>::get_p_space(int l) const
00259 {
00260   return getUnderlyingModel()->get_p_space(l);
00261 }
00262 
00263 template<class Scalar>
00264 Teuchos::RefCountPtr<const VectorSpaceBase<Scalar> >
00265 ModelEvaluatorDelegatorBase<Scalar>::get_g_space(int j) const
00266 {
00267   return getUnderlyingModel()->get_g_space(j);
00268 }
00269 
00270 template<class Scalar>
00271 ModelEvaluatorBase::InArgs<Scalar>
00272 ModelEvaluatorDelegatorBase<Scalar>::getNominalValues() const
00273 {
00274   return getUnderlyingModel()->getNominalValues();
00275 }
00276 
00277 template<class Scalar>
00278 ModelEvaluatorBase::InArgs<Scalar>
00279 ModelEvaluatorDelegatorBase<Scalar>::getLowerBounds() const
00280 {
00281   return getUnderlyingModel()->getLowerBounds();
00282 }
00283 
00284 template<class Scalar>
00285 ModelEvaluatorBase::InArgs<Scalar>
00286 ModelEvaluatorDelegatorBase<Scalar>::getUpperBounds() const
00287 {
00288   return getUnderlyingModel()->getUpperBounds();
00289 }
00290 
00291 template<class Scalar>
00292 Teuchos::RefCountPtr<LinearOpWithSolveBase<Scalar> >
00293 ModelEvaluatorDelegatorBase<Scalar>::create_W() const
00294 {
00295   return getUnderlyingModel()->create_W();
00296 }
00297 
00298 template<class Scalar>
00299 Teuchos::RefCountPtr<LinearOpBase<Scalar> >
00300 ModelEvaluatorDelegatorBase<Scalar>::create_W_op() const
00301 {
00302   return getUnderlyingModel()->create_W_op();
00303 }
00304 
00305 template<class Scalar>
00306 Teuchos::RefCountPtr<LinearOpBase<Scalar> >
00307 ModelEvaluatorDelegatorBase<Scalar>::create_DfDp_op(int l) const
00308 {
00309   return getUnderlyingModel()->create_DfDp_op(l);
00310 }
00311 
00312 template<class Scalar>
00313 Teuchos::RefCountPtr<LinearOpBase<Scalar> >
00314 ModelEvaluatorDelegatorBase<Scalar>::create_DgDx_op(int j) const
00315 {
00316   return getUnderlyingModel()->create_DgDx_op(j);
00317 }
00318 
00319 template<class Scalar>
00320 Teuchos::RefCountPtr<LinearOpBase<Scalar> >
00321 ModelEvaluatorDelegatorBase<Scalar>::create_DgDp_op( int j, int l ) const
00322 {
00323   return getUnderlyingModel()->create_DgDp_op(j,l);
00324 }
00325 
00326 template<class Scalar>
00327 ModelEvaluatorBase::InArgs<Scalar>
00328 ModelEvaluatorDelegatorBase<Scalar>::createInArgs() const
00329 {
00330   ModelEvaluatorBase::InArgsSetup<Scalar> inArgs = getUnderlyingModel()->createInArgs();
00331   inArgs.setModelEvalDescription(this->description());
00332   return inArgs;
00333 }
00334 
00335 template<class Scalar>
00336 ModelEvaluatorBase::OutArgs<Scalar>
00337 ModelEvaluatorDelegatorBase<Scalar>::createOutArgs() const
00338 {
00339   ModelEvaluatorBase::OutArgsSetup<Scalar> outArgs = getUnderlyingModel()->createOutArgs();
00340   outArgs.setModelEvalDescription(this->description());
00341   return outArgs;
00342 }
00343 
00344 template<class Scalar>
00345 void ModelEvaluatorDelegatorBase<Scalar>::reportFinalPoint(
00346   const ModelEvaluatorBase::InArgs<Scalar>      &finalPoint
00347   ,const bool                                   wasSolved
00348   )
00349 {
00350   getNonconstUnderlyingModel()->reportFinalPoint(finalPoint,wasSolved);
00351 }
00352 
00353 } // namespace Thyra
00354 
00355 #endif // THYRA_DEFAULT_MODEL_EVALUATOR_DELEGETOR_BASE_HPP

Generated on Thu Sep 18 12:33:03 2008 for Thyra Package Browser (Single Doxygen Collection) by doxygen 1.3.9.1