SundanceStdFwkEvalMediator.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_STDFWKEVALMEDIATOR_H
00032 #define SUNDANCE_STDFWKEVALMEDIATOR_H
00033 
00034 #include "SundanceDefs.hpp"
00035 #include "SundanceMesh.hpp"
00036 #include "SundanceAbstractEvalMediator.hpp"
00037 #include "SundanceCellJacobianBatch.hpp"
00038 #include "SundanceIntegralGroup.hpp"
00039 #include "SundanceObjectWithVerbosity.hpp"
00040 #include "SundanceDiscreteFunction.hpp"
00041 
00042 
00043 namespace Sundance
00044 {
00045 using namespace Teuchos;
00046 
00047 /** 
00048  * StdFwkEvalMediator evaluates mesh-dependent functions in the 
00049  * standard framework. A number of subtypes are supported: 
00050  * QuadratureEvalMediator, which does evaluation on quadrature points,  
00051  * and NodalEvalMediator, which does evaluation at nodal points.  */
00052 
00053 class StdFwkEvalMediator : public AbstractEvalMediator,
00054                            public Playa::Printable
00055 {
00056 public:
00057   /** */
00058   StdFwkEvalMediator(const Mesh& mesh, int cellDim);
00059 
00060   /** */
00061   virtual ~StdFwkEvalMediator(){;}
00062 
00063   /** */
00064   void setCellBatch(const RCP<const Array<int> >& cellLID);
00065 
00066   /** */
00067   void setIntegrationSpec(IntegrationCellSpecifier intCellSpec);
00068 
00069 
00070   /** Update the cell type */
00071   virtual void setCellType(const CellType& cellType,
00072     const CellType& maxCellType,
00073     bool isInternalBdry) ;
00074 
00075   /** Return the Jacobian to be used in computing the volume of cells
00076       being integrated. This will not necessarily be the same as the
00077       Jacobian used for transformations of vectors: when integrating
00078       derivatives over boundaries, the volume is the volume of the facet,
00079       while the transformations are computed on the maximal cofacets. */
00080   const CellJacobianBatch& JVol() const {return *JVol_;}
00081 
00082   /** Return the Jacobian to be used in derivative transformations. */
00083   const CellJacobianBatch& JTrans() const ;
00084 
00085   /** When evaluating derivatives on boundaries, we evaluate basis
00086       functions on the maximal cofacets of the boundary cells. This function
00087       returns the facet index, relative to the maximal cofacet, of each
00088       boundary cell in the batch.  */
00089   const Array<int>& facetIndices() const {return *facetIndices_;}
00090 
00091   /** */
00092   const Array<int>& maxCellLIDs() const {return *maxCellLIDs_;}
00093 
00094   /** */
00095   int cellDim() const {return cellDim_;}
00096 
00097   /** */
00098   int maxCellDim() const {return mesh_.spatialDim();}
00099 
00100   /** */
00101   const CellType& cellType() const {return cellType_;}
00102 
00103   /** */
00104   const CellType& maxCellType() const {return maxCellType_;}
00105 
00106   /** */
00107   const RCP<const Array<int> >& cellLID() const {return cellLID_;}
00108 
00109   /** */
00110   const RCP<Array<int> >& cofacetCellLID() const {return maxCellLIDs_;}
00111 
00112   /** */
00113   IntegrationCellSpecifier integrationCellSpec() const {return intCellSpec_;}
00114 
00115   /** */
00116   bool cofacetCellsAreReady() const {return cofacetCellsAreReady_;}
00117 
00118   /** */
00119   bool isInternalBdry() const {return isInternalBdry_;}
00120 
00121   /** */
00122   bool forbidCofacetIntegrations() const 
00123     {return forbidCofacetIntegrations_;}
00124 
00125 
00126 protected:
00127   const Mesh& mesh() const {return mesh_;}
00128 
00129   Mesh& mesh() {return mesh_;}
00130 
00131   bool& cacheIsValid() const {return cacheIsValid_;}
00132 
00133   /** */
00134   void setupFacetTransformations() const ;
00135 
00136   /** */
00137   Map<const DiscreteFunctionData*, RCP<Array<Array<double> > > >& fCache() const {return fCache_;}
00138   /** */
00139   Map<const DiscreteFunctionData*, RCP<Array<Array<double> > > >& dfCache() const {return dfCache_;}
00140   /** */
00141   Map<const DiscreteFunctionData*, RCP<Array<Array<double> > > >& localValueCache() const {return localValueCache_;}
00142 
00143   /** */
00144   Map<const DiscreteFunctionData*, RCP<const MapStructure> >& mapStructCache() const
00145     {return mapStructCache_;}
00146 
00147   /** */
00148   Map<const DiscreteFunctionData*, bool>& fCacheIsValid() const {return fCacheIsValid_;}
00149   /** */
00150   Map<const DiscreteFunctionData*, bool>& dfCacheIsValid() const {return dfCacheIsValid_;}
00151   /** */
00152   Map<const DiscreteFunctionData*, bool>& localValueCacheIsValid() const {return localValueCacheIsValid_;}
00153       
00154 private:
00155   Mesh mesh_;
00156 
00157   int cellDim_;
00158 
00159   CellType cellType_;
00160 
00161   CellType maxCellType_;
00162 
00163   bool isInternalBdry_;
00164 
00165   bool forbidCofacetIntegrations_;
00166 
00167   RCP<const Array<int> > cellLID_;
00168 
00169   mutable IntegrationCellSpecifier intCellSpec_;
00170 
00171   mutable RCP<CellJacobianBatch> JVol_;
00172 
00173   mutable RCP<CellJacobianBatch> JTrans_;
00174 
00175   mutable RCP<Array<int> > facetIndices_;
00176 
00177   mutable RCP<Array<int> > maxCellLIDs_;
00178 
00179   mutable bool cofacetCellsAreReady_;
00180 
00181   mutable bool cacheIsValid_;
00182 
00183   mutable bool jCacheIsValid_;
00184 
00185 
00186 
00187   /** */
00188   mutable Map<const DiscreteFunctionData*, RCP<Array<Array<double> > > > fCache_;
00189   /** */
00190   mutable Map<const DiscreteFunctionData*, RCP<Array<Array<double> > > > dfCache_; 
00191   /** */
00192   mutable Map<const DiscreteFunctionData*, RCP<Array<Array<double> > > > localValueCache_;
00193   /** */
00194   mutable Map<const DiscreteFunctionData*, RCP<const MapStructure> > mapStructCache_;
00195 
00196   /** */
00197   mutable Map<const DiscreteFunctionData*, bool> fCacheIsValid_;
00198   /** */
00199   mutable Map<const DiscreteFunctionData*, bool> dfCacheIsValid_;
00200   /** */
00201   mutable Map<const DiscreteFunctionData*, bool> localValueCacheIsValid_;
00202 
00203 };
00204 }
00205 
00206 
00207 #endif

Site Contact