diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedList.H b/src/OpenFOAM/containers/Lists/FixedList/FixedList.H index b56720274c..67e93fcce2 100644 --- a/src/OpenFOAM/containers/Lists/FixedList/FixedList.H +++ b/src/OpenFOAM/containers/Lists/FixedList/FixedList.H @@ -180,7 +180,7 @@ public: inline explicit FixedList(const SLList& list); //- Construct from Istream - FixedList(Istream& is); + explicit FixedList(Istream& is); //- Clone inline autoPtr> clone() const; diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C b/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C index a884beb26e..3c310e25a0 100644 --- a/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C +++ b/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C @@ -29,7 +29,6 @@ License #include "token.H" #include "contiguous.H" - // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // template @@ -70,15 +69,14 @@ Foam::Ostream& Foam::FixedList::writeList const FixedList& list = *this; // Write list contents depending on data format + + // Unlike UList, no compact output form (eg, "2{-1}") since a + // FixedList is generally small and we also want the same appearance + // for FixedList as Tuple2 + if (os.format() == IOstream::ASCII || !contiguous()) { - if (contiguous() && list.uniform()) - { - // Two or more entries, and all entries have identical values. - - os << Size << token::BEGIN_BLOCK << list[0] << token::END_BLOCK; - } - else if + if ( Size <= 1 || !shortListLen || (Size <= unsigned(shortListLen) && contiguous()) @@ -145,7 +143,8 @@ Foam::Istream& Foam::operator>>(Foam::Istream& is, FixedList& list) is.fatalCheck ( - "operator>>(Istream&, FixedList&) : reading first token" + "operator>>(Istream&, FixedList&) : " + "reading first token" ); if (firstToken.isCompound())