diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C b/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C index 31cf08ada6..e6ba7a4678 100644 --- a/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C +++ b/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C @@ -138,12 +138,10 @@ Foam::Istream& Foam::operator>>(Foam::Istream& is, FixedList& L) template void Foam::FixedList::writeEntry(Ostream& os) const { - if - ( - token::compound::isCompound("List<" + word(pTraits::typeName) + '>') - ) + const word tag = "List<" + word(pTraits::typeName) + '>'; + if (token::compound::isCompound(tag)) { - os << word("List<" + word(pTraits::typeName) + '>') << " "; + os << tag << " "; } os << *this; diff --git a/src/OpenFOAM/containers/Lists/UList/UList.H b/src/OpenFOAM/containers/Lists/UList/UList.H index ee574c33ec..719df10a0f 100644 --- a/src/OpenFOAM/containers/Lists/UList/UList.H +++ b/src/OpenFOAM/containers/Lists/UList/UList.H @@ -219,7 +219,7 @@ public: //- Copy elements of the given UList void deepCopy(const UList&); - //- Write the UList as a dictionary entry + //- Write the UList with its compound type void writeEntry(Ostream&) const; //- Write the UList as a dictionary entry with keyword diff --git a/src/OpenFOAM/containers/Lists/UList/UListIO.C b/src/OpenFOAM/containers/Lists/UList/UListIO.C index cba400379f..3d78024079 100644 --- a/src/OpenFOAM/containers/Lists/UList/UListIO.C +++ b/src/OpenFOAM/containers/Lists/UList/UListIO.C @@ -34,16 +34,13 @@ License template void Foam::UList::writeEntry(Ostream& os) const { - if - ( - size() - && token::compound::isCompound - ( - "List<" + word(pTraits::typeName) + '>' - ) - ) + if (size()) { - os << word("List<" + word(pTraits::typeName) + '>') << " "; + const word tag = "List<" + word(pTraits::typeName) + '>'; + if (token::compound::isCompound(tag)) + { + os << tag << ' '; + } } os << *this;