MassMatrixAssembler.hpp
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
00032
00033
00034
00035
00036 #ifndef MASSMATRIXASSEMBLER_HPP_
00037 #define MASSMATRIXASSEMBLER_HPP_
00038
00039 #include "AbstractFeVolumeIntegralAssembler.hpp"
00040
00050 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00051 class MassMatrixAssembler
00052 : public AbstractFeVolumeIntegralAssembler<ELEMENT_DIM, SPACE_DIM, 1, false , true, NORMAL>
00053 {
00054 private:
00055
00057 double mScaleFactor;
00058
00060 bool mUseMassLumping;
00061
00062 public:
00063
00076 c_matrix<double,1*(ELEMENT_DIM+1),1*(ELEMENT_DIM+1)>
00077 ComputeMatrixTerm(
00078 c_vector<double, ELEMENT_DIM+1> &rPhi,
00079 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1> &rGradPhi,
00080 ChastePoint<SPACE_DIM> &rX,
00081 c_vector<double,1> &rU,
00082 c_matrix<double, 1, SPACE_DIM> &rGradU ,
00083 Element<ELEMENT_DIM,SPACE_DIM>* pElement)
00084 {
00085 c_matrix<double, ELEMENT_DIM+1, ELEMENT_DIM+1> mass_matrix = outer_prod(rPhi, rPhi);
00086
00087 if (mUseMassLumping)
00088 {
00089 for (unsigned row=0; row<ELEMENT_DIM+1; row++)
00090 {
00091 for (unsigned column=0; column<ELEMENT_DIM+1; column++)
00092 {
00093 if (row != column)
00094 {
00095 mass_matrix(row,row) += mass_matrix(row,column);
00096 mass_matrix(row,column) = 0.0;
00097 }
00098 }
00099 }
00100 }
00101
00102 return mScaleFactor*mass_matrix;
00103 }
00104
00112 MassMatrixAssembler(AbstractTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>* pMesh, bool useMassLumping=false, double scaleFactor=1.0)
00113 : AbstractFeVolumeIntegralAssembler<ELEMENT_DIM,SPACE_DIM,1,false,true,NORMAL>(pMesh),
00114 mScaleFactor(scaleFactor),
00115 mUseMassLumping(useMassLumping)
00116 {
00117 }
00118 };
00119
00120 #endif