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
(