SundanceEvalManager.cpp
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 
00032 #include "SundanceEvalManager.hpp"
00033 #include "SundanceOut.hpp"
00034 #include "SundanceAbstractEvalMediator.hpp"
00035 #include "SundanceEvalVector.hpp"
00036 #include "SundanceCoordExpr.hpp"
00037 #include "SundanceCellDiameterExpr.hpp"
00038 #include "SundanceCurveNormExpr.hpp"
00039 #include "SundanceCellVectorExpr.hpp"
00040 #include "SundanceDiscreteFuncElement.hpp"
00041 #include "SundanceMultiIndex.hpp"
00042 
00043 
00044 
00045 using namespace Sundance;
00046 using namespace Teuchos;
00047 
00048 EvalManager::EvalManager()
00049   : verb_(0),
00050     region_(),
00051     mediator_()
00052 {}
00053 
00054 void EvalManager::setVerb(int verb)
00055 {
00056   verb_ = verb;
00057 //  if (mediator_.get()) mediator_->setVerb(verb);
00058 }
00059 
00060 void EvalManager::evalCoordExpr(const CoordExpr* expr,
00061                                 RCP<EvalVector>& result) const 
00062 {
00063 
00064   TimeMonitor timer(coordEvalTimer());
00065   TEUCHOS_TEST_FOR_EXCEPTION(mediator() == 0, std::logic_error,
00066                      "uninitialized mediator in "
00067                      "EvalManager::evalCoordExpr");
00068   mediator()->evalCoordExpr(expr, result);
00069 }
00070 
00071 
00072 void EvalManager::evalCellDiameterExpr(const CellDiameterExpr* expr,
00073                                 RCP<EvalVector>& result) const 
00074 {
00075   TEUCHOS_TEST_FOR_EXCEPTION(mediator() == 0, std::logic_error,
00076                      "uninitialized mediator in "
00077                      "EvalManager::evalCellDiameterExpr");
00078   mediator()->evalCellDiameterExpr(expr, result);
00079 }
00080 
00081 void EvalManager::evalCurveNormExpr(const CurveNormExpr* expr,
00082                                 RCP<EvalVector>& result) const
00083 {
00084   TEUCHOS_TEST_FOR_EXCEPTION(mediator() == 0, std::logic_error,
00085                      "uninitialized mediator in "
00086                      "EvalManager::evalCurveNormExpr");
00087   mediator()->evalCurveNormExpr(expr, result);
00088 }
00089 
00090 void EvalManager::evalCellVectorExpr(const CellVectorExpr* expr,
00091                                 RCP<EvalVector>& result) const 
00092 {
00093   TEUCHOS_TEST_FOR_EXCEPTION(mediator() == 0, std::logic_error,
00094                      "uninitialized mediator in "
00095                      "EvalManager::evalCellVectorExpr");
00096   mediator()->evalCellVectorExpr(expr, result);
00097 }
00098 
00099 
00100 void EvalManager::evalDiscreteFuncElement(const DiscreteFuncElement* expr,
00101                                           const Array<MultiIndex>& mi,
00102                                           Array<RCP<EvalVector> >& result) const 
00103 {
00104   TimeMonitor timer(discFuncEvalTimer());
00105 
00106   TEUCHOS_TEST_FOR_EXCEPTION(mediator() == 0, std::logic_error,
00107                      "uninitialized mediator in "
00108                      "EvalManager::evalDiscreteFuncElement");
00109 
00110   mediator()->evalDiscreteFuncElement(expr, mi, result);
00111 }
00112 
00113 void EvalManager::showResults(std::ostream& os,
00114             const RCP<SparsitySuperset>& sparsity,
00115             const Array<RCP<EvalVector> >& vecResults,
00116             const Array<double>& constantResults) const 
00117 {
00118   TEUCHOS_TEST_FOR_EXCEPTION(mediator() == 0, std::logic_error,
00119                      "uninitialized mediator in "
00120                      "EvalManager::showResults");
00121 
00122   mediator()->showResults(os, sparsity, vecResults, constantResults);
00123 }
00124 
00125 
00126 
00127 RCP<EvalVector> EvalManager::popVector() const
00128 {
00129   return stack().popVector();
00130 }
00131 
00132 TempStack& EvalManager::stack()
00133 {
00134   static TempStack rtn;
00135   return rtn;
00136 }

Site Contact