SundanceSymbolicFunc.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 #ifndef SUNDANCE_SYMBOLICFUNC_H
00032 #define SUNDANCE_SYMBOLICFUNC_H
00033 
00034 
00035 #include "SundanceDefs.hpp"
00036 #include "SundanceListExpr.hpp"
00037 #include "SundanceSymbolicFuncDescriptor.hpp"
00038 #include "SundanceFunctionWithID.hpp"
00039 #include "SundanceDiscreteFuncElement.hpp"
00040 #include "SundanceDiscreteFunctionStub.hpp"
00041 
00042 namespace Sundance
00043 {
00044 using namespace Sundance;
00045 using namespace Teuchos;
00046     
00047 
00048 /** 
00049  * SymbolicFunc is a base class for functions such as test and unknown
00050  * functions that are "variables" in a weak form. Symbolic functions
00051  * cannot be evaluated directly; before evaluating a weak form,
00052  a value must be substituted for 
00053  * each symbolic func using either the substituteZero() or
00054  * substituteFunction() method. 
00055  *
00056  * A symbolic function will construct itself as a list of
00057  * SymbolicFuncElement objects that point back to the SymbolicFunction.
00058  */
00059 class SymbolicFunc : public ListExpr, public SymbolicFuncDescriptor,
00060   public FunctionWithID
00061 {
00062 public:
00063   /** Ctor records common data but initializes list to empty */
00064   SymbolicFunc(const FunctionWithID& fid, 
00065     const RCP<const CommonFuncDataStub>& data);
00066 
00067   /** virtual destructor */
00068   virtual ~SymbolicFunc() {;}
00069 
00070   /** Specify that expressions involving this function are to be evaluated
00071    * with this function set to zero. This is appropriate for computing
00072    * the functional derivatives that arise in a linear problem */
00073   void substituteZero() const ;
00074 
00075   /** Specify that expressions involving this function are to be evaluated
00076    * with this function set to the discrete function \f$u_0\f$. 
00077    * This is appropriate for computing
00078    * the functional derivatives that arise in a nonlinear expression
00079    * being linearized about \f$u_0\f$. 
00080    */
00081   void substituteFunction(const RCP<DiscreteFunctionStub>& u0) const ;
00082 
00083   /** */
00084   const RCP<const CommonFuncDataStub>& commonData() const 
00085     {return commonData_;}
00086   
00087 
00088 private:
00089   RCP<const CommonFuncDataStub> commonData_;
00090 
00091 };
00092 }
00093 
00094 
00095 #endif

Site Contact