SundanceDiscreteFuncElement.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_DISCRETEFUNCELEMENT_H
00032 #define SUNDANCE_DISCRETEFUNCELEMENT_H
00033 
00034 
00035 #include "SundanceDefs.hpp"
00036 #include "SundanceFuncElementBase.hpp"
00037 #include "SundanceDiscreteFuncEvaluator.hpp"
00038 #include "SundanceDiscreteFuncDataStub.hpp"
00039 
00040 namespace Sundance
00041 {
00042 using namespace Sundance;
00043 
00044 
00045 using namespace Teuchos;
00046 
00047 
00048 
00049 
00050 /** 
00051  * DiscreteFuncElement represents a scalar-valued element
00052  * of a (possibly) vector-valued discrete function. 
00053  *
00054  * DiscreteFuncElement is framework-independent. Any framework-specific
00055  * information should go in a subclass of DiscreteFuncDataStub.
00056  * The DiscreteFuncDataStub object can be accessed through the
00057  * <tt>master()</tt> method of this class.
00058  */
00059 class DiscreteFuncElement : public virtual EvaluatableExpr,
00060                             public FuncElementBase,
00061                             public virtual GenericEvaluatorFactory<DiscreteFuncElement, DiscreteFuncElementEvaluator>
00062 {
00063 public:
00064   /** */
00065   DiscreteFuncElement(const RCP<DiscreteFuncDataStub>& data,
00066     const std::string& name,
00067     const std::string& suffix,
00068     const FunctionIdentifier& fid,
00069     int myIndexIntoVector);
00070 
00071   /** virtual destructor */
00072   virtual ~DiscreteFuncElement() {;}
00073 
00074 
00075   /** Get the data associated with the vector-valued function 
00076    * that contains this function element. */
00077   RCP<const DiscreteFuncDataStub> commonData() const {return commonData_;}
00078 
00079   /** Get the data associated with the vector-valued function 
00080    * that contains this function element. */
00081   DiscreteFuncDataStub* commonData() {return commonData_.get();}
00082 
00083   /** Get my index into the master's list of elements */
00084   int myIndex() const {return myIndex_;}
00085 
00086   /** Inform this function that it will need to be evaluated using the specified
00087    * multiIndex*/
00088   void addMultiIndex(const MultiIndex& newMi) const ;
00089 
00090   /**
00091    * Find the maximum differentiation order acting on discrete
00092    * functions in this expression. 
00093    */
00094   int maxDiffOrderOnDiscreteFunctions() const {return 0;}
00095       
00096   /**
00097    * Indicate whether this expression contains discrete functions.
00098    * This object is a discrete function, so return true.
00099    */
00100   virtual bool hasDiscreteFunctions() const {return true;}
00101       
00102   /**
00103    * Indicate whether this expression contains test functions.
00104    * This object is a discrete function, so return false.
00105    */
00106   virtual bool hasTestFunctions() const {return false;}
00107 
00108   /** */
00109   virtual Set<MultipleDeriv> 
00110   internalFindW(int order, const EvalContext& context) const ;
00111   /** */
00112   virtual Set<MultipleDeriv> 
00113   internalFindV(int order, const EvalContext& context) const ;
00114   /** */
00115   virtual Set<MultipleDeriv> 
00116   internalFindC(int order, const EvalContext& context) const ;
00117 
00118   /** */
00119   virtual RCP<Array<Set<MultipleDeriv> > > 
00120   internalDetermineR(const EvalContext& context,
00121     const Array<Set<MultipleDeriv> >& RInput) const ;
00122 
00123   /** */
00124   virtual XMLObject toXML() const ;
00125 
00126   /** */
00127   const Set<MultiIndex>& multiIndexSet() const {return miSet_;}
00128 
00129   /** */
00130   virtual RCP<ExprBase> getRcp() {return rcp(this);}
00131 
00132   /** */
00133   bool lessThan(const ScalarExpr* other) const ;
00134       
00135 private:
00136 
00137   RCP<DiscreteFuncDataStub> commonData_;
00138 
00139   mutable Set<MultiIndex> miSet_;
00140 
00141   int myIndex_;
00142       
00143 
00144 };
00145 }
00146 
00147 #endif

Site Contact