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   Array<Array<double> >* getRefBasisVals(const BasisFamily& basis, 
00094     int diffOrder) const ;
00095 
00096   /** */
00097   RCP<Array<Array<Array<double> > > > getFacetRefBasisVals(const BasisFamily& basis, int diffOrder) const ;
00098 
00099   /** */
00100   int numQuadPts(const CellType& cellType) const ;
00101 
00102   static double& totalFlops() {static double rtn = 0; return rtn;}
00103 
00104       
00105 
00106   static void addFlops(const double& flops) {totalFlops() += flops;}
00107 
00108   /**
00109    * Return the number of different cases for which reference
00110    * basis functions must be evaluated. If we're on maximal cells,
00111    * this will be one. If we're on lower-dimensional cells, this will
00112    * be equal to the number of cellDim-dimensional facets of the maximal
00113    * cells.
00114    */
00115   int numEvaluationCases() const {return numEvaluationCases_;}
00116 
00117 
00118   /** */
00119   static Time& coordEvaluationTimer() ;
00120 
00121 private:
00122 
00123 
00124   /** */
00125   void fillFunctionCache(const DiscreteFunctionData* f,
00126     const MultiIndex& mi) const ;
00127 
00128      
00129   /** */
00130   void computePhysQuadPts() const ;
00131 
00132   /** */
00133   int numEvaluationCases_;
00134 
00135   /** */
00136   QuadratureFamily quad_;
00137 
00138   /** */
00139   Map<CellType, int> numQuadPtsForCellType_;
00140 
00141   /** quadPtsForReferenceCell_ stores quadrature points using the 
00142    * cell's coordinate system, i.e., points on a line are
00143    * stored in 1D coordinates regardless of the dimension of the 
00144    * maximal cell. This tabulation of quad pts is used in push
00145    * forward operations because it saves some pointer chasing 
00146    * within the mesh's pushForward() function.  */
00147   Map<CellType, RCP<Array<Point> > > quadPtsForReferenceCell_;
00148 
00149   /** quadPtsReferredToMaxCell_ stores quadrature points using the maximal
00150    * cell's coordinate system, i.e., points on a line are stored in 2D
00151    * coordinates if the line is a facet of a triangle, and so on. These
00152    * quadrature points are used in basis function evaluations. */
00153   Map<CellType, RCP<Array<Array<Point> > > > quadPtsReferredToMaxCell_;
00154 
00155   /** */
00156   mutable Array<Point> physQuadPts_;
00157 
00158   /** */
00159   mutable Array<Map<OrderedPair<BasisFamily, CellType>, RCP<Array<Array<Array<double> > > > > > refFacetBasisVals_;
00160       
00161 };
00162 }
00163 
00164 
00165 #endif

Site Contact