Skip to content
Snippets Groups Projects
Commit 7fe6fca4 authored by Andrew Heather's avatar Andrew Heather
Browse files

added helper function for writing entries if not default

parent bbade879
Branches
Tags
No related merge requests found
......@@ -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>
......
......@@ -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
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment