Thyra_StateFuncModelEvaluatorBase.hpp

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_STATE_FUNC_MODEL_EVALUATOR_BASE_HPP
00030 #define THYRA_STATE_FUNC_MODEL_EVALUATOR_BASE_HPP
00031 
00032 #include "Thyra_ModelEvaluatorDefaultBase.hpp"
00033 
00034 
00035 namespace Thyra {
00036 
00037 
00048 template<class Scalar>
00049 class StateFuncModelEvaluatorBase : virtual public ModelEvaluatorDefaultBase<Scalar> {
00050 public:
00051 
00054 
00056   RCP<const VectorSpaceBase<Scalar> > get_p_space(int l) const;
00058   RCP<const Teuchos::Array<std::string> > get_p_names(int l) const;
00060   RCP<const VectorSpaceBase<Scalar> > get_g_space(int j) const;
00062   ModelEvaluatorBase::InArgs<Scalar> getNominalValues() const;
00064   ModelEvaluatorBase::InArgs<Scalar> getLowerBounds() const;
00066   ModelEvaluatorBase::InArgs<Scalar> getUpperBounds() const;
00068   RCP<LinearOpBase<Scalar> > create_W_op() const;
00070   RCP<const LinearOpWithSolveFactoryBase<Scalar> > get_W_factory() const;
00072   void reportFinalPoint(
00073     const ModelEvaluatorBase::InArgs<Scalar> &finalPoint,
00074     const bool wasSolved
00075     );
00076 
00078   
00079 };
00080 
00081 
00082 // /////////////////////////////////
00083 // Implementations
00084 
00085 
00086 // Public functions overridden from ModelEvaulator
00087 
00088 
00089 template<class Scalar>
00090 RCP<const VectorSpaceBase<Scalar> >
00091 StateFuncModelEvaluatorBase<Scalar>::get_p_space(int l) const
00092 {
00093   TEST_FOR_EXCEPTION(
00094     true,std::logic_error
00095     ,"ModelEvaluator<"<<Teuchos::ScalarTraits<Scalar>::name()<<">::get_p_space(l): "
00096     "Error, this function was not overridden in *this = \'"<<this->description()<<"\'!"
00097     );
00098   return Teuchos::null; // Should never be called!
00099 }
00100 
00101 
00102 template<class Scalar>
00103 RCP<const Teuchos::Array<std::string> >
00104 StateFuncModelEvaluatorBase<Scalar>::get_p_names(int l) const
00105 {
00106   TEST_FOR_EXCEPTION(
00107     true,std::logic_error
00108     ,"ModelEvaluator<"<<Teuchos::ScalarTraits<Scalar>::name()<<">::get_p_names(l): "
00109     "Error, this function was not overridden in *this = \'"<<this->description()<<"\'!"
00110     );
00111   return Teuchos::null; // Should never be called!
00112 }
00113 
00114 
00115 template<class Scalar>
00116 RCP<const VectorSpaceBase<Scalar> >
00117 StateFuncModelEvaluatorBase<Scalar>::get_g_space(int j) const
00118 {
00119   TEST_FOR_EXCEPTION(
00120     true,std::logic_error
00121     ,"ModelEvaluator<"<<Teuchos::ScalarTraits<Scalar>::name()<<">::get_g_space(j): "
00122     " Error, this function was not overridden in \'"
00123     <<this->description()<<"\'!"
00124     );
00125   return Teuchos::null; // Should never be called!
00126 }
00127 
00128 
00129 template<class Scalar>
00130 ModelEvaluatorBase::InArgs<Scalar>
00131 StateFuncModelEvaluatorBase<Scalar>::getNominalValues() const
00132 { return this->createInArgs(); }
00133 
00134 
00135 template<class Scalar>
00136 ModelEvaluatorBase::InArgs<Scalar>
00137 StateFuncModelEvaluatorBase<Scalar>::getLowerBounds() const
00138 { return this->createInArgs(); }
00139 
00140 
00141 template<class Scalar>
00142 ModelEvaluatorBase::InArgs<Scalar>
00143 StateFuncModelEvaluatorBase<Scalar>::getUpperBounds() const
00144 { return this->createInArgs(); }
00145 
00146 
00147 template<class Scalar>
00148 RCP<LinearOpBase<Scalar> >
00149 StateFuncModelEvaluatorBase<Scalar>::create_W_op() const
00150 {
00151   TEST_FOR_EXCEPTION(
00152     true, std::logic_error
00153     ,"Error, if \'W\' is supported by the ModelEvaluator subclass then"
00154     " this function create_W_op() must be overridden by the subclass "
00155     <<this->description()<<" to return a non-null object!"
00156     );
00157   return Teuchos::null; // Should never be called!
00158 }
00159 
00160 
00161 template<class Scalar>
00162 RCP<const LinearOpWithSolveFactoryBase<Scalar> >
00163 StateFuncModelEvaluatorBase<Scalar>::get_W_factory() const
00164 {
00165   return Teuchos::null;
00166 }
00167 
00168 
00169 template<class Scalar>
00170 void StateFuncModelEvaluatorBase<Scalar>::reportFinalPoint(
00171   const ModelEvaluatorBase::InArgs<Scalar> &finalPoint,
00172   const bool wasSolved
00173   )
00174 {
00175   // This final point is just ignored by default!
00176 }
00177 
00178 
00179 } // namespace Thyra
00180 
00181 
00182 #endif // THYRA_STATE_FUNC_MODEL_EVALUATOR_BASE_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Wed Apr 13 10:00:25 2011 for Thyra by  doxygen 1.6.3