ENH: add operator>> and operator!= to lduMatrix::solverPerformance

- needed for reading a List<lduMatrix::solverPerformance>
This commit is contained in:
Mark Olesen
2010-06-02 14:35:03 +02:00
parent ed3c0abe42
commit 7b941b790f
2 changed files with 44 additions and 9 deletions

View File

@ -223,6 +223,10 @@ public:
//- Print summary of solver performance
void print() const;
// Member Operators
bool operator!=(const solverPerformance&) const;
// Friend functions
@ -236,6 +240,7 @@ public:
// Ostream Operator
friend Istream& operator>>(Istream&, solverPerformance&);
friend Ostream& operator<<(Ostream&, const solverPerformance&);
};

View File

@ -32,15 +32,7 @@ Description
Foam::lduMatrix::solverPerformance::solverPerformance(Istream& is)
{
is.readBeginList("lduMatrix::solverPerformance");
is >> solverName_
>> fieldName_
>> initialResidual_
>> finalResidual_
>> noIterations_
>> converged_
>> singular_;
is.readEndList("lduMatrix::solverPerformance");
is >> *this;
}
@ -118,6 +110,24 @@ void Foam::lduMatrix::solverPerformance::print() const
}
bool Foam::lduMatrix::solverPerformance::operator!=
(
const lduMatrix::solverPerformance& sp
) const
{
return
(
solverName() != sp.solverName()
|| fieldName() != sp.fieldName()
|| initialResidual() != sp.initialResidual()
|| finalResidual() != sp.finalResidual()
|| nIterations() != sp.nIterations()
|| converged() != sp.converged()
|| singular() != sp.singular()
);
}
Foam::lduMatrix::solverPerformance Foam::max
(
const lduMatrix::solverPerformance& sp1,
@ -137,6 +147,26 @@ Foam::lduMatrix::solverPerformance Foam::max
}
Foam::Istream& Foam::operator>>
(
Istream& is,
Foam::lduMatrix::solverPerformance& sp
)
{
is.readBeginList("lduMatrix::solverPerformance");
is >> sp.solverName_
>> sp.fieldName_
>> sp.initialResidual_
>> sp.finalResidual_
>> sp.noIterations_
>> sp.converged_
>> sp.singular_;
is.readEndList("lduMatrix::solverPerformance");
return is;
}
Foam::Ostream& Foam::operator<<
(
Ostream& os,