SundanceQuadratureEvalMediator.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_QUADRATUREEVALMEDIATOR_H
00032 #define SUNDANCE_QUADRATUREEVALMEDIATOR_H
00033 
00034 #include "SundanceDefs.hpp"
00035 #include "SundanceMap.hpp"
00036 #include "SundanceStdFwkEvalMediator.hpp"
00037 #include "SundanceQuadratureFamily.hpp"
00038 #include "SundanceBasisFamily.hpp"
00039 #include "SundanceOrderedTuple.hpp"
00040 
00041 namespace Sundance
00042 {
00043 using namespace Teuchos;
00044 
00045 /**
00046  * 
00047  */
00048 class QuadratureEvalMediator : public StdFwkEvalMediator
00049 {
00050 public:
00051   /** 
00052    * 
00053    */
00054   QuadratureEvalMediator(const Mesh& mesh, 
00055     int cellDim,
00056     const QuadratureFamily& quad);
00057 
00058   /** */
00059   virtual ~QuadratureEvalMediator(){;}
00060 
00061       
00062   /** Evaluate the given coordinate expression, putting
00063    * its numerical values in the given EvalVector. */
00064   virtual void evalCoordExpr(const CoordExpr* expr,
00065     RCP<EvalVector>& vec) const ;
00066       
00067   /** Evaluate the given discrete function, putting
00068    * its numerical values in the given EvalVector. */
00069   virtual void evalDiscreteFuncElement(const DiscreteFuncElement* expr,
00070     const Array<MultiIndex>& mi,
00071     Array<RCP<EvalVector> >& vec) const ;
00072 
00073   /** Evaluate the given cell diameter expression, putting
00074    * its numerical values in the given EvalVector. */
00075   virtual void evalCellDiameterExpr(const CellDiameterExpr* expr,
00076     RCP<EvalVector>& vec) const ;
00077 
00078 
00079   /** Evaluate the given cell vector expression, putting
00080    * its numerical values in the given EvalVector. */
00081   virtual void evalCellVectorExpr(const CellVectorExpr* expr,
00082     RCP<EvalVector>& vec) const ;
00083             
00084   /** */
00085   virtual void setCellType(const CellType& cellType,
00086     const CellType& maxCellType,
00087     bool isInternalBdry) ;
00088 
00089   /** */
00090   virtual void print(std::ostream& os) const ;
00091 
00092 
00093   /** Print evaluation results */
00094   virtual void showResults(std::ostream& os,
00095          const RCP<SparsitySuperset>& sparsity,
00096          const Array<RCP<EvalVector> >& vecResults,
00097          const Array<double>& constantResults) const  ;
00098 
00099   /** */
00100   Array<Array<double> >* getRefBasisVals(const BasisFamily& basis, 
00101     int diffOrder) const ;
00102 
00103   /** */
00104   RCP<Array<Array<Array<double> > > > getFacetRefBasisVals(const BasisFamily& basis, int diffOrder) const ;
00105 
00106   /** */
00107   int numQuadPts(const CellType& cellType) const ;
00108 
00109   static double& totalFlops() {static double rtn = 0; return rtn;}
00110 
00111       
00112 
00113   static void addFlops(const double& flops) {totalFlops() += flops;}
00114 
00115   /**
00116    * Return the number of different cases for which reference
00117    * basis functions must be evaluated. If we're on maximal cells,
00118    * this will be one. If we're on lower-dimensional cells, this will
00119    * be equal to the number of cellDim-dimensional facets of the maximal
00120    * cells.
00121    */
00122   int numEvaluationCases() const {return numEvaluationCases_;}
00123 
00124 
00125   /** */
00126   static Time& coordEvaluationTimer() ;
00127 
00128 private:
00129 
00130 
00131   /** */
00132   void fillFunctionCache(const DiscreteFunctionData* f,
00133     const MultiIndex& mi) const ;
00134 
00135      
00136   /** */
00137   void computePhysQuadPts() const ;
00138 
00139   /** */
00140   int numEvaluationCases_;
00141 
00142   /** */
00143   QuadratureFamily quad_;
00144 
00145   /** */
00146   Map<CellType, int> numQuadPtsForCellType_;
00147 
00148   /** quadPtsForReferenceCell_ stores quadrature points using the 
00149    * cell's coordinate system, i.e., points on a line are
00150    * stored in 1D coordinates regardless of the dimension of the 
00151    * maximal cell. This tabulation of quad pts is used in push
00152    * forward operations because it saves some pointer chasing 
00153    * within the mesh's pushForward() function.  */
00154   Map<CellType, RCP<Array<Point> > > quadPtsForReferenceCell_;
00155 
00156   /** quadPtsReferredToMaxCell_ stores quadrature points using the maximal
00157    * cell's coordinate system, i.e., points on a line are stored in 2D
00158    * coordinates if the line is a facet of a triangle, and so on. These
00159    * quadrature points are used in basis function evaluations. */
00160   Map<CellType, RCP<Array<Array<Point> > > > quadPtsReferredToMaxCell_;
00161 
00162   /** */
00163   mutable Array<Point> physQuadPts_;
00164 
00165   /** */
00166   mutable Array<Map<OrderedPair<BasisFamily, CellType>, RCP<Array<Array<Array<double> > > > > > refFacetBasisVals_;
00167       
00168 };
00169 }
00170 
00171 
00172 #endif

Site Contact