IOList, GlobalIOList, CompactIOList: Templated on container type

This reduces duplication and inconsistency between the List, Field, Map,
and PtrList variants. It also allows for future extension to other
container types such as DynamicList.
This commit is contained in:
Will Bainbridge
2022-09-14 16:30:38 +01:00
parent b0450ccd25
commit fef0206bdb
56 changed files with 1266 additions and 2385 deletions

View File

@ -45,7 +45,6 @@ Description
#include "OFstream.H"
#include "meshTools.H"
#include "faceSet.H"
#include "IOPtrList.H"
#include "polyTopoChange.H"
#include "polyModifyFace.H"
#include "wordReList.H"
@ -55,11 +54,6 @@ using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebug(IOPtrList<dictionary>, 0);
}
void changePatchID
(
const polyMesh& mesh,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -102,10 +102,7 @@ public:
(
const label cloudI,
const IOobjectList& lagrangianObjects,
PtrList
<
PtrList<CompactIOField<Field<Type>, Type>>
>& lagrangianFields
PtrList<PtrList<CompactIOField<Field<Type>>>>& lagrangianFields
);
@ -118,10 +115,10 @@ public:
) const;
template<class Type>
tmp<CompactIOField<Field<Type>, Type>> decomposeFieldField
tmp<CompactIOField<Field<Type>>> decomposeFieldField
(
const word& cloudName,
const CompactIOField<Field<Type>, Type>& field
const CompactIOField<Field<Type>>& field
) const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -68,7 +68,7 @@ void Foam::lagrangianFieldDecomposer::readFieldFields
(
const label cloudI,
const IOobjectList& lagrangianObjects,
PtrList<PtrList<CompactIOField<Field<Type>, Type>>>& lagrangianFields
PtrList<PtrList<CompactIOField<Field<Type>>>>& lagrangianFields
)
{
// Search list of objects for lagrangian fields
@ -81,15 +81,14 @@ void Foam::lagrangianFieldDecomposer::readFieldFields
(
lagrangianObjects.lookupClass
(
CompactIOField<Field<Type>,
Type>::typeName
CompactIOField<Field<Type>>::typeName
)
);
lagrangianFields.set
(
cloudI,
new PtrList<CompactIOField<Field<Type>, Type>>
new PtrList<CompactIOField<Field<Type>>>
(
lagrangianTypeObjectsA.size() + lagrangianTypeObjectsB.size()
)
@ -102,7 +101,7 @@ void Foam::lagrangianFieldDecomposer::readFieldFields
lagrangianFields[cloudI].set
(
lagrangianFieldi++,
new CompactIOField<Field<Type>, Type>(*iter())
new CompactIOField<Field<Type>>(*iter())
);
}
@ -111,7 +110,7 @@ void Foam::lagrangianFieldDecomposer::readFieldFields
lagrangianFields[cloudI].set
(
lagrangianFieldi++,
new CompactIOField<Field<Type>, Type>(*iter())
new CompactIOField<Field<Type>>(*iter())
);
}
}
@ -150,20 +149,20 @@ Foam::lagrangianFieldDecomposer::decomposeField
template<class Type>
Foam::tmp<Foam::CompactIOField<Foam::Field<Type>, Type>>
Foam::tmp<Foam::CompactIOField<Foam::Field<Type>>>
Foam::lagrangianFieldDecomposer::decomposeFieldField
(
const word& cloudName,
const CompactIOField<Field<Type>, Type>& field
const CompactIOField<Field<Type>>& field
) const
{
// Create and map the internal field values
Field<Field<Type>> procField(field, particleIndices_);
// Create the field for the processor
return tmp<CompactIOField<Field<Type>, Type>>
return tmp<CompactIOField<Field<Type>>>
(
new CompactIOField<Field<Type>, Type>
new CompactIOField<Field<Type>>
(
IOobject
(

View File

@ -69,7 +69,7 @@ tmp<IOField<Type>> reconstructLagrangianField
template<class Type>
tmp<CompactIOField<Field<Type>, Type>> reconstructLagrangianFieldField
tmp<CompactIOField<Field<Type>>> reconstructLagrangianFieldField
(
const word& cloudName,
const polyMesh& mesh,

View File

@ -89,7 +89,7 @@ Foam::tmp<Foam::IOField<Type>> Foam::reconstructLagrangianField
template<class Type>
Foam::tmp<Foam::CompactIOField<Foam::Field<Type>, Type>>
Foam::tmp<Foam::CompactIOField<Foam::Field<Type>>>
Foam::reconstructLagrangianFieldField
(
const word& cloudName,
@ -99,9 +99,9 @@ Foam::reconstructLagrangianFieldField
)
{
// Construct empty field on mesh
tmp<CompactIOField<Field<Type>, Type >> tfield
tmp<CompactIOField<Field<Type>>> tfield
(
new CompactIOField<Field<Type>, Type>
new CompactIOField<Field<Type>>
(
IOobject
(
@ -132,7 +132,7 @@ Foam::reconstructLagrangianFieldField
if (localIOobject.headerOk())
{
CompactIOField<Field<Type>, Type> fieldi(localIOobject);
CompactIOField<Field<Type>> fieldi(localIOobject);
label offset = field.size();
field.setSize(offset + fieldi.size());
@ -203,7 +203,7 @@ void Foam::reconstructLagrangianFieldFields
)
{
{
const word fieldClassName(CompactIOField<Field<Type>, Type>::typeName);
const word fieldClassName(CompactIOField<Field<Type>>::typeName);
IOobjectList fields = objects.lookupClass(fieldClassName);

View File

@ -97,9 +97,6 @@ class polyPatch;
class faceSet;
class pointSet;
template<class Type> class IOField;
template<class Type> class List;
/*---------------------------------------------------------------------------*\
Class vtkPVFoam Declaration
\*---------------------------------------------------------------------------*/

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -108,7 +108,7 @@ void MapLagrangianFields
// Map - use CompactIOField to automatically write in
// compact form for binary format.
CompactIOField<Field<Type>, Type> fieldTarget
CompactIOField<Field<Type>> fieldTarget
(
IOobject
(
@ -135,7 +135,7 @@ void MapLagrangianFields
{
IOobjectList fieldFields =
objects.lookupClass(CompactIOField<Field<Type>, Type>::typeName);
objects.lookupClass(CompactIOField<Field<Type>>::typeName);
forAllIter(IOobjectList, fieldFields, fieldIter)
{
@ -143,10 +143,10 @@ void MapLagrangianFields
<< fieldIter()->name() << endl;
// Read field (does not need mesh)
CompactIOField<Field<Type>, Type> fieldSource(*fieldIter());
CompactIOField<Field<Type>> fieldSource(*fieldIter());
// Map
CompactIOField<Field<Type>, Type> fieldTarget
CompactIOField<Field<Type>> fieldTarget
(
IOobject
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -108,7 +108,7 @@ void MapLagrangianFields
// Map - use CompactIOField to automatically write in
// compact form for binary format.
CompactIOField<Field<Type>, Type> fieldTarget
CompactIOField<Field<Type>> fieldTarget
(
IOobject
(
@ -135,7 +135,7 @@ void MapLagrangianFields
{
IOobjectList fieldFields =
objects.lookupClass(CompactIOField<Field<Type>, Type>::typeName);
objects.lookupClass(CompactIOField<Field<Type>>::typeName);
forAllIter(IOobjectList, fieldFields, fieldIter)
{
@ -143,10 +143,10 @@ void MapLagrangianFields
<< fieldIter()->name() << endl;
// Read field (does not need mesh)
CompactIOField<Field<Type>, Type> fieldSource(*fieldIter());
CompactIOField<Field<Type>> fieldSource(*fieldIter());
// Map
CompactIOField<Field<Type>, Type> fieldTarget
CompactIOField<Field<Type>> fieldTarget
(
IOobject
(

View File

@ -246,11 +246,7 @@ $(IOdictionary)/localIOdictionary.C
$(IOdictionary)/timeIOdictionary.C
$(IOdictionary)/systemDict.C
db/IOobjects/IOMap/IOMapName.C
db/IOobjects/decomposedBlockData/decomposedBlockData.C
db/IOobjects/GlobalIOList/GlobalIOLists.C
db/IOobjects/GlobalIOField/GlobalIOFields.C
IOobject = db/IOobject
$(IOobject)/IOobject.C

View File

@ -1,340 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "CompactIOField.H"
#include "labelList.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type, class BaseType>
void Foam::CompactIOField<Type, BaseType>::readFromStream(const bool read)
{
Istream& is = readStream(word::null, read);
if (read)
{
if (headerClassName() == IOField<Type>::typeName)
{
is >> static_cast<Field<Type>&>(*this);
close();
}
else if (headerClassName() == typeName)
{
is >> *this;
close();
}
else
{
FatalIOErrorInFunction
(
is
) << "unexpected class name " << headerClassName()
<< " expected " << typeName << " or " << IOField<Type>::typeName
<< endl
<< " while reading object " << name()
<< exit(FatalIOError);
}
}
}
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
template<class Type, class BaseType>
Foam::CompactIOField<Type, BaseType>::CompactIOField(const IOobject& io)
:
regIOobject(io)
{
if
(
io.readOpt() == IOobject::MUST_READ
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readFromStream();
}
}
template<class Type, class BaseType>
Foam::CompactIOField<Type, BaseType>::CompactIOField
(
const IOobject& io,
const bool read
)
:
regIOobject(io)
{
if (io.readOpt() == IOobject::MUST_READ)
{
readFromStream(read);
}
else if (io.readOpt() == IOobject::READ_IF_PRESENT)
{
bool haveFile = headerOk();
readFromStream(read && haveFile);
}
}
template<class Type, class BaseType>
Foam::CompactIOField<Type, BaseType>::CompactIOField
(
const IOobject& io,
const label size
)
:
regIOobject(io)
{
if
(
io.readOpt() == IOobject::MUST_READ
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readFromStream();
}
else
{
Field<Type>::setSize(size);
}
}
template<class Type, class BaseType>
Foam::CompactIOField<Type, BaseType>::CompactIOField
(
const IOobject& io,
const Field<Type>& field
)
:
regIOobject(io)
{
if
(
io.readOpt() == IOobject::MUST_READ
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readFromStream();
}
else
{
Field<Type>::operator=(field);
}
}
template<class Type, class BaseType>
Foam::CompactIOField<Type, BaseType>::CompactIOField
(
const IOobject& io,
Field<Type>&& field
)
:
regIOobject(io),
Field<Type>(move(field))
{
if
(
io.readOpt() == IOobject::MUST_READ
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readFromStream();
}
}
template<class Type, class BaseType>
Foam::CompactIOField<Type, BaseType>::CompactIOField
(
CompactIOField<Type, BaseType>&& field
)
:
regIOobject(move(field)),
Field<Type>(move(field))
{}
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class Type, class BaseType>
Foam::CompactIOField<Type, BaseType>::~CompactIOField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type, class BaseType>
bool Foam::CompactIOField<Type, BaseType>::writeObject
(
IOstream::streamFormat fmt,
IOstream::versionNumber ver,
IOstream::compressionType cmp,
const bool write
) const
{
if (fmt == IOstream::ASCII)
{
// Change type to be non-compact format type
const word oldTypeName = typeName;
const_cast<word&>(typeName) = IOField<Type>::typeName;
bool good = regIOobject::writeObject(fmt, ver, cmp, write);
// Change type back
const_cast<word&>(typeName) = oldTypeName;
return good;
}
else
{
return regIOobject::writeObject(fmt, ver, cmp, write);
}
}
template<class Type, class BaseType>
bool Foam::CompactIOField<Type, BaseType>::writeData(Ostream& os) const
{
return (os << *this).good();
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type, class BaseType>
void Foam::CompactIOField<Type, BaseType>::operator=
(
const CompactIOField<Type, BaseType>& rhs
)
{
Field<Type>::operator=(rhs);
}
template<class Type, class BaseType>
void Foam::CompactIOField<Type, BaseType>::operator=
(
CompactIOField<Type, BaseType>&& rhs
)
{
Field<Type>::operator=(move(rhs));
}
template<class Type, class BaseType>
void Foam::CompactIOField<Type, BaseType>::operator=(const Field<Type>& rhs)
{
Field<Type>::operator=(rhs);
}
template<class Type, class BaseType>
void Foam::CompactIOField<Type, BaseType>::operator=(Field<Type>&& rhs)
{
Field<Type>::operator=(move(rhs));
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class Type, class BaseType>
Foam::Istream& Foam::operator>>
(
Foam::Istream& is,
Foam::CompactIOField<Type, BaseType>& L
)
{
// Read compact
const labelList start(is);
const Field<BaseType> elems(is);
// Convert
L.setSize(start.size()-1);
forAll(L, i)
{
Type& subField = L[i];
label index = start[i];
subField.setSize(start[i+1] - index);
forAll(subField, j)
{
subField[j] = elems[index++];
}
}
return is;
}
template<class Type, class BaseType>
Foam::Ostream& Foam::operator<<
(
Foam::Ostream& os,
const Foam::CompactIOField<Type, BaseType>& L
)
{
// Keep ascii writing same.
if (os.format() == IOstream::ASCII)
{
os << static_cast<const Field<Type>&>(L);
}
else
{
// Convert to compact format
labelList start(L.size()+1);
start[0] = 0;
for (label i = 1; i < start.size(); i++)
{
start[i] = start[i-1]+L[i-1].size();
}
Field<BaseType> elems(start[start.size()-1]);
label elemI = 0;
forAll(L, i)
{
const Type& subField = L[i];
forAll(subField, j)
{
elems[elemI++] = subField[j];
}
}
os << start << elems;
}
return os;
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,58 +25,34 @@ Class
Foam::CompactIOField
Description
A Field of objects of type \<T\> with automated input and output using
A Field of objects of type \<Type\> with automated input and output using
a compact storage. Behaves like IOField except when binary output in
case it writes a CompactListList.
Useful for fields of small subfields e.g. in lagrangian
SourceFiles
CompactIOField.C
\*---------------------------------------------------------------------------*/
#ifndef CompactIOField_H
#define CompactIOField_H
#include "CompactIOList.H"
#include "IOField.H"
#include "regIOobject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of friend functions and operators
template<class Type, class BaseType> class CompactIOField;
template<class Type, class BaseType> Istream& operator>>
(
Istream&,
CompactIOField<Type, BaseType>&
);
template<class Type, class BaseType> Ostream& operator<<
(
Ostream&,
const CompactIOField<Type, BaseType>&
);
/*---------------------------------------------------------------------------*\
Class CompactIOField Declaration
\*---------------------------------------------------------------------------*/
template<class Type, class BaseType>
template<class Type>
class CompactIOField
:
public regIOobject,
public Field<Type>
public CompactIOListBase<Field, IOField, CompactIOField, Type>
{
// Private Member Functions
//- Read according to header type
void readFromStream(const bool read = true);
public:
//- Runtime type information
@ -85,50 +61,18 @@ public:
// Constructors
//- Construct from IOobject
CompactIOField(const IOobject&);
//- Construct from IOobject; does local processor require reading?
CompactIOField(const IOobject&, const bool read);
//- Construct from IOobject and size
CompactIOField(const IOobject&, const label);
//- Construct from IOobject and a Field
CompactIOField(const IOobject&, const Field<Type>&);
//- Move construct by transferring the Field contents
CompactIOField(const IOobject&, Field<Type>&&);
//- Move constructor
CompactIOField(CompactIOField<Type, BaseType>&&);
// Destructor
virtual ~CompactIOField();
// Member Functions
virtual bool writeObject
(
IOstream::streamFormat,
IOstream::versionNumber,
IOstream::compressionType,
const bool write
) const;
virtual bool writeData(Ostream&) const;
//- Inherit constructors
using
CompactIOListBase<Field, IOField, CompactIOField, Type>::
CompactIOListBase;
// Member Operators
void operator=(const CompactIOField<Type, BaseType>&);
void operator=(CompactIOField<Type, BaseType>&&);
void operator=(const Field<Type>&);
void operator=(Field<Type>&&);
//- Inherit assignment operators
using
CompactIOListBase<Field, IOField, CompactIOField, Type>::
operator=;
};
@ -138,12 +82,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "CompactIOField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -28,39 +28,169 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class T, class BaseType>
void Foam::CompactIOList<T, BaseType>::readFromStream()
template
<
template<class> class Container,
template<class> class IOContainer,
template<class> class CompactIOContainer,
class Type
>
bool
Foam::CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>::
overflows() const
{
Istream& is = readStream(word::null);
label size = 0;
if (headerClassName() == IOList<T>::typeName)
forAll(*this, i)
{
is >> static_cast<ListCompactIO<T, BaseType>&>(*this);
label oldSize = size;
size += this->operator[](i).size();
if (size < oldSize)
{
return true;
}
}
return false;
}
template
<
template<class> class Container,
template<class> class IOContainer,
template<class> class CompactIOContainer,
class Type
>
void
Foam::CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>::
convertToCompact
(
labelList& start,
List<typename Type::value_type>& elems
) const
{
start.setSize(this->size() + 1);
start[0] = 0;
for (label i = 1; i < start.size(); i++)
{
const label prev = start[i-1];
start[i] = prev + this->operator[](i-1).size();
if (start[i] < prev)
{
FatalErrorInFunction
<< "Overall number of elements " << start[i]
<< " of CompactIOListBase of size "
<< this->size() << " overflows the representation of a label"
<< endl << "Please recompile with a larger representation"
<< " for label" << exit(FatalError);
}
}
elems.setSize(start[start.size() - 1]);
label elemi = 0;
forAll(*this, i)
{
const Type& subList = this->operator[](i);
forAll(subList, j)
{
elems[elemi++] = subList[j];
}
}
}
template
<
template<class> class Container,
template<class> class IOContainer,
template<class> class CompactIOContainer,
class Type
>
void
Foam::CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>::
convertFromCompact
(
const labelList& start,
const List<typename Type::value_type>& elems
)
{
this->setSize(start.size() - 1);
forAll(*this, i)
{
Type& subList = this->operator[](i);
label index = start[i];
subList.setSize(start[i+1] - index);
forAll(subList, j)
{
subList[j] = elems[index++];
}
}
}
template
<
template<class> class Container,
template<class> class IOContainer,
template<class> class CompactIOContainer,
class Type
>
void
Foam::CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>::
readFromStream(const bool read)
{
Istream& is = readStream(word::null, read);
if (read)
{
if (headerClassName() == IOContainer<Type>::typeName)
{
is >> static_cast<Container<Type>&>(*this);
close();
}
else if (headerClassName() == typeName)
else if (headerClassName() == CompactIOContainer<Type>::typeName)
{
is >> *this;
close();
}
else
{
FatalIOErrorInFunction
(
is
) << "unexpected class name " << headerClassName()
<< " expected " << typeName << " or " << IOList<T>::typeName
<< endl
FatalIOErrorInFunction(is)
<< "unexpected class name " << headerClassName()
<< " expected " << CompactIOContainer<Type>::typeName << " or "
<< IOContainer<Type>::typeName << endl
<< " while reading object " << name()
<< exit(FatalIOError);
}
}
}
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
template<class T, class BaseType>
Foam::CompactIOList<T, BaseType>::CompactIOList(const IOobject& io)
template
<
template<class> class Container,
template<class> class IOContainer,
template<class> class CompactIOContainer,
class Type
>
Foam::CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>::
CompactIOListBase(const IOobject& io)
:
regIOobject(io)
{
@ -75,8 +205,43 @@ Foam::CompactIOList<T, BaseType>::CompactIOList(const IOobject& io)
}
template<class T, class BaseType>
Foam::CompactIOList<T, BaseType>::CompactIOList
template
<
template<class> class Container,
template<class> class IOContainer,
template<class> class CompactIOContainer,
class Type
>
Foam::CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>::
CompactIOListBase
(
const IOobject& io,
const bool read
)
:
regIOobject(io)
{
if (io.readOpt() == IOobject::MUST_READ)
{
readFromStream(read);
}
else if (io.readOpt() == IOobject::READ_IF_PRESENT)
{
bool haveFile = headerOk();
readFromStream(read && haveFile);
}
}
template
<
template<class> class Container,
template<class> class IOContainer,
template<class> class CompactIOContainer,
class Type
>
Foam::CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>::
CompactIOListBase
(
const IOobject& io,
const label size
@ -99,39 +264,22 @@ Foam::CompactIOList<T, BaseType>::CompactIOList
}
template<class T, class BaseType>
Foam::CompactIOList<T, BaseType>::CompactIOList
template
<
template<class> class Container,
template<class> class IOContainer,
template<class> class CompactIOContainer,
class Type
>
Foam::CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>::
CompactIOListBase
(
const IOobject& io,
const List<T>& list
)
:
regIOobject(io)
{
if
(
io.readOpt() == IOobject::MUST_READ
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readFromStream();
}
else
{
ListCompactIO<T, BaseType>::operator=(list);
}
}
template<class T, class BaseType>
Foam::CompactIOList<T, BaseType>::CompactIOList
(
const IOobject& io,
List<T>&& list
const Container<Type>& l
)
:
regIOobject(io),
ListCompactIO<T, BaseType>(move(list))
Container<Type>(l)
{
if
(
@ -144,29 +292,78 @@ Foam::CompactIOList<T, BaseType>::CompactIOList
}
template<class T, class BaseType>
Foam::CompactIOList<T, BaseType>::CompactIOList
template
<
template<class> class Container,
template<class> class IOContainer,
template<class> class CompactIOContainer,
class Type
>
Foam::CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>::
CompactIOListBase
(
CompactIOList<T, BaseType>&& list
const IOobject& io,
Container<Type>&& l
)
:
regIOobject(move(list)),
List<T>(move(list))
regIOobject(io),
Container<Type>(move(l))
{
if
(
io.readOpt() == IOobject::MUST_READ
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readFromStream();
}
}
template
<
template<class> class Container,
template<class> class IOContainer,
template<class> class CompactIOContainer,
class Type
>
Foam::CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>::
CompactIOListBase
(
CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>&& l
)
:
regIOobject(move(l)),
Container<Type>(move(l))
{}
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class T, class BaseType>
Foam::CompactIOList<T, BaseType>::~CompactIOList()
template
<
template<class> class Container,
template<class> class IOContainer,
template<class> class CompactIOContainer,
class Type
>
Foam::CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>::
~CompactIOListBase()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T, class BaseType>
bool Foam::CompactIOList<T, BaseType>::writeObject
template
<
template<class> class Container,
template<class> class IOContainer,
template<class> class CompactIOContainer,
class Type
>
bool
Foam::CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>::
writeObject
(
IOstream::streamFormat fmt,
IOstream::versionNumber ver,
@ -177,33 +374,35 @@ bool Foam::CompactIOList<T, BaseType>::writeObject
if (fmt == IOstream::ASCII)
{
// Change type to be non-compact format type
const word oldTypeName = typeName;
const word oldTypeName = CompactIOContainer<Type>::typeName;
const_cast<word&>(typeName) = IOList<T>::typeName;
const_cast<word&>(CompactIOContainer<Type>::typeName) =
IOContainer<Type>::typeName;
bool good = regIOobject::writeObject(fmt, ver, cmp, write);
// Change type back
const_cast<word&>(typeName) = oldTypeName;
const_cast<word&>(CompactIOContainer<Type>::typeName) = oldTypeName;
return good;
}
else if (this->overflows())
{
WarningInFunction
<< "Overall number of elements of CompactIOList of size "
<< "Overall number of elements of CompactIOListBase of size "
<< this->size() << " overflows the representation of a label"
<< endl << " Switching to ascii writing" << endl;
// Change type to be non-compact format type
const word oldTypeName = typeName;
const word oldTypeName = CompactIOContainer<Type>::typeName;
const_cast<word&>(typeName) = IOList<T>::typeName;
const_cast<word&>(CompactIOContainer<Type>::typeName) =
IOContainer<Type>::typeName;
bool good = regIOobject::writeObject(IOstream::ASCII, ver, cmp, write);
// Change type back
const_cast<word&>(typeName) = oldTypeName;
const_cast<word&>(CompactIOContainer<Type>::typeName) = oldTypeName;
return good;
}
@ -214,8 +413,16 @@ bool Foam::CompactIOList<T, BaseType>::writeObject
}
template<class T, class BaseType>
bool Foam::CompactIOList<T, BaseType>::writeData(Ostream& os) const
template
<
template<class> class Container,
template<class> class IOContainer,
template<class> class CompactIOContainer,
class Type
>
bool
Foam::CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>::
writeData(Ostream& os) const
{
return (os << *this).good();
}
@ -223,43 +430,120 @@ bool Foam::CompactIOList<T, BaseType>::writeData(Ostream& os) const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class T, class BaseType>
void Foam::CompactIOList<T, BaseType>::operator=
template
<
template<class> class Container,
template<class> class IOContainer,
template<class> class CompactIOContainer,
class Type
>
void
Foam::CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>::
operator=
(
const CompactIOList<T, BaseType>& rhs
const CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>&
rhs
)
{
ListCompactIO<T, BaseType>::operator=(rhs);
Container<Type>::operator=(rhs);
}
template<class T, class BaseType>
void Foam::CompactIOList<T, BaseType>::operator=
template
<
template<class> class Container,
template<class> class IOContainer,
template<class> class CompactIOContainer,
class Type
>
void
Foam::CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>::
operator=
(
CompactIOList<T, BaseType>&& rhs
CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>&& rhs
)
{
ListCompactIO<T, BaseType>::operator=(move(rhs));
Container<Type>::operator=(move(rhs));
}
template<class T, class BaseType>
void Foam::CompactIOList<T, BaseType>::operator=
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
template
<
template<class> class Container,
template<class> class IOContainer,
template<class> class CompactIOContainer,
class Type
>
void Foam::writeEntry
(
const List<T>& rhs
Ostream& os,
const CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>& l
)
{
ListCompactIO<T, BaseType>::operator=(rhs);
os << l;
}
template<class T, class BaseType>
void Foam::CompactIOList<T, BaseType>::operator=
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template
<
template<class> class Container,
template<class> class IOContainer,
template<class> class CompactIOContainer,
class Type
>
Foam::Istream& Foam::operator>>
(
List<T>&& rhs
Istream& is,
CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>& l
)
{
ListCompactIO<T, BaseType>::operator=(move(rhs));
// ASCII is not compacted
if (is.format() == IOstream::ASCII)
{
is >> static_cast<Container<Type>&>(l);
}
else
{
labelList start(is);
List<typename Type::value_type> elems(is);
l.convertFromCompact(start, elems);
}
return is;
}
template
<
template<class> class Container,
template<class> class IOContainer,
template<class> class CompactIOContainer,
class Type
>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>& l
)
{
// ASCII is not compacted
if (os.format() == IOstream::ASCII)
{
os << static_cast<const Container<Type>&>(l);
}
else
{
labelList start;
List<typename Type::value_type> elems;
l.convertToCompact(start, elems);
os << start << elems;
}
return os;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,7 +25,7 @@ Class
Foam::CompactIOList
Description
A List of objects of type \<T\> with automated input and output using
A List of objects of type \<Type\> with automated input and output using
a compact storage. Behaves like IOList except when binary output in
case it writes a CompactListList.
@ -39,7 +39,7 @@ SourceFiles
#ifndef CompactIOList_H
#define CompactIOList_H
#include "ListCompactIO.H"
#include "IOList.H"
#include "regIOobject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -47,52 +47,136 @@ SourceFiles
namespace Foam
{
// Forward declaration of friend functions and operators
template
<
template<class> class Container,
template<class> class IOContainer,
template<class> class CompactIOContainer,
class Type
>
class CompactIOListBase;
template
<
template<class> class Container,
template<class> class IOContainer,
template<class> class CompactIOContainer,
class Type
>
void writeEntry
(
Ostream&,
const CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>&
);
template
<
template<class> class Container,
template<class> class IOContainer,
template<class> class CompactIOContainer,
class Type
>
Istream& operator>>
(
Istream&,
CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>&
);
template
<
template<class> class Container,
template<class> class IOContainer,
template<class> class CompactIOContainer,
class Type
>
Ostream& operator<<
(
Ostream&,
const CompactIOListBase<Container, IOContainer, CompactIOContainer, Type>&
);
/*---------------------------------------------------------------------------*\
Class CompactIOList Declaration
Class CompactIOListBase Declaration
\*---------------------------------------------------------------------------*/
template<class T, class BaseType>
class CompactIOList
template
<
template<class> class Container,
template<class> class IOContainer,
template<class> class CompactIOContainer,
class Type
>
class CompactIOListBase
:
public regIOobject,
public ListCompactIO<T, BaseType>
public Container<Type>
{
// Private Member Functions
//- Does the container have too many elements to represent with the
// current integer size type?
bool overflows() const;
//- Convert the data to a compact representation
void convertToCompact
(
labelList& start,
List<typename Type::value_type>& elems
) const;
//- Convert the data from a compact representation
void convertFromCompact
(
const labelList& start,
const List<typename Type::value_type>& elems
);
//- Read according to header type
void readFromStream();
void readFromStream(const bool read = true);
public:
//- Runtime type information
TypeName("CompactList");
// Constructors
//- Construct from IOobject
CompactIOList(const IOobject&);
CompactIOListBase(const IOobject&);
//- Construct from IOobject and size of CompactIOList
CompactIOList(const IOobject&, const label);
//- Construct from IOobject; does local processor require reading?
CompactIOListBase(const IOobject&, const bool read);
//- Construct from IOobject and a List
CompactIOList(const IOobject&, const List<T>&);
//- Construct from IOobject and size of CompactIOListBase
CompactIOListBase(const IOobject&, const label);
//- Move construct by transferring the List contents
CompactIOList(const IOobject&, List<T>&&);
//- Construct from IOobject and a Container
CompactIOListBase(const IOobject&, const Container<Type>&);
//- Move construct by transferring the Container contents
CompactIOListBase(const IOobject&, Container<Type>&&);
//- Move constructor
CompactIOList(CompactIOList<T, BaseType>&&);
CompactIOListBase
(
CompactIOListBase
<
Container,
IOContainer,
CompactIOContainer,
Type
>&&
);
// Destructor
virtual ~CompactIOList();
//- Destructor
virtual ~CompactIOListBase();
// Member Functions
//- WriteObject function. Changes the write type depending on whether
// the output is compact or not.
virtual bool writeObject
(
IOstream::streamFormat,
@ -101,16 +185,134 @@ public:
const bool write
) const;
//- WriteData function required for regIOobject write operation
virtual bool writeData(Ostream&) const;
// Member Operators
void operator=(const CompactIOList<T, BaseType>&);
void operator=(CompactIOList<T, BaseType>&&);
//- Inherit assignment operators
using Container<Type>::operator=;
void operator=(const List<T>&);
void operator=(List<T>&&);
//- Assign to another CompactIOList
void operator=
(
const CompactIOListBase
<
Container,
IOContainer,
CompactIOContainer,
Type
>&
);
//- Move-assign to another CompactIOList
void operator=
(
CompactIOListBase
<
Container,
IOContainer,
CompactIOContainer,
Type
>&&
);
// IOstream functions
//- Write list to Ostream
friend void writeEntry
<
Container,
IOContainer,
CompactIOContainer,
Type
>
(
Ostream&,
const CompactIOListBase
<
Container,
IOContainer,
CompactIOContainer,
Type
>&
);
// IOstream Operators
//- Read list from Istream
friend Istream& operator>>
<
Container,
IOContainer,
CompactIOContainer,
Type
>
(
Istream&,
CompactIOListBase
<
Container,
IOContainer,
CompactIOContainer,
Type
>&
);
// Write list to Ostream
friend Ostream& operator<<
<
Container,
IOContainer,
CompactIOContainer,
Type
>
(
Ostream&,
const CompactIOListBase
<
Container,
IOContainer,
CompactIOContainer,
Type
>&
);
};
/*---------------------------------------------------------------------------*\
Class CompactIOList Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class CompactIOList
:
public CompactIOListBase<List, IOList, CompactIOList, Type>
{
public:
//- Runtime type information
TypeName("ListList");
// Constructors
//- Inherit constructors
using
CompactIOListBase<List, IOList, CompactIOList, Type>::
CompactIOListBase;
// Member Operators
//- Inherit assignment operators
using
CompactIOListBase<List, IOList, CompactIOList, Type>::
operator=;
};

View File

@ -1,262 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "ListCompactIO.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class T, class BaseType>
bool Foam::ListCompactIO<T, BaseType>::overflows() const
{
label size = 0;
forAll(*this, i)
{
label oldSize = size;
size += this->operator[](i).size();
if (size < oldSize)
{
return true;
}
}
return false;
}
template<class T, class BaseType>
void Foam::ListCompactIO<T, BaseType>::convertToCompact
(
labelList& start,
List<BaseType>& elems
) const
{
start.setSize(this->size() + 1);
start[0] = 0;
for (label i = 1; i < start.size(); i++)
{
label prev = start[i-1];
start[i] = prev + this->operator[](i-1).size();
if (start[i] < prev)
{
FatalErrorInFunction
<< "Overall number of elements " << start[i]
<< " of ListCompactIO of size "
<< this->size() << " overflows the representation of a label"
<< endl << "Please recompile with a larger representation"
<< " for label" << exit(FatalError);
}
}
elems.setSize(start[start.size() - 1]);
label elemi = 0;
forAll(*this, i)
{
const T& subList = this->operator[](i);
forAll(subList, j)
{
elems[elemi++] = subList[j];
}
}
}
template<class T, class BaseType>
void Foam::ListCompactIO<T, BaseType>::convertFromCompact
(
const labelList& start,
const List<BaseType>& elems
)
{
this->setSize(start.size() - 1);
forAll(*this, i)
{
T& subList = this->operator[](i);
label index = start[i];
subList.setSize(start[i+1] - index);
forAll(subList, j)
{
subList[j] = elems[index++];
}
}
}
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
template<class T, class BaseType>
Foam::ListCompactIO<T, BaseType>::ListCompactIO()
{}
template<class T, class BaseType>
Foam::ListCompactIO<T, BaseType>::ListCompactIO(const UList<T>& l)
:
List<T>(l)
{}
template<class T, class BaseType>
Foam::ListCompactIO<T, BaseType>::ListCompactIO(Istream& is)
{
is >> *this;
}
template<class T, class BaseType>
Foam::ListCompactIO<T, BaseType>::ListCompactIO
(
const ListCompactIO<T, BaseType>& l
)
:
List<T>(l)
{}
template<class T, class BaseType>
Foam::ListCompactIO<T, BaseType>::ListCompactIO(ListCompactIO<T, BaseType>&& l)
:
List<T>(move(l))
{}
template<class T, class BaseType>
Foam::ListCompactIO<T, BaseType>::ListCompactIO(List<T>&& l)
:
List<T>(move(l))
{}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class T, class BaseType>
void Foam::ListCompactIO<T, BaseType>::operator=
(
const ListCompactIO<T, BaseType>& rhs
)
{
List<T>::operator=(rhs);
}
template<class T, class BaseType>
void Foam::ListCompactIO<T, BaseType>::operator=
(
ListCompactIO<T, BaseType>&& rhs
)
{
List<T>::operator=(move(rhs));
}
template<class T, class BaseType>
void Foam::ListCompactIO<T, BaseType>::operator=(const List<T>& rhs)
{
List<T>::operator=(rhs);
}
template<class T, class BaseType>
void Foam::ListCompactIO<T, BaseType>::operator=(List<T>&& rhs)
{
List<T>::operator=(move(rhs));
}
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
template<class T, class BaseType>
void Foam::writeEntry(Ostream& os, const ListCompactIO<T, BaseType>& l)
{
// Keep ascii writing same.
if (os.format() == IOstream::ASCII)
{
os << static_cast<const List<T>&>(l);
}
else
{
labelList start;
List<BaseType> elems;
l.convertToCompact(start, elems);
writeEntry(os, start);
writeEntry(os, elems);
}
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class T, class BaseType>
Foam::Istream& Foam::operator>>
(
Foam::Istream& is,
Foam::ListCompactIO<T, BaseType>& L
)
{
if (is.format() == IOstream::ASCII)
{
is >> static_cast<List<T>&>(L);
}
else
{
labelList start(is);
List<BaseType> elems(is);
L.convertFromCompact(start, elems);
}
return is;
}
template<class T, class BaseType>
Foam::Ostream& Foam::operator<<
(
Foam::Ostream& os,
const Foam::ListCompactIO<T, BaseType>& L
)
{
// Keep ascii writing same.
if (os.format() == IOstream::ASCII)
{
os << static_cast<const List<T>&>(L);
}
else
{
labelList start;
List<BaseType> elems;
L.convertToCompact(start, elems);
os << start << elems;
}
return os;
}
// ************************************************************************* //

View File

@ -1,173 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::ListCompactIO
Description
A List of objects of type \<T\> with input and output using
a compact storage. Behaves like List except when binary output in
case it writes a CompactListList.
Useful for lists of small sublists e.g. faceList, cellList.
SourceFiles
ListCompactIO.C
\*---------------------------------------------------------------------------*/
#ifndef ListCompactIO_H
#define ListCompactIO_H
#include "labelList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class Istream;
class Ostream;
// Forward declaration of friend functions and operators
template<class T, class BaseType> class ListCompactIO;
template<class T, class BaseType>
void writeEntry(Ostream& os, const ListCompactIO<T, BaseType>& l);
template<class T, class BaseType> Istream& operator>>
(
Istream&,
ListCompactIO<T, BaseType>&
);
template<class T, class BaseType> Ostream& operator<<
(
Ostream&,
const ListCompactIO<T, BaseType>&
);
/*---------------------------------------------------------------------------*\
Class ListCompactIO Declaration
\*---------------------------------------------------------------------------*/
template<class T, class BaseType>
class ListCompactIO
:
public List<T>
{
protected:
// Protected Member Functions
//- Has too many elements in it?
bool overflows() const;
void convertToCompact
(
labelList& start,
List<BaseType>& elems
) const;
void convertFromCompact
(
const labelList& start,
const List<BaseType>& elems
);
public:
// Constructors
//- Construct null
ListCompactIO();
//- Construct from UList
ListCompactIO(const UList<T>&);
//- Construct from Istream
ListCompactIO(Istream&);
//- Copy constructor
ListCompactIO(const ListCompactIO<T, BaseType>&);
//- Move constructor
ListCompactIO(ListCompactIO<T, BaseType>&&);
//- Move constructor from List
ListCompactIO(List<T>&&);
// Member Operators
void operator=(const ListCompactIO<T, BaseType>&);
void operator=(ListCompactIO<T, BaseType>&&);
void operator=(const List<T>&);
void operator=(List<T>&&);
// IOstream functions
friend void writeEntry <T, BaseType>
(
Ostream& os,
const ListCompactIO<T, BaseType>& l
);
// IOstream Operators
//- Read List from Istream, discarding contents of existing List.
friend Istream& operator>> <T, BaseType>
(
Istream&,
ListCompactIO<T, BaseType>&
);
// Write List to Ostream.
friend Ostream& operator<< <T, BaseType>
(
Ostream&,
const ListCompactIO<T, BaseType>&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "ListCompactIO.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,170 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "GlobalIOField.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::GlobalIOField<Type>::GlobalIOField(const IOobject& io)
:
regIOobject(io)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<GlobalIOField<Type>>();
readHeaderOk(IOstream::BINARY, typeName);
}
template<class Type>
Foam::GlobalIOField<Type>::GlobalIOField(const IOobject& io, const label size)
:
regIOobject(io)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<GlobalIOField<Type>>();
if (!readHeaderOk(IOstream::BINARY, typeName))
{
Field<Type>::setSize(size);
}
}
template<class Type>
Foam::GlobalIOField<Type>::GlobalIOField
(
const IOobject& io,
const Field<Type>& f
)
:
regIOobject(io)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<GlobalIOField<Type>>();
if (!readHeaderOk(IOstream::BINARY, typeName))
{
Field<Type>::operator=(f);
}
}
template<class Type>
Foam::GlobalIOField<Type>::GlobalIOField
(
const IOobject& io,
Field<Type>&& f
)
:
regIOobject(io),
Field<Type>(move(f))
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<GlobalIOField<Type>>();
readHeaderOk(IOstream::BINARY, typeName);
}
template<class Type>
Foam::GlobalIOField<Type>::GlobalIOField
(
const GlobalIOField<Type>& field
)
:
regIOobject(field),
Field<Type>(field)
{}
template<class Type>
Foam::GlobalIOField<Type>::GlobalIOField
(
GlobalIOField<Type>&& field
)
:
regIOobject(move(field)),
Field<Type>(move(field))
{}
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class Type>
Foam::GlobalIOField<Type>::~GlobalIOField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
bool Foam::GlobalIOField<Type>::readData(Istream& is)
{
is >> *this;
return is.good();
}
template<class Type>
bool Foam::GlobalIOField<Type>::writeData(Ostream& os) const
{
return (os << static_cast<const Field<Type>&>(*this)).good();
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type>
void Foam::GlobalIOField<Type>::operator=(const GlobalIOField<Type>& rhs)
{
Field<Type>::operator=(rhs);
}
template<class Type>
void Foam::GlobalIOField<Type>::operator=(GlobalIOField<Type>&& rhs)
{
Field<Type>::operator=(move(rhs));
}
template<class Type>
void Foam::GlobalIOField<Type>::operator=(const Field<Type>& rhs)
{
Field<Type>::operator=(rhs);
}
template<class Type>
void Foam::GlobalIOField<Type>::operator=(Field<Type>&& rhs)
{
Field<Type>::operator=(move(rhs));
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,17 +25,14 @@ Class
Foam::GlobalIOField
Description
IOField with global data (so optionally read from master)
SourceFiles
GlobalIOField.C
A primitive field of type \<Type\> with automated input and output.
\*---------------------------------------------------------------------------*/
#ifndef GlobalIOField_H
#define GlobalIOField_H
#include "regIOobject.H"
#include "GlobalIOList.H"
#include "Field.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -50,62 +47,25 @@ namespace Foam
template<class Type>
class GlobalIOField
:
public regIOobject,
public Field<Type>
public GlobalIOListBase<Field, GlobalIOField, Type>
{
public:
//- Runtime type information
TypeName("Field");
// Constructors
//- Construct from IOobject
GlobalIOField(const IOobject&);
//- Construct from IOobject and size (does not set values)
GlobalIOField(const IOobject&, const label size);
//- Construct from components
GlobalIOField(const IOobject&, const Field<Type>&);
//- Move construct by transferring the Field contents
GlobalIOField(const IOobject&, Field<Type>&&);
//- Copy constructor
GlobalIOField(const GlobalIOField<Type>&);
//- Move constructor
GlobalIOField(GlobalIOField<Type>&&);
//- Destructor
virtual ~GlobalIOField();
// Member Functions
//- Is object global
virtual bool global() const
{
return true;
}
//- ReadData function required for regIOobject read operation
virtual bool readData(Istream&);
//- WriteData function required for regIOobject write operation
bool writeData(Ostream&) const;
//- Inherit constructors
using GlobalIOListBase<Field, GlobalIOField, Type>::GlobalIOListBase;
// Member Operators
void operator=(const GlobalIOField<Type>&);
void operator=(GlobalIOField<Type>&&);
void operator=(const Field<Type>&);
void operator=(Field<Type>&&);
//- Inherit assignment operators
using GlobalIOListBase<Field, GlobalIOField, Type>::operator=;
};
@ -115,12 +75,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "GlobalIOField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,45 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "GlobalIOFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameWithName(labelGlobalIOField, "labelField");
defineTemplateTypeNameWithName(scalarGlobalIOField, "scalarField");
defineTemplateTypeNameWithName(vectorGlobalIOField, "vectorField");
defineTemplateTypeNameWithName
(
sphericalTensorGlobalIOField,
"sphericalTensorField"
);
defineTemplateTypeNameWithName(symmTensorGlobalIOField, "symmTensorField");
defineTemplateTypeNameWithName(tensorGlobalIOField, "tensorField");
}
// ************************************************************************* //

View File

@ -1,74 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "primitiveFields.H"
#include "GlobalIOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef GlobalIOField<label> labelGlobalIOField;
typedef GlobalIOField<scalar> scalarGlobalIOField;
typedef GlobalIOField<vector> vectorGlobalIOField;
typedef GlobalIOField<sphericalTensor> sphericalTensorGlobalIOField;
typedef GlobalIOField<symmTensor> symmTensorGlobalIOField;
typedef GlobalIOField<tensor> tensorGlobalIOField;
//- Template function for obtaining global status
template<>
inline bool typeGlobal<labelGlobalIOField>()
{
return true;
}
template<>
inline bool typeGlobal<scalarGlobalIOField>()
{
return true;
}
template<>
inline bool typeGlobal<vectorGlobalIOField>()
{
return true;
}
template<>
inline bool typeGlobal<sphericalTensorGlobalIOField>()
{
return true;
}
template<>
inline bool typeGlobal<symmTensorGlobalIOField>()
{
return true;
}
template<>
inline bool typeGlobal<tensorGlobalIOField>()
{
return true;
}
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -27,107 +27,169 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::GlobalIOList<Type>::GlobalIOList(const IOobject& io)
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
Foam::GlobalIOListBase<Container, IOContainer, Type>::GlobalIOListBase
(
const IOobject& io
)
:
regIOobject(io)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<GlobalIOList<Type>>();
warnNoRereading<IOContainer<Type>>();
readHeaderOk(IOstream::BINARY, typeName);
readHeaderOk(IOstream::BINARY, IOContainer<Type>::typeName);
}
template<class Type>
Foam::GlobalIOList<Type>::GlobalIOList(const IOobject& io, const label size)
:
regIOobject(io)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<GlobalIOList<Type>>();
if (!readHeaderOk(IOstream::BINARY, typeName))
{
List<Type>::setSize(size);
}
}
template<class Type>
Foam::GlobalIOList<Type>::GlobalIOList(const IOobject& io, const List<Type>& f)
:
regIOobject(io)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<GlobalIOList<Type>>();
if (!readHeaderOk(IOstream::BINARY, typeName))
{
List<Type>::operator=(f);
}
}
template<class Type>
Foam::GlobalIOList<Type>::GlobalIOList
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
Foam::GlobalIOListBase<Container, IOContainer, Type>::GlobalIOListBase
(
const IOobject& io,
List<Type>&& f
const label size
)
:
regIOobject(io)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<IOContainer<Type>>();
if (!readHeaderOk(IOstream::BINARY, IOContainer<Type>::typeName))
{
Container<Type>::setSize(size);
}
}
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
Foam::GlobalIOListBase<Container, IOContainer, Type>::GlobalIOListBase
(
const IOobject& io,
const Container<Type>& f
)
:
regIOobject(io)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<IOContainer<Type>>();
if (!readHeaderOk(IOstream::BINARY, IOContainer<Type>::typeName))
{
Container<Type>::operator=(f);
}
}
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
Foam::GlobalIOListBase<Container, IOContainer, Type>::GlobalIOListBase
(
const IOobject& io,
Container<Type>&& f
)
:
regIOobject(io),
List<Type>(move(f))
Container<Type>(move(f))
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<GlobalIOList<Type>>();
warnNoRereading<IOContainer<Type>>();
readHeaderOk(IOstream::BINARY, typeName);
readHeaderOk(IOstream::BINARY, IOContainer<Type>::typeName);
}
template<class Type>
Foam::GlobalIOList<Type>::GlobalIOList
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
Foam::GlobalIOListBase<Container, IOContainer, Type>::GlobalIOListBase
(
const GlobalIOList<Type>& field
const GlobalIOListBase<Container, IOContainer, Type>& field
)
:
regIOobject(field),
List<Type>(field)
Container<Type>(field)
{}
template<class Type>
Foam::GlobalIOList<Type>::GlobalIOList
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
Foam::GlobalIOListBase<Container, IOContainer, Type>::GlobalIOListBase
(
GlobalIOList<Type>&& field
GlobalIOListBase<Container, IOContainer, Type>&& field
)
:
regIOobject(move(field)),
List<Type>(move(field))
Container<Type>(move(field))
{}
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class Type>
Foam::GlobalIOList<Type>::~GlobalIOList()
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
Foam::GlobalIOListBase<Container, IOContainer, Type>::~GlobalIOListBase()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
bool Foam::GlobalIOList<Type>::readData(Istream& is)
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
bool Foam::GlobalIOListBase<Container, IOContainer, Type>::readData
(
Istream& is
)
{
is >> *this;
return is.good();
}
template<class Type>
bool Foam::GlobalIOList<Type>::writeData(Ostream& os) const
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
bool Foam::GlobalIOListBase<Container, IOContainer, Type>::writeData
(
Ostream& os
) const
{
return (os << *this).good();
}
@ -135,31 +197,33 @@ bool Foam::GlobalIOList<Type>::writeData(Ostream& os) const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type>
void Foam::GlobalIOList<Type>::operator=(const GlobalIOList<Type>& rhs)
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
void Foam::GlobalIOListBase<Container, IOContainer, Type>::operator=
(
const GlobalIOListBase<Container, IOContainer, Type>& rhs
)
{
List<Type>::operator=(rhs);
Container<Type>::operator=(rhs);
}
template<class Type>
void Foam::GlobalIOList<Type>::operator=(GlobalIOList<Type>&& rhs)
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
void Foam::GlobalIOListBase<Container, IOContainer, Type>::operator=
(
GlobalIOListBase<Container, IOContainer, Type>&& rhs
)
{
List<Type>::operator=(move(rhs));
}
template<class Type>
void Foam::GlobalIOList<Type>::operator=(const List<Type>& rhs)
{
List<Type>::operator=(rhs);
}
template<class Type>
void Foam::GlobalIOList<Type>::operator=(List<Type>&& rhs)
{
List<Type>::operator=(move(rhs));
Container<Type>::operator=(move(rhs));
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,7 +25,7 @@ Class
Foam::GlobalIOList
Description
IOList with global data (so optionally read from master)
IOContainer with global data (so optionally read from master)
SourceFiles
GlobalIOList.C
@ -35,8 +35,8 @@ SourceFiles
#ifndef GlobalIOList_H
#define GlobalIOList_H
#include "List.H"
#include "regIOobject.H"
#include "List.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,44 +44,46 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class GlobalIOList Declaration
Class GlobalIOListBase Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class GlobalIOList
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
class GlobalIOListBase
:
public regIOobject,
public List<Type>
public Container<Type>
{
public:
TypeName("List");
// Constructors
//- Construct from IOobject
GlobalIOList(const IOobject&);
GlobalIOListBase(const IOobject&);
//- Construct from IOobject
GlobalIOList(const IOobject&, const label size);
//- Construct from IOobject and size (does not set values)
GlobalIOListBase(const IOobject&, const label size);
//- Construct from IOobject and a List
GlobalIOList(const IOobject&, const List<Type>&);
//- Construct from IOobject and a Container
GlobalIOListBase(const IOobject&, const Container<Type>&);
//- Move construct by transferring the List contents
GlobalIOList(const IOobject&, List<Type>&&);
//- Move construct by transferring the Container contents
GlobalIOListBase(const IOobject&, Container<Type>&&);
//- Copy constructor
GlobalIOList(const GlobalIOList<Type>&);
GlobalIOListBase(const GlobalIOListBase<Container, IOContainer, Type>&);
//- Move constructor
GlobalIOList(GlobalIOList<Type>&&);
GlobalIOListBase(GlobalIOListBase<Container, IOContainer, Type>&&);
//- Destructor
virtual ~GlobalIOList();
virtual ~GlobalIOListBase();
// Member Functions
@ -96,16 +98,47 @@ public:
virtual bool readData(Istream&);
//- WriteData function required for regIOobject write operation
bool writeData(Ostream&) const;
virtual bool writeData(Ostream&) const;
// Member Operators
//- Inherit assignment operators
using Container<Type>::operator=;
//- Assign to another GlobalIOList
void operator=(const GlobalIOListBase<Container, IOContainer, Type>&);
//- Move-assign to another GlobalIOList
void operator=(GlobalIOListBase<Container, IOContainer, Type>&&);
};
/*---------------------------------------------------------------------------*\
Class GlobalIOList Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class GlobalIOList
:
public GlobalIOListBase<List, GlobalIOList, Type>
{
public:
//- Runtime type information
TypeName("List");
// Constructors
//- Inherit constructors
using GlobalIOListBase<List, GlobalIOList, Type>::GlobalIOListBase;
// Member Operators
void operator=(const GlobalIOList<Type>&);
void operator=(GlobalIOList<Type>&&);
void operator=(const List<Type>&);
void operator=(List<Type>&&);
//- Inherit assignment operators
using GlobalIOListBase<List, GlobalIOList, Type>::operator=;
};

View File

@ -1,45 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "GlobalIOLists.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameWithName(labelGlobalIOList, "labelList");
defineTemplateTypeNameWithName(scalarGlobalIOList, "scalarList");
defineTemplateTypeNameWithName(vectorGlobalIOList, "vectorList");
defineTemplateTypeNameWithName
(
sphericalTensorGlobalIOList,
"sphericalTensorList"
);
defineTemplateTypeNameWithName(symmTensorGlobalIOList, "symmTensorList");
defineTemplateTypeNameWithName(tensorGlobalIOList, "tensorList");
defineTemplateTypeNameWithName(wordGlobalIOList, "wordList");
}
// ************************************************************************* //

View File

@ -1,93 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::GlobalIOLists
Description
Typedefs for GlobalIOLists of primitive types. These are fully compatible
with 'normal' IOLists except have global files.
\*---------------------------------------------------------------------------*/
#ifndef GlobalIOLists_H
#define GlobalIOLists_H
#include "primitiveFields.H"
#include "GlobalIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef GlobalIOList<label> labelGlobalIOList;
typedef GlobalIOList<scalar> scalarGlobalIOList;
typedef GlobalIOList<vector> vectorGlobalIOList;
typedef GlobalIOList<sphericalTensor> sphericalTensorGlobalIOList;
typedef GlobalIOList<symmTensor> symmTensorGlobalIOList;
typedef GlobalIOList<tensor> tensorGlobalIOList;
typedef GlobalIOList<word> wordGlobalIOList;
//- Template function for obtaining global status
template<>
inline bool typeGlobal<labelGlobalIOList>()
{
return true;
}
template<>
inline bool typeGlobal<scalarGlobalIOList>()
{
return true;
}
template<>
inline bool typeGlobal<vectorGlobalIOList>()
{
return true;
}
template<>
inline bool typeGlobal<sphericalTensorGlobalIOList>()
{
return true;
}
template<>
inline bool typeGlobal<symmTensorGlobalIOList>()
{
return true;
}
template<>
inline bool typeGlobal<tensorGlobalIOList>()
{
return true;
}
template<>
inline bool typeGlobal<wordGlobalIOList>()
{
return true;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -28,221 +28,15 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::IOField<Type>::IOField(const IOobject& io)
Foam::IOField<Type>::IOField
(
const IOobject& io,
const tmp<Field<Type>>& f
)
:
regIOobject(io)
IOField(io, f())
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<IOField<Type>>();
if
(
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readStream(typeName) >> *this;
close();
}
}
template<class Type>
Foam::IOField<Type>::IOField(const IOobject& io, const bool read)
:
regIOobject(io)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<IOField<Type>>();
if
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
{
Istream& is = readStream(typeName, read);
if (read)
{
is >> *this;
}
close();
}
else if (io.readOpt() == IOobject::READ_IF_PRESENT)
{
bool haveFile = headerOk();
Istream& is = readStream(typeName, haveFile && read);
if (read && haveFile)
{
is >> *this;
}
close();
}
}
template<class Type>
Foam::IOField<Type>::IOField(const IOobject& io, const label size)
:
regIOobject(io)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<IOField<Type>>();
if
(
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readStream(typeName) >> *this;
close();
}
else
{
Field<Type>::setSize(size);
}
}
template<class Type>
Foam::IOField<Type>::IOField(const IOobject& io, const Field<Type>& f)
:
regIOobject(io),
Field<Type>(f)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<IOField<Type>>();
if
(
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readStream(typeName) >> *this;
close();
}
}
template<class Type>
Foam::IOField<Type>::IOField(const IOobject& io, Field<Type>&& f)
:
regIOobject(io),
Field<Type>(move(f))
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<IOField<Type>>();
if
(
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readStream(typeName) >> *this;
close();
}
}
template<class Type>
Foam::IOField<Type>::IOField(const IOobject& io, const tmp<Field<Type>>& f)
:
regIOobject(io),
Field<Type>(f)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<IOField<Type>>();
if
(
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readStream(typeName) >> *this;
close();
}
}
template<class Type>
Foam::IOField<Type>::IOField(IOField<Type>&& f)
:
regIOobject(move(f)),
Field<Type>(move(f))
{}
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class Type>
Foam::IOField<Type>::~IOField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
bool Foam::IOField<Type>::writeData(Ostream& os) const
{
return (os << static_cast<const Field<Type>&>(*this)).good();
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type>
void Foam::IOField<Type>::operator=(const IOField<Type>& rhs)
{
Field<Type>::operator=(rhs);
}
template<class Type>
void Foam::IOField<Type>::operator=(IOField<Type>&& rhs)
{
Field<Type>::operator=(move(rhs));
}
template<class Type>
void Foam::IOField<Type>::operator=(const Field<Type>& rhs)
{
Field<Type>::operator=(rhs);
}
template<class Type>
void Foam::IOField<Type>::operator=(Field<Type>&& rhs)
{
Field<Type>::operator=(move(rhs));
}
template<class Type>
void Foam::IOField<Type>::operator=(const tmp<Field<Type>>& rhs)
{
Field<Type>::operator=(rhs);
f.clear();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,7 +25,7 @@ Class
Foam::IOField
Description
A primitive field of type \<T\> with automated input and output.
A primitive field of type \<Type\> with automated input and output.
SourceFiles
IOField.C
@ -35,7 +35,7 @@ SourceFiles
#ifndef IOField_H
#define IOField_H
#include "regIOobject.H"
#include "IOList.H"
#include "Field.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -50,56 +50,28 @@ namespace Foam
template<class Type>
class IOField
:
public regIOobject,
public Field<Type>
public IOListBase<Field, IOField, Type>
{
public:
//- Runtime type information
TypeName("Field");
// Constructors
//- Construct from IOobject
IOField(const IOobject&);
//- Inherit constructors
using IOListBase<Field, IOField, Type>::IOListBase;
//- Construct from IOobject; does local processor require reading?
IOField(const IOobject&, const bool read);
//- Construct from IOobject and size (does not set values)
IOField(const IOobject&, const label size);
//- Construct from components
IOField(const IOobject&, const Field<Type>&);
//- Move construct by transferring the Field contents
IOField(const IOobject&, Field<Type>&&);
//- Move construct by transferring the Field contents
//- Move construct by transferring the Container contents
IOField(const IOobject&, const tmp<Field<Type>>&);
//- Move constructor
IOField(IOField<Type>&&);
//- Destructor
virtual ~IOField();
// Member Functions
bool writeData(Ostream&) const;
// Member Operators
void operator=(const IOField<Type>&);
void operator=(IOField<Type>&&);
void operator=(const Field<Type>&);
void operator=(Field<Type>&&);
void operator=(const tmp<Field<Type>>&);
//- Inherit assignment operators
using IOListBase<Field, IOField, Type>::operator=;
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,15 +25,23 @@ License
#include "IOList.H"
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class T>
Foam::IOList<T>::IOList(const IOobject& io)
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
Foam::IOListBase<Container, IOContainer, Type>::IOListBase(const IOobject& io)
:
regIOobject(io)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<IOList<T>>();
if (!IOContainer<Type>::rereading)
{
warnNoRereading<IOContainer<Type>>();
}
if
(
@ -44,19 +52,94 @@ Foam::IOList<T>::IOList(const IOobject& io)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readStream(typeName) >> *this;
// For if MUST_READ_IF_MODIFIED
if (IOContainer<Type>::rereading)
{
addWatch();
}
readStream(IOContainer<Type>::typeName) >> *this;
close();
}
}
template<class T>
Foam::IOList<T>::IOList(const IOobject& io, const label size)
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
Foam::IOListBase<Container, IOContainer, Type>::IOListBase
(
const IOobject& io,
const bool read
)
:
regIOobject(io)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<IOList<T>>();
if (!IOContainer<Type>::rereading)
{
warnNoRereading<IOContainer<Type>>();
}
if
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
{
// For if MUST_READ_IF_MODIFIED
if (IOContainer<Type>::rereading)
{
addWatch();
}
Istream& is = readStream(IOContainer<Type>::typeName, read);
if (read)
{
is >> *this;
}
close();
}
else if (io.readOpt() == IOobject::READ_IF_PRESENT)
{
bool haveFile = headerOk();
Istream& is = readStream(IOContainer<Type>::typeName, haveFile && read);
if (read && haveFile)
{
is >> *this;
}
close();
}
}
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
Foam::IOListBase<Container, IOContainer, Type>::IOListBase
(
const IOobject& io,
const label size
)
:
regIOobject(io)
{
// Check for MUST_READ_IF_MODIFIED
if (!IOContainer<Type>::rereading)
{
warnNoRereading<IOContainer<Type>>();
}
if
(
@ -67,23 +150,41 @@ Foam::IOList<T>::IOList(const IOobject& io, const label size)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readStream(typeName) >> *this;
// For if MUST_READ_IF_MODIFIED
if (IOContainer<Type>::rereading)
{
addWatch();
}
readStream(IOContainer<Type>::typeName) >> *this;
close();
}
else
{
List<T>::setSize(size);
Container<Type>::setSize(size);
}
}
template<class T>
Foam::IOList<T>::IOList(const IOobject& io, const List<T>& list)
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
Foam::IOListBase<Container, IOContainer, Type>::IOListBase
(
const IOobject& io,
const Container<Type>& l
)
:
regIOobject(io)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<IOList<T>>();
if (!IOContainer<Type>::rereading)
{
warnNoRereading<IOContainer<Type>>();
}
if
(
@ -94,24 +195,42 @@ Foam::IOList<T>::IOList(const IOobject& io, const List<T>& list)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readStream(typeName) >> *this;
// For if MUST_READ_IF_MODIFIED
if (IOContainer<Type>::rereading)
{
addWatch();
}
readStream(IOContainer<Type>::typeName) >> *this;
close();
}
else
{
List<T>::operator=(list);
Container<Type>::operator=(l);
}
}
template<class T>
Foam::IOList<T>::IOList(const IOobject& io, List<T>&& list)
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
Foam::IOListBase<Container, IOContainer, Type>::IOListBase
(
const IOobject& io,
Container<Type>&& l
)
:
regIOobject(io),
List<T>(move(list))
Container<Type>(move(l))
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<IOList<T>>();
if (!IOContainer<Type>::rereading)
{
warnNoRereading<IOContainer<Type>>();
}
if
(
@ -122,72 +241,108 @@ Foam::IOList<T>::IOList(const IOobject& io, List<T>&& list)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readStream(typeName) >> *this;
// For if MUST_READ_IF_MODIFIED
if (IOContainer<Type>::rereading)
{
addWatch();
}
readStream(IOContainer<Type>::typeName) >> *this;
close();
}
}
template<class T>
Foam::IOList<T>::IOList(const IOList<T>& f)
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
Foam::IOListBase<Container, IOContainer, Type>::IOListBase
(
const IOListBase<Container, IOContainer, Type>& f
)
:
regIOobject(f),
List<T>(f)
Container<Type>(f)
{}
template<class T>
Foam::IOList<T>::IOList(IOList<T>&& f)
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
Foam::IOListBase<Container, IOContainer, Type>::IOListBase
(
IOListBase<Container, IOContainer, Type>&& f
)
:
regIOobject(move(f)),
List<T>(move(f))
Container<Type>(move(f))
{}
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class T>
Foam::IOList<T>::~IOList()
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
Foam::IOListBase<Container, IOContainer, Type>::~IOListBase()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T>
bool Foam::IOList<T>::writeData(Ostream& os) const
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
bool Foam::IOListBase<Container, IOContainer, Type>::writeData
(
Ostream& os
) const
{
return (os << *this).good();
return (os << static_cast<const Container<Type>&>(*this)).good();
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class T>
void Foam::IOList<T>::operator=(const IOList<T>& rhs)
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
void Foam::IOListBase<Container, IOContainer, Type>::operator=
(
const IOListBase<Container, IOContainer, Type>& rhs
)
{
List<T>::operator=(rhs);
Container<Type>::operator=(rhs);
}
template<class T>
void Foam::IOList<T>::operator=(IOList<T>&& rhs)
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
void Foam::IOListBase<Container, IOContainer, Type>::operator=
(
IOListBase<Container, IOContainer, Type>&& rhs
)
{
List<T>::operator=(move(rhs));
}
template<class T>
void Foam::IOList<T>::operator=(const List<T>& rhs)
{
List<T>::operator=(rhs);
}
template<class T>
void Foam::IOList<T>::operator=(List<T>&& rhs)
{
List<T>::operator=(move(rhs));
Container<Type>::operator=(move(rhs));
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,7 +25,7 @@ Class
Foam::IOList
Description
A List of objects of type \<T\> with automated input and output.
A List of objects of type \<Type\> with automated input and output.
SourceFiles
IOList.C
@ -35,23 +35,93 @@ SourceFiles
#ifndef IOList_H
#define IOList_H
#include "List.H"
#include "regIOobject.H"
#include "List.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class IOListBase Declaration
\*---------------------------------------------------------------------------*/
template
<
template<class> class Container,
template<class> class IOContainer,
class Type
>
class IOListBase
:
public regIOobject,
public Container<Type>
{
public:
// Public Static Data
//- Does this object support re-reading?
static const bool rereading = false;
// Constructors
//- Construct from IOobject
IOListBase(const IOobject&);
//- Construct from IOobject; does local processor require reading?
IOListBase(const IOobject&, const bool read);
//- Construct from IOobject and size (does not set values)
IOListBase(const IOobject&, const label size);
//- Construct from IOobject and a Container
IOListBase(const IOobject&, const Container<Type>&);
//- Move construct by transferring the Container contents
IOListBase(const IOobject&, Container<Type>&&);
//- Copy constructor
IOListBase(const IOListBase<Container, IOContainer, Type>&);
//- Move constructor
IOListBase(IOListBase<Container, IOContainer, Type>&&);
//- Destructor
virtual ~IOListBase();
// Member Functions
//- WriteData function required for regIOobject write operation
virtual bool writeData(Ostream&) const;
// Member Operators
//- Inherit assignment operators
using Container<Type>::operator=;
//- Assign to another IOList
void operator=(const IOListBase<Container, IOContainer, Type>&);
//- Move-assign to another IOList
void operator=(IOListBase<Container, IOContainer, Type>&&);
};
/*---------------------------------------------------------------------------*\
Class IOList Declaration
\*---------------------------------------------------------------------------*/
template<class T>
template<class Type>
class IOList
:
public regIOobject,
public List<T>
public IOListBase<List, IOList, Type>
{
public:
@ -62,41 +132,14 @@ public:
// Constructors
//- Construct from IOobject
IOList(const IOobject&);
//- Construct from IOobject and size of IOList
IOList(const IOobject&, const label);
//- Construct from IOobject and a List
IOList(const IOobject&, const List<T>&);
//- Move construct by transferring the List contents
IOList(const IOobject&, List<T>&&);
//- Copy constructor
IOList(const IOList<T>&);
//- Move constructor
IOList(IOList<T>&&);
//- Destructor
virtual ~IOList();
// Member Functions
bool writeData(Ostream&) const;
//- Inherit constructors
using IOListBase<List, IOList, Type>::IOListBase;
// Member Operators
void operator=(const IOList<T>&);
void operator=(IOList<T>&&);
void operator=(const List<T>&);
void operator=(List<T>&&);
//- Inherit assignment operators
using IOListBase<List, IOList, Type>::operator=;
};

View File

@ -1,184 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "IOMap.H"
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
template<class T>
Foam::IOMap<T>::IOMap(const IOobject& io)
:
regIOobject(io)
{
if
(
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
// For if MUST_READ_IF_MODIFIED
addWatch();
readStream(typeName) >> *this;
close();
}
}
template<class T>
Foam::IOMap<T>::IOMap(const IOobject& io, const label size)
:
regIOobject(io)
{
if
(
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
// For if MUST_READ_IF_MODIFIED
addWatch();
readStream(typeName) >> *this;
close();
}
else
{
Map<T>::setSize(size);
}
}
template<class T>
Foam::IOMap<T>::IOMap(const IOobject& io, const Map<T>& map)
:
regIOobject(io)
{
if
(
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
// For if MUST_READ_IF_MODIFIED
addWatch();
readStream(typeName) >> *this;
close();
}
else
{
Map<T>::operator=(map);
}
}
template<class T>
Foam::IOMap<T>::IOMap(const IOobject& io, Map<T>&& map)
:
regIOobject(io),
Map<T>(move(map))
{
if
(
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
// For if MUST_READ_IF_MODIFIED
addWatch();
readStream(typeName) >> *this;
close();
}
}
template<class T>
Foam::IOMap<T>::IOMap(IOMap<T>&& map)
:
regIOobject(move(map)),
Map<T>(move(map))
{}
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class T>
Foam::IOMap<T>::~IOMap()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T>
bool Foam::IOMap<T>::writeData(Ostream& os) const
{
return (os << *this).good();
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class T>
void Foam::IOMap<T>::operator=(const IOMap<T>& rhs)
{
Map<T>::operator=(rhs);
}
template<class T>
void Foam::IOMap<T>::operator=(IOMap<T>&& rhs)
{
Map<T>::operator=(move(rhs));
}
template<class T>
void Foam::IOMap<T>::operator=(const Map<T>& rhs)
{
Map<T>::operator=(rhs);
}
template<class T>
void Foam::IOMap<T>::operator=(Map<T>&& rhs)
{
Map<T>::operator=(move(rhs));
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,19 +25,16 @@ Class
Foam::IOMap
Description
A Map of objects of type \<T\> with automated input and output.
A Map of objects of type \<Type\> with automated input and output.
Is a global object; i.e. can be read from undecomposed case.
SourceFiles
IOMap.C
\*---------------------------------------------------------------------------*/
#ifndef IOMap_H
#define IOMap_H
#include "IOList.H"
#include "Map.H"
#include "regIOobject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -48,65 +45,35 @@ namespace Foam
Class IOMap Declaration
\*---------------------------------------------------------------------------*/
template<class T>
template<class Type>
class IOMap
:
public regIOobject,
public Map<T>
public IOListBase<Map, IOMap, Type>
{
public:
// Public Static Data
//- Does this object support re-reading?
static const bool rereading = true;
//- Runtime type information
TypeName("Map");
// Constructors
//- Construct from IOobject
IOMap(const IOobject&);
//- Construct from IOobject and size of Map
IOMap(const IOobject&, const label);
//- Construct from IOobject and a Map
IOMap(const IOobject&, const Map<T>&);
//- Move construct by transferring the Map contents
IOMap(const IOobject&, Map<T>&&);
//- Move constructor
IOMap(IOMap<T>&&);
//- Destructor
virtual ~IOMap();
// Member Functions
bool writeData(Ostream&) const;
//- Is object global
virtual bool global() const
{
return true;
}
//- Inherit constructors
using IOListBase<Map, IOMap, Type>::IOListBase;
// Member Operators
//- Assignment of other IOMap's entries to this IOMap
void operator=(const IOMap<T>&);
//- Inherit assignment operators
using IOListBase<Map, IOMap, Type>::operator=;
//- Move assignment of other IOMap's entries to this IOMap
void operator=(IOMap<T>&&);
//- Assignment of other Map's entries to this IOMap
void operator=(const Map<T>&);
//- Move assignment of other Map's entries to this IOMap
void operator=(Map<T>&&);
};
@ -116,12 +83,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "IOMap.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -27,9 +27,9 @@ License
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
template<class T>
template<class Type>
template<class INew>
Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const INew& inewt)
Foam::IOPtrList<Type>::IOPtrList(const IOobject& io, const INew& iNew)
:
regIOobject(io)
{
@ -39,145 +39,16 @@ Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const INew& inewt)
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|| (io.readOpt() == IOobject::READ_IF_PRESENT && this->headerOk())
)
{
// For if MUST_READ_IF_MODIFIED
addWatch();
this->addWatch();
PtrList<T>::read(readStream(typeName), inewt);
close();
PtrList<Type>::read(this->readStream(IOPtrList<Type>::typeName), iNew);
this->close();
}
}
template<class T>
Foam::IOPtrList<T>::IOPtrList(const IOobject& io)
:
regIOobject(io)
{
if
(
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
// For if MUST_READ_IF_MODIFIED
addWatch();
PtrList<T>::read(readStream(typeName), INew<T>());
close();
}
}
template<class T>
Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const label s)
:
regIOobject(io),
PtrList<T>(s)
{
if (io.readOpt() != IOobject::NO_READ)
{
FatalErrorInFunction
<< "NO_READ must be set if specifying size" << nl
<< exit(FatalError);
}
}
template<class T>
Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const PtrList<T>& list)
:
regIOobject(io)
{
if
(
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
// For if MUST_READ_IF_MODIFIED
addWatch();
PtrList<T>::read(readStream(typeName), INew<T>());
close();
}
else
{
PtrList<T>::operator=(list);
}
}
template<class T>
Foam::IOPtrList<T>::IOPtrList(const IOobject& io, PtrList<T>&& list)
:
regIOobject(io),
PtrList<T>(move(list))
{
if
(
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
// For if MUST_READ_IF_MODIFIED
addWatch();
PtrList<T>::read(readStream(typeName), INew<T>());
close();
}
}
template<class T>
Foam::IOPtrList<T>::IOPtrList(IOPtrList<T>&& list)
:
regIOobject(move(list)),
PtrList<T>(move(list))
{}
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class T>
Foam::IOPtrList<T>::~IOPtrList()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T>
bool Foam::IOPtrList<T>::writeData(Ostream& os) const
{
return (os << *this).good();
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class T>
void Foam::IOPtrList<T>::operator=(const IOPtrList<T>& rhs)
{
PtrList<T>::operator=(rhs);
}
template<class T>
void Foam::IOPtrList<T>::operator=(IOPtrList<T>&& rhs)
{
PtrList<T>::operator=(move(rhs));
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,7 +25,7 @@ Class
Foam::IOPtrList
Description
A PtrList of objects of type \<T\> with automated input and output.
A PtrList of objects of type \<Type\> with automated input and output.
SourceFiles
IOPtrList.C
@ -35,8 +35,8 @@ SourceFiles
#ifndef IOPtrList_H
#define IOPtrList_H
#include "IOList.H"
#include "PtrList.H"
#include "regIOobject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -47,54 +47,38 @@ namespace Foam
Class IOPtrList Declaration
\*---------------------------------------------------------------------------*/
template<class T>
template<class Type>
class IOPtrList
:
public regIOobject,
public PtrList<T>
public IOListBase<PtrList, IOPtrList, Type>
{
public:
// Public Static Data
//- Does this object support re-reading?
static const bool rereading = true;
//- Runtime type information
TypeName("PtrList");
// Constructors
//- Inherit constructors
using IOListBase<PtrList, IOPtrList, Type>::IOListBase;
//- Construct from IOobject using given Istream constructor class
template<class INew>
IOPtrList(const IOobject&, const INew&);
//- Construct from IOobject
IOPtrList(const IOobject&);
//- Construct from IOobject with given size
IOPtrList(const IOobject&, const label);
//- Construct from IOobject and a PtrList
IOPtrList(const IOobject&, const PtrList<T>&);
//- Move construct by transferring the PtrList contents
IOPtrList(const IOobject&, PtrList<T>&&);
//- Move constructor
IOPtrList(IOPtrList<T>&&);
//- Destructor
virtual ~IOPtrList();
// Member Functions
bool writeData(Ostream&) const;
// Member Operators
void operator=(const IOPtrList<T>&);
void operator=(IOPtrList<T>&&);
//- Inherit assignment operators
using IOListBase<PtrList, IOPtrList, Type>::operator=;
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,8 +40,7 @@ Description
namespace Foam
{
typedef IOField<diagTensorField> diagTensorFieldIOField;
typedef CompactIOField<diagTensorField, diagTensor>
diagTensorFieldCompactIOField;
typedef CompactIOField<diagTensorField> diagTensorFieldCompactIOField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -41,7 +41,7 @@ Description
namespace Foam
{
typedef IOField<labelField> labelFieldIOField;
typedef CompactIOField<labelField, label> labelFieldCompactIOField;
typedef CompactIOField<labelField> labelFieldCompactIOField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,7 +40,7 @@ Description
namespace Foam
{
typedef IOField<scalarField> scalarFieldIOField;
typedef CompactIOField<scalarField, scalar> scalarFieldCompactIOField;
typedef CompactIOField<scalarField> scalarFieldCompactIOField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -33,6 +33,12 @@ Description
namespace Foam
{
defineTemplateTypeNameAndDebugWithName(scalarIOField, "scalarField", 0);
defineTemplateTypeNameAndDebugWithName
(
scalarGlobalIOField,
"scalarField",
0
);
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -34,12 +34,14 @@ Description
#include "scalarField.H"
#include "IOField.H"
#include "GlobalIOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOField<scalar> scalarIOField;
typedef GlobalIOField<scalar> scalarGlobalIOField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -41,7 +41,7 @@ namespace Foam
{
typedef IOField<sphericalTensorField> sphericalTensorFieldIOField;
typedef CompactIOField<sphericalTensorField, sphericalTensor>
typedef CompactIOField<sphericalTensorField>
sphericalTensorFieldCompactIOField;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,8 +40,7 @@ Description
namespace Foam
{
typedef IOField<symmTensorField> symmTensorFieldIOField;
typedef CompactIOField<symmTensorField, symmTensor>
symmTensorFieldCompactIOField;
typedef CompactIOField<symmTensorField> symmTensorFieldCompactIOField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,7 +40,7 @@ Description
namespace Foam
{
typedef IOField<tensorField> tensorFieldIOField;
typedef CompactIOField<tensorField, tensor> tensorFieldCompactIOField;
typedef CompactIOField<tensorField> tensorFieldCompactIOField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,7 +40,7 @@ Description
namespace Foam
{
typedef IOField<vector2DField> vector2DFieldIOField;
typedef CompactIOField<vector2DField, vector2D> vector2DFieldCompactIOField;
typedef CompactIOField<vector2DField> vector2DFieldCompactIOField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,7 +40,7 @@ Description
namespace Foam
{
typedef IOField<vectorField> vectorFieldIOField;
typedef CompactIOField<vectorField, vector> vectorFieldCompactIOField;
typedef CompactIOField<vectorField> vectorFieldCompactIOField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -33,6 +33,12 @@ Description
namespace Foam
{
defineTemplateTypeNameAndDebugWithName(vectorIOField, "vectorField", 0);
defineTemplateTypeNameAndDebugWithName
(
vectorGlobalIOField,
"vectorField",
0
);
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -34,12 +34,14 @@ Description
#include "vectorField.H"
#include "IOField.H"
#include "GlobalIOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOField<vector> vectorIOField;
typedef GlobalIOField<vector> vectorGlobalIOField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,7 +40,7 @@ Description
namespace Foam
{
typedef IOList<cell> cellIOList;
typedef CompactIOList<cell, label> cellCompactIOList;
typedef CompactIOList<cell> cellCompactIOList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,7 +40,7 @@ Description
namespace Foam
{
typedef IOList<edge> edgeIOList;
typedef CompactIOList<edge, label> edgeCompactIOList;
typedef CompactIOList<edge> edgeCompactIOList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -41,7 +41,7 @@ Description
namespace Foam
{
typedef IOList<face> faceIOList;
typedef CompactIOList<face, label> faceCompactIOList;
typedef CompactIOList<face> faceCompactIOList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,7 +40,7 @@ Description
namespace Foam
{
typedef IOList<scalarList> scalarListIOList;
typedef CompactIOList<scalarList, scalar> scalarListCompactIOList;
typedef CompactIOList<scalarList> scalarListCompactIOList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,7 +40,7 @@ Description
namespace Foam
{
typedef IOList<vectorList> vectorListIOList;
typedef CompactIOList<vectorList, vector> vectorListCompactIOList;
typedef CompactIOList<vectorList> vectorListCompactIOList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,7 +40,7 @@ Description
namespace Foam
{
typedef IOList<labelList> labelListIOList;
typedef CompactIOList<labelList, label> labelListCompactIOList;
typedef CompactIOList<labelList> labelListCompactIOList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -34,6 +34,7 @@ namespace Foam
addCompoundToRunTimeSelectionTable(List<word>, wordList);
defineTemplateTypeNameAndDebugWithName(wordIOList, "wordList", 0);
defineTemplateTypeNameAndDebugWithName(wordGlobalIOList, "wordList", 0);
defineTemplateTypeNameAndDebugWithName(wordListIOList, "wordListList", 0);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -34,12 +34,14 @@ Description
#include "wordList.H"
#include "IOList.H"
#include "GlobalIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOList<word> wordIOList;
typedef GlobalIOList<word> wordGlobalIOList;
typedef IOList<wordList> wordListIOList;
// Print word list list as a table

View File

@ -11,6 +11,7 @@ mergedCyclic/polyMeshUnMergeCyclics.C
meshTables/boundaryRegion.C
meshTables/cellTable.C
meshTables/dictionaryIOMap.C
meshReader/meshReader.C
meshReader/meshReaderAux.C

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -21,14 +21,25 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Map of dictionaries with IO
\*---------------------------------------------------------------------------*/
#include "IOMap.H"
#include "dictionary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebug(IOMap<dictionary>, 0);
defineTemplateTypeNameAndDebugWithName
(
IOMap<dictionary>,
"dictionaryIOMap",
0
);
}
// ************************************************************************* //

View File

@ -282,7 +282,7 @@ public:
void checkFieldFieldIOobject
(
const Cloud<ParticleType>& c,
const CompactIOField<Field<DataType>, DataType>& data
const CompactIOField<Field<DataType>>& data
) const;

View File

@ -208,7 +208,7 @@ template<class DataType>
void Foam::Cloud<ParticleType>::checkFieldFieldIOobject
(
const Cloud<ParticleType>& c,
const CompactIOField<Field<DataType>, DataType>& data
const CompactIOField<Field<DataType>>& data
) const
{
if (data.size() != c.size())

View File

@ -25,7 +25,7 @@ License
#include "parcelCloudList.H"
#include "extrapolatedCalculatedFvPatchFields.H"
#include "GlobalIOLists.H"
#include "wordIOList.H"
#include "fvMatrices.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //