SundanceStdFwkEvalMediator.hpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 // ************************************************************************
00003 // 
00004 //                             Sundance
00005 //                 Copyright 2011 Sandia Corporation
00006 // 
00007 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00008 // the U.S. Government retains certain rights in this software.
00009 //
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Kevin Long (kevin.long@ttu.edu)
00038 // 
00039 
00040 /* @HEADER@ */
00041 
00042 #ifndef SUNDANCE_STDFWKEVALMEDIATOR_H
00043 #define SUNDANCE_STDFWKEVALMEDIATOR_H
00044 
00045 #include "SundanceDefs.hpp"
00046 #include "SundanceMesh.hpp"
00047 #include "SundanceAbstractEvalMediator.hpp"
00048 #include "SundanceCellJacobianBatch.hpp"
00049 #include "SundanceIntegralGroup.hpp"
00050 #include "SundanceObjectWithVerbosity.hpp"
00051 #include "SundanceDiscreteFunction.hpp"
00052 
00053 
00054 namespace Sundance
00055 {
00056 using namespace Teuchos;
00057 
00058 /** 
00059  * StdFwkEvalMediator evaluates mesh-dependent functions in the 
00060  * standard framework. A number of subtypes are supported: 
00061  * QuadratureEvalMediator, which does evaluation on quadrature points,  
00062  * and NodalEvalMediator, which does evaluation at nodal points.  */
00063 
00064 class StdFwkEvalMediator : public AbstractEvalMediator,
00065                            public Playa::Printable
00066 {
00067 public:
00068   /** */
00069   StdFwkEvalMediator(const Mesh& mesh, int cellDim);
00070 
00071   /** */
00072   virtual ~StdFwkEvalMediator(){;}
00073 
00074   /** */
00075   void setCellBatch(const RCP<const Array<int> >& cellLID);
00076 
00077   /** */
00078   void setIntegrationSpec(IntegrationCellSpecifier intCellSpec);
00079 
00080 
00081   /** Update the cell type */
00082   virtual void setCellType(const CellType& cellType,
00083     const CellType& maxCellType,
00084     bool isInternalBdry) ;
00085 
00086   /** Return the Jacobian to be used in computing the volume of cells
00087       being integrated. This will not necessarily be the same as the
00088       Jacobian used for transformations of vectors: when integrating
00089       derivatives over boundaries, the volume is the volume of the facet,
00090       while the transformations are computed on the maximal cofacets. */
00091   const CellJacobianBatch& JVol() const {return *JVol_;}
00092 
00093   /** Return the Jacobian to be used in derivative transformations. */
00094   const CellJacobianBatch& JTrans() const ;
00095 
00096   /** When evaluating derivatives on boundaries, we evaluate basis
00097       functions on the maximal cofacets of the boundary cells. This function
00098       returns the facet index, relative to the maximal cofacet, of each
00099       boundary cell in the batch.  */
00100   const Array<int>& facetIndices() const {return *facetIndices_;}
00101 
00102   /** */
00103   const Array<int>& maxCellLIDs() const {return *maxCellLIDs_;}
00104 
00105   /** */
00106   int cellDim() const {return cellDim_;}
00107 
00108   /** */
00109   int maxCellDim() const {return mesh_.spatialDim();}
00110 
00111   /** */
00112   const CellType& cellType() const {return cellType_;}
00113 
00114   /** */
00115   const CellType& maxCellType() const {return maxCellType_;}
00116 
00117   /** */
00118   const RCP<const Array<int> >& cellLID() const {return cellLID_;}
00119 
00120   /** */
00121   const RCP<Array<int> >& cofacetCellLID() const {return maxCellLIDs_;}
00122 
00123   /** */
00124   IntegrationCellSpecifier integrationCellSpec() const {return intCellSpec_;}
00125 
00126   /** */
00127   bool cofacetCellsAreReady() const {return cofacetCellsAreReady_;}
00128 
00129   /** */
00130   bool isInternalBdry() const {return isInternalBdry_;}
00131 
00132   /** */
00133   bool forbidCofacetIntegrations() const 
00134     {return forbidCofacetIntegrations_;}
00135 
00136 
00137 protected:
00138   const Mesh& mesh() const {return mesh_;}
00139 
00140   Mesh& mesh() {return mesh_;}
00141 
00142   bool& cacheIsValid() const {return cacheIsValid_;}
00143 
00144   /** */
00145   void setupFacetTransformations() const ;
00146 
00147   /** */
00148   Map<const DiscreteFunctionData*, RCP<Array<Array<double> > > >& fCache() const {return fCache_;}
00149   /** */
00150   Map<const DiscreteFunctionData*, RCP<Array<Array<double> > > >& dfCache() const {return dfCache_;}
00151   /** */
00152   Map<const DiscreteFunctionData*, RCP<Array<Array<double> > > >& localValueCache() const {return localValueCache_;}
00153 
00154   /** */
00155   Map<const DiscreteFunctionData*, RCP<const MapStructure> >& mapStructCache() const
00156     {return mapStructCache_;}
00157 
00158   /** */
00159   Map<const DiscreteFunctionData*, bool>& fCacheIsValid() const {return fCacheIsValid_;}
00160   /** */
00161   Map<const DiscreteFunctionData*, bool>& dfCacheIsValid() const {return dfCacheIsValid_;}
00162   /** */
00163   Map<const DiscreteFunctionData*, bool>& localValueCacheIsValid() const {return localValueCacheIsValid_;}
00164       
00165 private:
00166   Mesh mesh_;
00167 
00168   int cellDim_;
00169 
00170   CellType cellType_;
00171 
00172   CellType maxCellType_;
00173 
00174   bool isInternalBdry_;
00175 
00176   bool forbidCofacetIntegrations_;
00177 
00178   RCP<const Array<int> > cellLID_;
00179 
00180   mutable IntegrationCellSpecifier intCellSpec_;
00181 
00182   mutable RCP<CellJacobianBatch> JVol_;
00183 
00184   mutable RCP<CellJacobianBatch> JTrans_;
00185 
00186   mutable RCP<Array<int> > facetIndices_;
00187 
00188   mutable RCP<Array<int> > maxCellLIDs_;
00189 
00190   mutable bool cofacetCellsAreReady_;
00191 
00192   mutable bool cacheIsValid_;
00193 
00194   mutable bool jCacheIsValid_;
00195 
00196 
00197 
00198   /** */
00199   mutable Map<const DiscreteFunctionData*, RCP<Array<Array<double> > > > fCache_;
00200   /** */
00201   mutable Map<const DiscreteFunctionData*, RCP<Array<Array<double> > > > dfCache_; 
00202   /** */
00203   mutable Map<const DiscreteFunctionData*, RCP<Array<Array<double> > > > localValueCache_;
00204   /** */
00205   mutable Map<const DiscreteFunctionData*, RCP<const MapStructure> > mapStructCache_;
00206 
00207   /** */
00208   mutable Map<const DiscreteFunctionData*, bool> fCacheIsValid_;
00209   /** */
00210   mutable Map<const DiscreteFunctionData*, bool> dfCacheIsValid_;
00211   /** */
00212   mutable Map<const DiscreteFunctionData*, bool> localValueCacheIsValid_;
00213 
00214 };
00215 }
00216 
00217 
00218 #endif

Site Contact