NLPInterfacePack_NLPFirstOrder.cpp

Go to the documentation of this file.
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 #include "NLPInterfacePack_NLPFirstOrder.hpp"
00030 #include "AbstractLinAlgPack_MatrixOp.hpp"
00031 #include "Teuchos_TestForException.hpp"
00032 
00033 namespace {
00034   const char name_Gc[] = "Gc";
00035 } // end namespace
00036 
00037 namespace NLPInterfacePack {
00038 
00039 // constructors
00040 
00041 NLPFirstOrder::NLPFirstOrder()
00042   : Gc_(NULL)
00043 {}
00044 
00045 void NLPFirstOrder::initialize(bool test_setup) {
00046   num_Gc_evals_ = 0;
00047   NLPObjGrad::initialize(test_setup);
00048 }
00049 
00050 // BasisSystem
00051 
00052 const NLPFirstOrder::basis_sys_ptr_t
00053 NLPFirstOrder::basis_sys() const
00054 {
00055   return Teuchos::null;
00056 }
00057 
00058 // <<std aggr>> members for Gc
00059 
00060 void NLPFirstOrder::set_Gc(MatrixOp* Gc)
00061 {
00062 #ifdef TEUCHOS_DEBUG
00063   TEST_FOR_EXCEPTION( this->m() == 0, std::logic_error, "" );
00064 #endif
00065   Gc_ = Gc;
00066 }
00067 
00068 MatrixOp* NLPFirstOrder::get_Gc()
00069 {
00070 #ifdef TEUCHOS_DEBUG
00071   TEST_FOR_EXCEPTION( this->m() == 0, std::logic_error, "" );
00072 #endif
00073   return StandardCompositionRelationshipsPack::get_role_name(Gc_, false, name_Gc);
00074 }
00075 
00076 MatrixOp& NLPFirstOrder::Gc()
00077 {
00078 #ifdef TEUCHOS_DEBUG
00079   TEST_FOR_EXCEPTION( this->m() == 0, std::logic_error, "" );
00080 #endif
00081   return StandardCompositionRelationshipsPack::role_name(Gc_, false, name_Gc);
00082 }
00083 
00084 const MatrixOp& NLPFirstOrder::Gc() const
00085 {
00086 #ifdef TEUCHOS_DEBUG
00087   TEST_FOR_EXCEPTION( this->m() == 0, std::logic_error, "" );
00088 #endif
00089   return StandardCompositionRelationshipsPack::role_name(Gc_, false, name_Gc);
00090 }
00091 
00092 void NLPFirstOrder::unset_quantities()
00093 {
00094   NLPObjGrad::unset_quantities();
00095   Gc_ = NULL;
00096 }
00097 
00098 // calculations
00099 
00100 void NLPFirstOrder::calc_Gc(const Vector& x, bool newx) const
00101 {
00102 #ifdef TEUCHOS_DEBUG
00103   TEST_FOR_EXCEPTION( this->m() == 0, std::logic_error, "" );
00104 #endif
00105   StandardCompositionRelationshipsPack::assert_role_name_set(Gc_, "NLP::calc_Gc()", name_Gc);
00106   imp_calc_Gc(x,newx,first_order_info());
00107   num_Gc_evals_++;
00108 }
00109 
00110 size_type NLPFirstOrder::num_Gc_evals() const
00111 {
00112 #ifdef TEUCHOS_DEBUG
00113   TEST_FOR_EXCEPTION( this->m() == 0, std::logic_error, "" );
00114 #endif
00115   return num_Gc_evals_;
00116 }
00117 
00118 } // end namespace NLPInterfacePack 

Generated on Thu Sep 18 12:35:19 2008 for MOOCHO (Single Doxygen Collection) by doxygen 1.3.9.1