SundanceIntegralGroup.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_INTEGRALGROUP_H
00032 #define SUNDANCE_INTEGRALGROUP_H
00033 
00034 #include "SundanceDefs.hpp"
00035 #include "SundanceElementIntegral.hpp"
00036 #include "SundanceEvalVector.hpp"
00037 #include "SundanceMultipleDeriv.hpp"
00038 #include "SundanceIntegrationCellSpecifier.hpp"
00039 
00040 
00041 
00042 namespace Sundance
00043 {
00044 using namespace Teuchos;
00045 /** 
00046  * IntegralGroup collects together several integrals having common properties that
00047  * can be used either to eliminate redundant computations or to share storage
00048  * an eliminate repeated allocations. 
00049  *
00050  * The integrations are done using calls to methods of the ElementIntegral class. Which
00051  * subtype of ElementIntegral is used (e.g., RefIntegral, QuadratureIntegral) controls
00052  * how the integrations are actually done. Reference integration does the integral exactly
00053  * on a reference element, then transforms to a physical cell. This is only possible
00054  * with constant coefficients on an affine cell. Quadrature integration proceeds
00055  * by quadrature (duh!), and is needed for variable coefficients or non-affine cells. 
00056  */
00057 class IntegralGroup 
00058 {
00059 public:
00060   /** */
00061   IntegralGroup(const Array<RCP<ElementIntegral> >& integrals,
00062     const Array<int>& resultIndices,
00063     int verb);
00064 
00065   /** */
00066   IntegralGroup(const Array<int>& testID,
00067     const Array<int>& testBlock,
00068     const Array<int>& mvIndices,
00069     const Array<RCP<ElementIntegral> >& integrals,
00070     const Array<int>& resultIndices,
00071     const Array<MultipleDeriv>& derivs,
00072     int verb);
00073 
00074   /** */
00075   IntegralGroup(const Array<int>& testID,
00076     const Array<int>& testBlock,
00077     const Array<int>& unkID,
00078     const Array<int>& unkBlock,
00079     const Array<RCP<ElementIntegral> >& integrals,
00080     const Array<int>& resultIndices,
00081     const Array<MultipleDeriv>& derivs,
00082     int verb);
00083 
00084 
00085   /** Indicate whether this is a group of two-forms */
00086   bool isTwoForm() const {return order_==2;}
00087 
00088   /** Indicate whether this is a group of one-forms */
00089   bool isOneForm() const {return order_==1;}
00090 
00091   /** Indicate whether this is a group of zero-forms */
00092   bool isZeroForm() const {return order_==0;}
00093 
00094   /** Return the number of rows in the local matrices or vectors
00095    * computed by this integral group */
00096   int nTestNodes() const {return nTestNodes_;}
00097 
00098   /** Return the number of columns in the local matrices 
00099    * computed by this integral group */
00100   int nUnkNodes() const {return nUnkNodes_;}
00101 
00102   /** Return the test functions using this integral group */
00103   const Array<int>& testID() const {return testID_;}
00104 
00105   /** Return the unknown functions using this integral group */
00106   const Array<int>& unkID() const {return unkID_;}
00107 
00108   /** Return the block numbers for the test functions */
00109   const Array<int>& testBlock() const {return testBlock_;}
00110 
00111   /** Return the block numbers for the unk functions */
00112   const Array<int>& unkBlock() const {return unkBlock_;}
00113 
00114   /** Return the multivector column indices for the one-forms */
00115   const Array<int>& mvIndices() const {return mvIndices_;}
00116   
00117 
00118   /** Whether the group requires transformations based on a maximal cofacet */
00119   IntegrationCellSpecifier usesMaximalCofacets() const 
00120     {return requiresMaximalCofacet_;}
00121 
00122   /** Array specifying which terms need maximal cofacets */
00123   const Array<int>& termUsesMaximalCofacets() const
00124     {return termUsesMaximalCofacets_;}
00125 
00126   /** \brief Extract basis used for test functions in this integral group */
00127   const BasisFamily & getTestBasis() const { return integrals_[0]->getTestBasis(); }
00128     
00129   /** \brief Extract basis used for unknown functions in this integral group */
00130   const BasisFamily & getUnknownBasis() const { return integrals_[0]->getUnknownBasis(); }
00131 
00132   /** Evaluate this integral group */
00133   bool evaluate(const CellJacobianBatch& JTrans,
00134     const CellJacobianBatch& JVol,
00135     const Array<int>& isLocalFlag,
00136     const Array<int>& facetNum, 
00137     const RCP<Array<int> >& cellLIDs,
00138     const Array<RCP<EvalVector> >& vectorCoeffs,
00139     const Array<double>& constantCoeffs,
00140     RCP<Array<double> >& A) const ;
00141 
00142 
00143   /** */
00144   int integrationVerb() const {return integrationVerb_;}
00145     
00146   /** */
00147   int transformVerb() const {return transformVerb_;}
00148 
00149   /** */
00150   const Array<MultipleDeriv>& derivs() const 
00151     {return derivs_;}
00152 
00153 
00154 
00155 private:
00156   /** */
00157   int findIntegrationVerb(const Array<RCP<ElementIntegral> >& integrals) const ;
00158   /** */
00159   int findTransformVerb(const Array<RCP<ElementIntegral> >& integrals) const ;
00160   /** */
00161   int integrationVerb_;
00162 
00163   /** */
00164   int transformVerb_;
00165       
00166   /** */
00167   int order_;
00168 
00169   /** */
00170   int nTestNodes_;
00171 
00172   /** */
00173   int nUnkNodes_;
00174 
00175   /** */
00176   Array<int> testID_;
00177 
00178   /** */
00179   Array<int> unkID_;
00180 
00181   /** */
00182   Array<int> testBlock_;
00183 
00184   /** */
00185   Array<int> unkBlock_;
00186 
00187   /** */
00188   Array<int> mvIndices_;
00189 
00190   /** */
00191   Array<RCP<ElementIntegral> > integrals_;
00192 
00193   /** */
00194   Array<int> resultIndices_;
00195 
00196   /** */
00197   Array<int> termUsesMaximalCofacets_;
00198 
00199   /** */
00200   IntegrationCellSpecifier requiresMaximalCofacet_;
00201 
00202   /** */
00203   Array<MultipleDeriv> derivs_;
00204 };
00205 
00206 
00207 }
00208 
00209 
00210 #endif

Site Contact