SundanceMatrixVectorAssemblyKernel.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_MATRIXVECTORASSEMBLYKERNEL_H
00032 #define SUNDANCE_MATRIXVECTORASSEMBLYKERNEL_H
00033 
00034 #include "SundanceDefs.hpp"
00035 #include "SundanceVectorFillingAssemblyKernel.hpp"
00036 
00037 namespace Sundance
00038 {
00039 using namespace Teuchos;
00040 
00041 /** 
00042  * MatrixVectorAssemblyKernel does assembly of a matrix and vector
00043  */
00044 class MatrixVectorAssemblyKernel : public VectorFillingAssemblyKernel
00045 {
00046 public:
00047   /** */
00048   MatrixVectorAssemblyKernel(
00049     const Array<RCP<DOFMapBase> >& rowMap,
00050     const Array<RCP<Array<int> > >& isBCRow,
00051     const Array<int>& lowestLocalRow,
00052     const Array<RCP<DOFMapBase> >& colMap,
00053     const Array<RCP<Array<int> > >& isBCCol,
00054     const Array<int>& lowestLocalCol,
00055     LinearOperator<double> A,
00056     Array<Vector<double> > b,
00057     bool partitionBCs,
00058     int verb)
00059     : VectorFillingAssemblyKernel(rowMap, isBCRow, lowestLocalRow, 
00060       b, partitionBCs, verb),
00061       mat_(rowMap.size()),
00062       cmb_(colMap, isBCCol, lowestLocalCol, partitionBCs, verb)
00063     {
00064       init(rowMap, colMap, A, partitionBCs);
00065     }
00066 
00067   /** */
00068   void prepareForWorkSet(
00069     const Array<Set<int> >& requiredTests,
00070     const Array<Set<int> >& requiredUnks,
00071     RCP<StdFwkEvalMediator> mediator) ;
00072 
00073   /** */
00074   void fill(bool isBC,
00075     const IntegralGroup& group,
00076     const RCP<Array<double> >& localValues) ;
00077 
00078 protected:
00079 
00080   /** */
00081   void init(
00082   const Array<RCP<DOFMapBase> >& rowMap,
00083   const Array<RCP<DOFMapBase> >& colMap,
00084   LinearOperator<double> A,
00085   bool partitionBCs);
00086 
00087   /** */
00088   void writeLSMs(int blockRow, int blockCol,
00089     bool useCofacetCells,
00090     int numTestNodes, 
00091     int nTestFuncs, 
00092     int testFuncIndex, 
00093     const Array<int>& rowDof,
00094     int numUnkNodes, 
00095     int nUnkFuncs, 
00096     int unkFuncIndex, 
00097     const Array<int>& colDof,
00098     const Array<double>& localValues) const ;
00099 
00100   /** */
00101   void insertLocalMatrixBatch(
00102     bool isBCRqc,
00103     bool useCofacetCells,
00104     const Array<int>& testID, 
00105     const Array<int>& testBlock, 
00106     const Array<int>& unkID,
00107     const Array<int>& unkBlock,
00108     const Array<double>& localValues) const ;
00109 
00110 protected:
00111   const MapBundle& rmb() const {return mapBundle();}
00112   const MapBundle& cmb() const {return cmb_;}
00113 
00114 private:
00115   LinearOperator<double> A_;
00116   Array<Array<LoadableMatrix<double>* > > mat_;
00117   mutable MapBundle cmb_;
00118 };
00119 
00120 }
00121 
00122 
00123 
00124 #endif

Site Contact