SundanceAssemblyKernelBase.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_ASSEMBLYKERNELBASE_H
00032 #define SUNDANCE_ASSEMBLYKERNELBASE_H
00033 
00034 #include "SundanceDefs.hpp"
00035 #include "SundanceDOFMapBase.hpp"
00036 #include "SundanceEquationSet.hpp"
00037 #include "SundanceDiscreteSpace.hpp"
00038 #include "SundanceDiscreteFunction.hpp"
00039 #include "SundanceIntegralGroup.hpp"
00040 #include "SundanceElementIntegral.hpp"
00041 #include "SundanceGrouperBase.hpp"
00042 #include "SundanceEvalManager.hpp"
00043 #include "SundanceStdFwkEvalMediator.hpp"
00044 #include "SundanceEvaluatableExpr.hpp"
00045 #include "PlayaLoadableVector.hpp"
00046 #include "PlayaLoadableMatrix.hpp"
00047 #include "PlayaLinearOperatorDecl.hpp"
00048 #include "PlayaVectorDecl.hpp"
00049 #include "PlayaVectorType.hpp"
00050 #include "Teuchos_HashSet.hpp"
00051 #include "Teuchos_ParameterList.hpp"
00052 #include "PlayaIncrementallyConfigurableMatrixFactory.hpp"
00053 #include "PlayaCollectivelyConfigurableMatrixFactory.hpp"
00054 
00055 namespace Sundance
00056 {
00057 using namespace Teuchos;
00058 
00059 class StdFwkEvalMediator;
00060 class IntegralGroup;
00061 
00062 /** 
00063  * AssemblyKernelBase abstracts the operations that must be done in an
00064  * assembly loop. Regardless of whether the assembly loop is doing
00065  * matrix/vector fill, vector fill, functional/gradient evaluation,
00066  * or functional evaluation, the assembly loop will involve
00067  * <ul>
00068  * <li> A preprocessing step before the main assembly loop
00069  * <li> A preprocessing step before each work set is started
00070  * <li> A fill step after each integral group is done
00071  * <li> A postprocessing step after the main assembly loop is done
00072  * </ul>
00073  * The first of these is done by the subclass constructor. The others
00074  * are done using the pure virtual functions of this class.
00075  *
00076  * It is assumed that any data structures to be filled -- such as a matrix,
00077  * a vector, or simply a number -- are stored internally in the assembly
00078  * kernel subclass, and that they persist between preprocessing and fill 
00079  * calls.
00080  */
00081 class AssemblyKernelBase
00082 {
00083 public:
00084   /** */
00085   AssemblyKernelBase(int verb) : verb_(verb) {;}
00086 
00087   /** */
00088   virtual ~AssemblyKernelBase(){;}
00089 
00090   /**  
00091    * Do preprocessing steps needed before integrating the current
00092    * work set. 
00093    *
00094    * The default implementation does nothing. 
00095    */
00096   virtual void prepareForWorkSet(
00097     const Array<Set<int> >& requiredTests,
00098     const Array<Set<int> >& requiredUnks,
00099     RCP<StdFwkEvalMediator> mediator) {;}
00100 
00101   /** 
00102    * Adds the results of the current integral
00103    * group into the assembly results. 
00104    * \param isBC whether the current group is a replace-style 
00105    * boundary condition
00106    * \param group the current integral group
00107    * \param localValues the results of integrating the current integral group
00108    */
00109   virtual void fill(bool isBC,
00110     const IntegralGroup& group,
00111     const RCP<Array<double> >& localValues) = 0 ;  
00112 
00113   /** 
00114    * Hook to do any finalization steps after the main assembly loop, 
00115    * for example, doing an all-reduce on locally computed functional values. 
00116    * The default implementation does nothing. */
00117   virtual void postLoopFinalization() {;}
00118 
00119   /** verbosity level */
00120   int verb() const {return verb_;}
00121 
00122   /** set verbosity level.
00123    * (This function needs to be virtual because certain subclasses need specialized
00124    * implementations that propagate verbosity to children 
00125   */
00126   virtual void setVerb(int verb) {verb_=verb;}
00127 
00128 private:
00129   int verb_;
00130 };
00131 
00132 
00133 
00134 }
00135 
00136 
00137 
00138 
00139 #endif

Site Contact