SundanceAbstractEvalMediator.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_EVALMEDIATOR_H
00032 #define SUNDANCE_EVALMEDIATOR_H
00033 
00034 
00035 #include "SundanceDefs.hpp"
00036 #include "SundanceEvalVector.hpp"
00037 #include "SundanceObjectWithVerbosity.hpp"
00038 
00039 namespace Sundance
00040 {
00041 
00042 using namespace Sundance;
00043 
00044 class CoordExpr;
00045 class CellDiameterExpr;
00046 class CurveNormExpr;
00047 class CellVectorExpr;
00048 class MultiIndex; 
00049 class DiscreteFuncElement;
00050 class SparsitySuperset;
00051 
00052 /**
00053  * Base class for evaluation mediator objects. 
00054  * Evaluation mediators are responsible
00055  * for evaluating those expressions whose
00056  * calculation must be delegated to the framework.
00057  */
00058 class AbstractEvalMediator 
00059 {
00060 public:
00061   /** */
00062   AbstractEvalMediator(int verb=0);
00063 
00064   /** */
00065   virtual ~AbstractEvalMediator(){;}
00066 
00067   /** */
00068   void setVerb(int verb, int dfVerb) const 
00069     {verb_ = verb; dfVerb_=dfVerb;}
00070 
00071   /** */
00072   int verb() const {return verb_;}
00073 
00074   /** */
00075   int dfVerb() const {return dfVerb_;}
00076 
00077           
00078 
00079   /** Evaluate the given coordinate expression, putting
00080    * its numerical values in the given EvalVector. */
00081   virtual void evalCoordExpr(const CoordExpr* expr,
00082     RCP<EvalVector>& vec) const = 0 ;
00083 
00084   /** Evaluate the given discrete function, putting
00085    * its numerical values in the given EvalVector. */
00086   virtual void evalDiscreteFuncElement(const DiscreteFuncElement* expr,
00087     const Array<MultiIndex>& mi,
00088     Array<RCP<EvalVector> >& vec) const = 0 ;
00089 
00090   /** Evaluate the given cell diameter expression, putting
00091    * its numerical values in the given EvalVector. */
00092   virtual void evalCellDiameterExpr(const CellDiameterExpr* expr,
00093     RCP<EvalVector>& vec) const = 0 ;
00094 
00095   /** Evaluates one component of the normal vector to a given parameterized curve
00096    * i.e. x,y or z component of that vector in 3D <br>
00097    * , this method is only in the CurveEvalMediator class implemented */
00098   virtual void evalCurveNormExpr(const CurveNormExpr* expr,
00099     RCP<EvalVector>& vec) const
00100     {
00101     TEUCHOS_TEST_FOR_EXCEPTION( true , std::runtime_error,
00102     " EvalMediator::evalCurveNormExpr , not possible with the current EvalMediator (only with CurveEvalMediator)");
00103     }
00104 
00105   /** Evaluate the given cell vector expression, putting
00106    * its numerical values in the given EvalVector. */
00107   virtual void evalCellVectorExpr(const CellVectorExpr* expr,
00108     RCP<EvalVector>& vec) const = 0 ;
00109 
00110 
00111   /** Print evaluation results */
00112   virtual void showResults(std::ostream& os,
00113          const RCP<SparsitySuperset>& sparsity,
00114          const Array<RCP<EvalVector> >& vecResults,
00115          const Array<double>& constantResults) const  ;
00116 private:
00117   mutable int verb_;
00118   mutable int dfVerb_;
00119 };
00120 }
00121 
00122 
00123 #endif

Site Contact