added helper function for writing entries if not default

This commit is contained in:
andy
2009-01-21 16:55:25 +00:00
parent bbade8795a
commit 7fe6fca4df
2 changed files with 32 additions and 2 deletions

View File

@ -244,6 +244,23 @@ void Foam::fvPatchField<Type>::write(Ostream& os) const
}
template<class Type>
template<class EntryType>
void Foam::fvPatchField<Type>::writeEntryIfDifferent
(
Ostream& os,
const word& entryName,
const EntryType& value1,
const EntryType& value2
) const
{
if (value1 != value2)
{
os.writeKeyword(entryName) << value2 << token::END_STATEMENT << nl;
}
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type>

View File

@ -414,8 +414,21 @@ public:
virtual void manipulateMatrix(fvMatrix<Type>& matrix);
//- Write
virtual void write(Ostream&) const;
// I-O
//- Write
virtual void write(Ostream&) const;
//- Helper function to write the keyword and entry only if the
// values are not equal. The value is then output as value2
template<class EntryType>
void writeEntryIfDifferent
(
Ostream& os,
const word& entryName,
const EntryType& value1,
const EntryType& value2
) const;
// Check