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 /** 00051 * Base class for evaluation mediator objects. 00052 * Evaluation mediators are responsible 00053 * for evaluating those expressions whose 00054 * calculation must be delegated to the framework. 00055 */ 00056 class AbstractEvalMediator 00057 { 00058 public: 00059 /** */ 00060 AbstractEvalMediator(int verb=0); 00061 00062 /** */ 00063 virtual ~AbstractEvalMediator(){;} 00064 00065 /** */ 00066 void setVerbosity(int verb, int dfVerb) const 00067 {verb_ = verb; dfVerb_=dfVerb;} 00068 00069 /** */ 00070 int verb() const {return verb_;} 00071 00072 /** */ 00073 int dfVerb() const {return dfVerb_;} 00074 00075 00076 00077 /** Evaluate the given coordinate expression, putting 00078 * its numerical values in the given EvalVector. */ 00079 virtual void evalCoordExpr(const CoordExpr* expr, 00080 RCP<EvalVector>& vec) const = 0 ; 00081 00082 /** Evaluate the given discrete function, putting 00083 * its numerical values in the given EvalVector. */ 00084 virtual void evalDiscreteFuncElement(const DiscreteFuncElement* expr, 00085 const Array<MultiIndex>& mi, 00086 Array<RCP<EvalVector> >& vec) const = 0 ; 00087 00088 /** Evaluate the given cell diameter expression, putting 00089 * its numerical values in the given EvalVector. */ 00090 virtual void evalCellDiameterExpr(const CellDiameterExpr* expr, 00091 RCP<EvalVector>& vec) const = 0 ; 00092 00093 /** Evaluates one component of the normal vector to a given parameterized curve 00094 * i.e. x,y or z component of that vector in 3D <br> 00095 * , this method is only in the CurveEvalMediator class implemented */ 00096 virtual void evalCurveNormExpr(const CurveNormExpr* expr, 00097 RCP<EvalVector>& vec) const 00098 { 00099 TEST_FOR_EXCEPTION( true , RuntimeError, 00100 " EvalMediator::evalCurveNormExpr , not possible with the current EvalMediator (only with CurveEvalMediator)"); 00101 } 00102 00103 /** Evaluate the given cell vector expression, putting 00104 * its numerical values in the given EvalVector. */ 00105 virtual void evalCellVectorExpr(const CellVectorExpr* expr, 00106 RCP<EvalVector>& vec) const = 0 ; 00107 private: 00108 mutable int verb_; 00109 mutable int dfVerb_; 00110 }; 00111 } 00112 00113 00114 #endif