Thyra Version of the Day
Thyra_DiagonalQuadraticResponseOnlyModelEvaluator_decl.hpp
00001 /*
00002 // @HEADER
00003 // ***********************************************************************
00004 // 
00005 //    Thyra: Interfaces and Support for Abstract Numerical Algorithms
00006 //                 Copyright (2004) Sandia Corporation
00007 // 
00008 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00009 // license for use of this work by or on behalf of the U.S. Government.
00010 // 
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are
00013 // met:
00014 //
00015 // 1. Redistributions of source code must retain the above copyright
00016 // notice, this list of conditions and the following disclaimer.
00017 //
00018 // 2. Redistributions in binary form must reproduce the above copyright
00019 // notice, this list of conditions and the following disclaimer in the
00020 // documentation and/or other materials provided with the distribution.
00021 //
00022 // 3. Neither the name of the Corporation nor the names of the
00023 // contributors may be used to endorse or promote products derived from
00024 // this software without specific prior written permission.
00025 //
00026 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00027 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00029 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00030 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00031 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00032 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00033 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00034 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00035 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00036 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 //
00038 // Questions? Contact Roscoe A. Bartlett (bartlettra@ornl.gov) 
00039 // 
00040 // ***********************************************************************
00041 // @HEADER
00042 */
00043 
00044 #ifndef THYRA_DIAGONAL_QUADRATIC_RESPONSE_ONLY_MODEL_EVALUATOR_DECL_HPP
00045 #define THYRA_DIAGONAL_QUADRATIC_RESPONSE_ONLY_MODEL_EVALUATOR_DECL_HPP
00046 
00047 
00048 #include "Thyra_ResponseOnlyModelEvaluatorBase.hpp"
00049 #include "Teuchos_Comm.hpp"
00050 
00051 
00052 namespace Thyra {
00053 
00054 
00125 template<class Scalar>
00126 class DiagonalQuadraticResponseOnlyModelEvaluator
00127    : public ResponseOnlyModelEvaluatorBase<Scalar>
00128 {
00129 public:
00130 
00132 
00135 
00137   DiagonalQuadraticResponseOnlyModelEvaluator(
00138     const int localDim,
00139     const RCP<const Teuchos::Comm<Ordinal> > &comm = Teuchos::null
00140     );
00141 
00143   void setSolutionVector(const RCP<const VectorBase<Scalar> > &ps);
00144 
00146   const RCP<const VectorBase<Scalar> >
00147   getSolutionVector() const;
00148   
00150   void setDiagonalVector(const RCP<const VectorBase<Scalar> > &diag);
00151   
00157   void setDiagonalBarVector(const RCP<const VectorBase<Scalar> > &diag_bar);
00158 
00160   void setNonlinearTermFactor(const Scalar &nonlinearTermFactor);
00161 
00163   void setScalarOffset(const Scalar &g_offset);
00164 
00166 
00169 
00171   int Np() const;
00173   int Ng() const;
00175   RCP<const VectorSpaceBase<Scalar> > get_p_space(int l) const;
00177   RCP<const VectorSpaceBase<Scalar> > get_g_space(int j) const;
00179   ModelEvaluatorBase::InArgs<Scalar> createInArgs() const;
00180 
00182 
00183 private:
00184 
00187 
00189   ModelEvaluatorBase::OutArgs<Scalar> createOutArgsImpl() const;
00191   void evalModelImpl(
00192     const ModelEvaluatorBase::InArgs<Scalar>& inArgs,
00193     const ModelEvaluatorBase::OutArgs<Scalar>& outArgs
00194     ) const;
00195 
00197 
00198 private:
00199 
00200   // //////////////////////
00201   // Private data members
00202 
00203   int Np_;
00204   int Ng_;
00205   RCP<const Teuchos::Comm<Ordinal> > comm_;
00206   const int localDim_;
00207 
00208   RCP<const VectorSpaceBase<Scalar> > g_space_;
00209 
00210   // Declared non-const so we can change the space in place!
00211   RCP<VectorSpaceBase<Scalar> > p_space_;
00212 
00213   RCP<const VectorBase<Scalar> > ps_;
00214   RCP<const VectorBase<Scalar> > diag_;
00215   Scalar nonlinearTermFactor_;
00216   Scalar g_offset_;
00217 
00218   RCP<const VectorBase<Scalar> > diag_bar_;
00219   RCP<const VectorBase<Scalar> > s_bar_;
00220 
00221 };
00222 
00223 
00225 template<class Scalar>
00226 RCP<DiagonalQuadraticResponseOnlyModelEvaluator<Scalar> >
00227 diagonalQuadraticResponseOnlyModelEvaluator(
00228   const int localDim,
00229   const RCP<const Teuchos::Comm<Ordinal> > &comm = Teuchos::null
00230   )
00231 {
00232   using Teuchos::rcp;
00233   return rcp(new DiagonalQuadraticResponseOnlyModelEvaluator<Scalar>(localDim, comm));
00234 }
00235 
00236 
00237 } // namespace Thyra
00238 
00239 
00240 #endif // THYRA_DIAGONAL_QUADRATIC_RESPONSE_ONLY_MODEL_EVALUATOR_DECL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines