SundanceParameter.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_PARAMETER_H
00032 #define SUNDANCE_PARAMETER_H
00033 
00034 
00035 #include "SundanceDefs.hpp"
00036 #include "SundanceDiscreteFuncElement.hpp"
00037 #include "SundanceSpatiallyConstantExpr.hpp"
00038 #include "SundanceSymbolicFuncDescriptor.hpp"
00039 #include "SundanceParameterData.hpp"
00040 
00041 
00042 namespace Sundance
00043 {
00044   using namespace Sundance;
00045   using namespace Teuchos;
00046 
00047   
00048   
00049 
00050   /** 
00051    * A Parameter is an expression subtype used to represent
00052    * a spatially-constant parameter that may change during the
00053    * course of a simulation, for example, the time in a transient
00054    * simulation or a continuation parameter when using a homotopy method.
00055    * While it is possible to use simple double-precision 
00056    * constants in expressions, their values are immutable once created.
00057    * When a constant's value may need to be changed, use a Parameter rather
00058    * than a simple double.
00059    */
00060   class Parameter : public virtual DiscreteFuncElement,
00061                     public SymbolicFuncDescriptor,
00062                     public virtual SpatiallyConstantExpr
00063   {
00064   public:
00065     /** */
00066     Parameter(const double& value, const std::string& name="");
00067 
00068     /** virtual destructor */
00069     virtual ~Parameter() {;}
00070 
00071     /** */
00072     virtual XMLObject toXML() const ;
00073 
00074     /** */
00075     virtual const double& value() const ;
00076     
00077     /** */
00078     virtual void setValue(const double& value) ;
00079 
00080     //@{
00081     /** \name Functions for internal use */
00082     /** */
00083     Set<MultipleDeriv> 
00084     internalFindW(int order, const EvalContext& context) const ;
00085           
00086     /** */
00087     Set<MultipleDeriv> 
00088     internalFindV(int order, const EvalContext& context) const ;
00089     
00090     /** */
00091     Set<MultipleDeriv> 
00092     internalFindC(int order, const EvalContext& context) const ;
00093 
00094     /** */
00095     RCP<Array<Set<MultipleDeriv> > > 
00096     internalDetermineR(const EvalContext& context,
00097                        const Array<Set<MultipleDeriv> >& RInput) const ;
00098 
00099 
00100     /** */
00101     virtual Evaluator* createEvaluator(const EvaluatableExpr* expr,
00102                                        const EvalContext& context) const ;
00103 
00104     /** */
00105     virtual RCP<ExprBase> getRcp() {return rcp(this);}
00106     //@}
00107 
00108     /** Write self in text form */
00109     virtual std::ostream& toText(std::ostream& os, bool paren) const 
00110     {os << "Parameter[" << name() << " = " << value() << "]"; return os;}
00111 
00112     /** */
00113     bool isParameter() const {return true;}
00114 
00115 
00116   protected:
00117     /** */
00118     const ParameterData* data() const ;
00119 
00120     /** */
00121     ParameterData* data();
00122 
00123 
00124   };
00125 }
00126 #endif

Site Contact