ENH: retain compound type on List output (continuation of 68de05285a)

- can help in circumstances when an zero-sized entry is written on
  some processors, but the compound-type may be useful for determining
  a particular code path when re-reading the files. Ensures that the
  information is consistent on all processors.

STYLE: adjust separation of includes between List.H and UList.H
This commit is contained in:
Mark Olesen
2020-04-22 18:25:37 +02:00
parent bfa20286f2
commit 394a3a9b6e
4 changed files with 11 additions and 12 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd. Copyright (C) 2017-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -36,7 +36,7 @@ License
template<class T, unsigned N> template<class T, unsigned N>
void Foam::FixedList<T, N>::writeEntry(Ostream& os) const void Foam::FixedList<T, N>::writeEntry(Ostream& os) const
{ {
const word tag = "List<" + word(pTraits<T>::typeName) + '>'; const word tag("List<" + word(pTraits<T>::typeName) + '>');
if (token::compound::isCompound(tag)) if (token::compound::isCompound(tag))
{ {
os << tag << token::SPACE; os << tag << token::SPACE;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd. Copyright (C) 2017-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -45,11 +45,8 @@ SourceFiles
#include "UList.H" #include "UList.H"
#include "autoPtr.H" #include "autoPtr.H"
#include "one.H"
#include "SLListFwd.H" #include "SLListFwd.H"
#include <initializer_list>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam

View File

@ -49,6 +49,7 @@ SourceFiles
#include "label.H" #include "label.H"
#include "uLabel.H" #include "uLabel.H"
#include "zero.H" #include "zero.H"
#include "one.H"
#include "contiguous.H" #include "contiguous.H"
#include "nullObject.H" #include "nullObject.H"
#include "stdFoam.H" #include "stdFoam.H"

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd. Copyright (C) 2016-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -37,13 +37,14 @@ License
template<class T> template<class T>
void Foam::UList<T>::writeEntry(Ostream& os) const void Foam::UList<T>::writeEntry(Ostream& os) const
{ {
const word tag("List<" + word(pTraits<T>::typeName) + '>');
if (token::compound::isCompound(tag))
{
os << tag << token::SPACE;
}
if (size()) if (size())
{ {
const word tag = "List<" + word(pTraits<T>::typeName) + '>';
if (token::compound::isCompound(tag))
{
os << tag << token::SPACE;
}
os << *this; os << *this;
} }
else if (os.format() == IOstream::ASCII) else if (os.format() == IOstream::ASCII)