NLPInterfacePack_NLPDirectThyraModelEvaluator.hpp

00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
00005 //                  Copyright (2003) 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 Roscoe A. Bartlett (rabartl@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 
00029 #ifndef NLPIP_NLP_DIRECT_THYRA_MODEL_EVALUATOR_HPP
00030 #define NLPIP_NLP_DIRECT_THYRA_MODEL_EVALUATOR_HPP
00031 
00032 #include "NLPInterfacePack_NLPThyraModelEvaluatorBase.hpp"
00033 #include "NLPInterfacePack_NLPDirect.hpp"
00034 #include "Thyra_DirectionalFiniteDiffCalculator.hpp"
00035 #include "Teuchos_StandardCompositionMacros.hpp"
00036 #include "Teuchos_StandardMemberCompositionMacros.hpp"
00037 
00038 namespace NLPInterfacePack {
00039 
00045 class NLPDirectThyraModelEvaluator
00046   : virtual public NLPDirect
00047   , virtual public NLPThyraModelEvaluatorBase
00048 {
00049 public:
00050 
00052   STANDARD_COMPOSITION_MEMBERS( Thyra::DirectionalFiniteDiffCalculator<value_type>, objDirecFiniteDiffCalculator );
00053 
00055   STANDARD_COMPOSITION_MEMBERS( Thyra::DirectionalFiniteDiffCalculator<value_type>, conDirecFiniteDiffCalculator );
00056 
00058   STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, DfDp_is_const );
00059 
00061   NLPDirectThyraModelEvaluator();
00062 
00064   NLPDirectThyraModelEvaluator(
00065     const Teuchos::RCP<Thyra::ModelEvaluator<value_type> >  &model
00066     ,const int                                                      p_idx
00067     ,const int                                                      g_idx
00068     ,const objDirecFiniteDiffCalculator_ptr_t                       objDirecFiniteDiffCalculator = Teuchos::null
00069     ,const conDirecFiniteDiffCalculator_ptr_t                       conDirecFiniteDiffCalculator = Teuchos::null
00070     );
00071 
00077   void initialize(
00078     const Teuchos::RCP<Thyra::ModelEvaluator<value_type> >  &model
00079     ,const int                                                      p_idx
00080     ,const int                                                      g_idx
00081     ,const objDirecFiniteDiffCalculator_ptr_t                       objDirecFiniteDiffCalculator = Teuchos::null
00082     ,const conDirecFiniteDiffCalculator_ptr_t                       conDirecFiniteDiffCalculator = Teuchos::null
00083     );
00084 
00087 
00089   void initialize(bool test_setup);
00091   void unset_quantities();
00092 
00094 
00097 
00099   bool supports_Gf() const;
00101   bool supports_Gf_prod() const;
00103   value_type calc_Gf_prod(const Vector& x, const Vector& d, bool newx) const;
00104 
00106 
00109 
00111   Range1D var_dep() const;
00113   Range1D var_indep() const;
00115   const mat_fcty_ptr_t factory_D() const;
00117   const mat_sym_nonsing_fcty_ptr_t factory_S() const;
00119   void calc_point(
00120     const Vector     &x
00121     ,value_type      *f
00122     ,VectorMutable   *c
00123     ,bool            recalc_c
00124     ,VectorMutable   *Gf
00125     ,VectorMutable   *py
00126     ,VectorMutable   *rGf
00127     ,MatrixOp        *GcU
00128     ,MatrixOp        *D
00129     ,MatrixOp        *Uz
00130     ) const;
00132   void calc_semi_newton_step(
00133     const Vector    &x
00134     ,VectorMutable  *c
00135     ,bool           recalc_c
00136     ,VectorMutable  *py
00137     ) const;
00138 
00140 
00141 private:
00142 
00143   mutable Teuchos::RCP<Thyra::LinearOpWithSolveBase<value_type> >  thyra_C_;
00144   mutable Teuchos::RCP<Thyra::MultiVectorBase<value_type> >        thyra_N_;
00145   
00146 };  // end class NLPDirectThyraModelEvaluator
00147 
00148 } // end namespace NLPInterfacePack
00149 
00150 #endif  // NLPIP_NLP_DIRECT_THYRA_MODEL_EVALUATOR_HPP

Generated on Wed May 12 21:51:33 2010 for MOOCHO/Thyra Adapter Software by  doxygen 1.4.7