00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
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
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