SundanceUserDefOpEvaluator.hpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 // ************************************************************************
00003 // 
00004 //                              Sundance
00005 //                 Copyright (2005) Sandia Corporation
00006 // 
00007 // Copyright (year first published) Sandia Corporation.  Under the terms 
00008 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government 
00009 // retains certain rights in this software.
00010 // 
00011 // This library is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Lesser General Public License as
00013 // published by the Free Software Foundation; either version 2.1 of the
00014 // License, or (at your option) any later version.
00015 //  
00016 // This library is distributed in the hope that it will be useful, but
00017 // WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 // Lesser General Public License for more details.
00020 //                                                                                 
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License along with this library; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 // USA                                                                                
00025 // Questions? Contact Kevin Long (krlong@sandia.gov), 
00026 // Sandia National Laboratories, Livermore, California, USA
00027 // 
00028 // ************************************************************************
00029 /* @HEADER@ */
00030 
00031 
00032 #ifndef SUNDANCE_USERDEFOPEVALUATOR_H
00033 #define SUNDANCE_USERDEFOPEVALUATOR_H
00034 
00035 #include "SundanceDefs.hpp"
00036 
00037 #include "SundanceUserDefFunctorElement.hpp"
00038 #include "SundanceUserDefOpCommonEvaluator.hpp"
00039 #include "SundanceChainRuleEvaluator.hpp"
00040 #include "Teuchos_TimeMonitor.hpp"
00041 
00042 namespace Sundance 
00043 {
00044 
00045 class UserDefOpElement;
00046 class SymbolicFuncElementEvaluator;
00047 class UserDefOpCommonEvaluator;
00048 /**
00049  *
00050  */
00051 class UserDefOpEvaluator : public ChainRuleEvaluator
00052 {
00053 public:
00054   /** */
00055   UserDefOpEvaluator(const UserDefOpElement* expr,
00056     const RCP<const UserDefOpCommonEvaluator>& commonEval,
00057     const EvalContext& context);
00058 
00059   /** */
00060   virtual ~UserDefOpEvaluator(){;}
00061 
00062 
00063   /** */
00064   virtual void 
00065   evalArgDerivs(const EvalManager& mgr,
00066     const Array<RCP<Array<double> > >& constArgRes,
00067     const Array<RCP<Array<RCP<EvalVector> > > >& vArgResults,
00068     Array<double>& constArgDerivs,
00069     Array<RCP<EvalVector> >& varArgDerivs) const ;
00070 
00071      
00072         
00073   /** */
00074   TEUCHOS_TIMER(evalTimer, "user defined nonlinear op evaluation");
00075 
00076   /** */
00077   void resetNumCalls() const ;
00078 
00079 protected:
00080 
00081   Array<int> findRequiredOrders(const ExprWithChildren* expr, 
00082     const EvalContext& context) ;
00083 
00084   const UserDefFunctorElement* functor() const {return functor_;}
00085 
00086   const UserDefOpCommonEvaluator* commonEval() const 
00087     {return commonEval_.get();}
00088 
00089   int myIndex() const {return functor_->myIndex();}
00090 
00091 private:
00092   Array<int> argValueIndex_;
00093   Array<int> argValueIsConstant_;
00094   const UserDefFunctorElement* functor_;
00095   RCP<const UserDefOpCommonEvaluator> commonEval_;
00096   int maxOrder_;
00097   int numVarArgDerivs_;
00098   int numConstArgDerivs_;
00099   bool allArgsAreConstant_;
00100 }; 
00101 }
00102 
00103 
00104 #endif

Site Contact