|
Thyra Package Browser (Single Doxygen Collection) Version of the Day
|
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_RESPONSE_ONLY_MODEL_EVALUATOR_BASE_HPP 00030 #define THYRA_RESPONSE_ONLY_MODEL_EVALUATOR_BASE_HPP 00031 00032 00033 #include "Thyra_ModelEvaluatorDefaultBase.hpp" 00034 #include "Teuchos_Assert.hpp" 00035 00036 00037 namespace Thyra { 00038 00039 00050 template<class Scalar> 00051 class ResponseOnlyModelEvaluatorBase : virtual public ModelEvaluatorDefaultBase<Scalar> { 00052 public: 00053 00056 00058 RCP<const VectorSpaceBase<Scalar> > get_x_space() const; 00060 RCP<const Teuchos::Array<std::string> > get_p_names(int l) const; 00062 RCP<const VectorSpaceBase<Scalar> > get_f_space() const; 00064 ModelEvaluatorBase::InArgs<Scalar> getNominalValues() const; 00066 ModelEvaluatorBase::InArgs<Scalar> getLowerBounds() const; 00068 ModelEvaluatorBase::InArgs<Scalar> getUpperBounds() const; 00070 RCP<LinearOpWithSolveBase<Scalar> > create_W() const; 00072 RCP<LinearOpBase<Scalar> > create_W_op() const; 00074 RCP<const LinearOpWithSolveFactoryBase<Scalar> > get_W_factory() const; 00076 void reportFinalPoint( 00077 const ModelEvaluatorBase::InArgs<Scalar> &finalPoint, 00078 const bool wasSolved 00079 ); 00080 00082 00083 }; 00084 00085 00086 // ///////////////////////////////// 00087 // Implementations 00088 00089 00090 // Public functions overridden from ModelEvaulator 00091 00092 00093 template<class Scalar> 00094 RCP<const VectorSpaceBase<Scalar> > 00095 ResponseOnlyModelEvaluatorBase<Scalar>::get_x_space() const 00096 { 00097 return Teuchos::null; 00098 } 00099 00100 00101 template<class Scalar> 00102 RCP<const Teuchos::Array<std::string> > 00103 ResponseOnlyModelEvaluatorBase<Scalar>::get_p_names(int l) const 00104 { 00105 #ifdef TEUCHOS_DEBUG 00106 TEUCHOS_ASSERT_IN_RANGE_UPPER_EXCLUSIVE( l, 0, this->Np() ); 00107 #endif 00108 return Teuchos::null; 00109 } 00110 00111 template<class Scalar> 00112 RCP<const VectorSpaceBase<Scalar> > 00113 ResponseOnlyModelEvaluatorBase<Scalar>::get_f_space() const 00114 { 00115 return Teuchos::null; 00116 } 00117 00118 00119 template<class Scalar> 00120 ModelEvaluatorBase::InArgs<Scalar> 00121 ResponseOnlyModelEvaluatorBase<Scalar>::getNominalValues() const 00122 { return this->createInArgs(); } 00123 00124 00125 template<class Scalar> 00126 ModelEvaluatorBase::InArgs<Scalar> 00127 ResponseOnlyModelEvaluatorBase<Scalar>::getLowerBounds() const 00128 { return this->createInArgs(); } 00129 00130 00131 template<class Scalar> 00132 ModelEvaluatorBase::InArgs<Scalar> 00133 ResponseOnlyModelEvaluatorBase<Scalar>::getUpperBounds() const 00134 { return this->createInArgs(); } 00135 00136 00137 template<class Scalar> 00138 RCP<LinearOpWithSolveBase<Scalar> > 00139 ResponseOnlyModelEvaluatorBase<Scalar>::create_W() const 00140 { 00141 TEST_FOR_EXCEPTION( 00142 true, std::logic_error 00143 ,"Error, if \'W\' is supported by the ModelEvaluator subclass then" 00144 " this function create_W() must be overridden by the subclass to return" 00145 " a non-null object!" 00146 ); 00147 return Teuchos::null; // Should never be called! 00148 } 00149 00150 00151 template<class Scalar> 00152 RCP<LinearOpBase<Scalar> > 00153 ResponseOnlyModelEvaluatorBase<Scalar>::create_W_op() const 00154 { 00155 TEST_FOR_EXCEPTION( 00156 true, std::logic_error 00157 ,"Error, if \'W\' is supported by the ModelEvaluator subclass then" 00158 " this function create_W_op() must be overridden by the subclass " 00159 <<this->description()<<" to return a non-null object!" 00160 ); 00161 return Teuchos::null; // Should never be called! 00162 } 00163 00164 00165 template<class Scalar> 00166 RCP<const LinearOpWithSolveFactoryBase<Scalar> > 00167 ResponseOnlyModelEvaluatorBase<Scalar>::get_W_factory() const 00168 { 00169 TEST_FOR_EXCEPTION( 00170 true, std::logic_error 00171 ,"Error, if \'W\' is supported by the ModelEvaluator subclass then" 00172 " this function get_W_factory() must be overridden by the subclass " 00173 <<this->description()<<" to return a non-null object!" 00174 ); 00175 return Teuchos::null; // Should never be called! 00176 } 00177 00178 00179 template<class Scalar> 00180 void ResponseOnlyModelEvaluatorBase<Scalar>::reportFinalPoint( 00181 const ModelEvaluatorBase::InArgs<Scalar> &finalPoint, 00182 const bool wasSolved 00183 ) 00184 { 00185 // This final point is just ignored by default! 00186 } 00187 00188 00189 } // namespace Thyra 00190 00191 00192 #endif // THYRA_RESPONSE_ONLY_MODEL_EVALUATOR_BASE_HPP
1.7.4