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

Site Contact