8 #include <lifev/core/linear_algebra/LumpedOperator.hpp> 25 ASSERT_PRE( _matrix->OperatorRangeMap().PointSameAs( _matrix->OperatorDomainMap()),
26 "The matrix we want to lump must be square");
32 M_lumped.reset(
new Epetra_Vector( M_matrix->OperatorRangeMap()) );
33 M_matrix->ExtractDiagonalCopy(*M_lumped);
34 lumpedMatrix_Type ones(M_matrix->OperatorDomainMap()), m1(M_matrix->OperatorRangeMap());
35 ones.PutScalar(1.0); m1.PutScalar(0.0);
36 EPETRA_CHK_ERR(M_matrix->Multiply(
false, ones, m1));
37 Real totalMass, lumpMass;
38 ones.Dot(m1, &totalMass);
39 ones.Dot(*M_lumped, &lumpMass);
40 M_lumped->Scale(totalMass/lumpMass);
41 M_lumped->NormInf(&M_normInf);
48 ASSERT_PRE(X.NumVectors() == Y.NumVectors(),
"X and Y must have the same number of vectors");
49 ASSERT_PRE(X.Map().PointSameAs(M_lumped->Map()),
"X map should be the same of M_lumped");
50 ASSERT_PRE(Y.Map().PointSameAs(M_lumped->Map()),
"Y map should be the same of M_lumped");
52 return Y.Multiply(M_alpha, X, *M_lumped, 0.0);
57 ASSERT_PRE(X.NumVectors() == Y.NumVectors(),
"X and Y must have the same number of vectors");
58 ASSERT_PRE(X.Map().PointSameAs(M_lumped->Map()),
"X map should be the same of M_lumped");
59 ASSERT_PRE(Y.Map().PointSameAs(M_lumped->Map()),
"Y map should be the same of M_lumped");
61 return Y.ReciprocalMultiply(1.0/M_alpha, *M_lumped, X, 0.0);
Real M_alpha
the scalar coefficient for scaling the operator
bool M_useTranspose
whenever to use the transpose
void updateInverseJacobian(const UInt &iQuadPt)
void setUp(const rowMatrixPtr_Type &_matrix)
SetUp.
LumpedOperator()
Constructor.
int ApplyInverse(const vector_Type &X, vector_Type &Y) const
Apply the inverse of the operator.
Real M_normInf
the infinity norm of the operator
int Apply(const vector_Type &X, vector_Type &Y) const
Apply the Operator.
A class for Mass Lumping The lumped mass matrix is such that (1) The total mass is conserved (2) {M}_...
double Real
Generic real data.
Epetra_MultiVector vector_Type
boost::shared_ptr< rowMatrix_Type > rowMatrixPtr_Type
Epetra_Vector lumpedMatrix_Type
int compute()
compute the lumpded operator