Code simplification: GeometricField<Type, pointPatchField, pointMesh> -> PointField<Type>

Using the PointField<Type> partial specialisation of GeometricField<Type,
pointPatchField, pointMesh> simplified the code and improves readability.
This commit is contained in:
Henry Weller
2022-12-02 15:24:50 +00:00
parent 5f7993dab4
commit e84300d124
52 changed files with 179 additions and 184 deletions

View File

@ -121,7 +121,7 @@ void subsetPointFields
const fvMeshSubset& subsetter,
const pointMesh& pMesh,
const wordList& fieldNames,
PtrList<GeometricField<Type, pointPatchField, pointMesh>>& subFields
PtrList<PointField<Type>>& subFields
)
{
const fvMesh& baseMesh = subsetter.baseMesh();
@ -132,7 +132,7 @@ void subsetPointFields
Info<< "Subsetting field " << fieldName << endl;
GeometricField<Type, pointPatchField, pointMesh> fld
PointField<Type> fld
(
IOobject
(

View File

@ -145,10 +145,10 @@ public:
//- Decompose point field
template<class Type>
tmp<GeometricField<Type, pointPatchField, pointMesh>>
tmp<PointField<Type>>
decomposeField
(
const GeometricField<Type, pointPatchField, pointMesh>&
const PointField<Type>&
) const;
//- Decompose a list of fields

View File

@ -32,7 +32,7 @@ template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh>>
Foam::pointFieldDecomposer::decomposeField
(
const GeometricField<Type, pointPatchField, pointMesh>& field
const PointField<Type>& field
) const
{
// Create and map the internal field values
@ -73,9 +73,9 @@ Foam::pointFieldDecomposer::decomposeField
}
// Create the field for the processor
return tmp<GeometricField<Type, pointPatchField, pointMesh>>
return tmp<PointField<Type>>
(
new GeometricField<Type, pointPatchField, pointMesh>
new PointField<Type>
(
IOobject
(

View File

@ -114,7 +114,7 @@ public:
//- Reconstruct field
template<class Type>
tmp<GeometricField<Type, pointPatchField, pointMesh>>
tmp<PointField<Type>>
reconstructField(const IOobject& fieldIoObject);
//- Reconstruct and write all fields

View File

@ -32,7 +32,7 @@ Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh>>
Foam::pointFieldReconstructor::reconstructField(const IOobject& fieldIoObject)
{
// Read the field for all the processors
PtrList<GeometricField<Type, pointPatchField, pointMesh>> procFields
PtrList<PointField<Type>> procFields
(
procMeshes_.size()
);
@ -42,7 +42,7 @@ Foam::pointFieldReconstructor::reconstructField(const IOobject& fieldIoObject)
procFields.set
(
proci,
new GeometricField<Type, pointPatchField, pointMesh>
new PointField<Type>
(
IOobject
(
@ -67,7 +67,7 @@ Foam::pointFieldReconstructor::reconstructField(const IOobject& fieldIoObject)
forAll(procMeshes_, proci)
{
const GeometricField<Type, pointPatchField, pointMesh>&
const PointField<Type>&
procField = procFields[proci];
// Get processor-to-global addressing for use in rmap
@ -118,9 +118,9 @@ Foam::pointFieldReconstructor::reconstructField(const IOobject& fieldIoObject)
// Construct and write the field
// setting the internalField and patchFields
return tmp<GeometricField<Type, pointPatchField, pointMesh>>
return tmp<PointField<Type>>
(
new GeometricField<Type, pointPatchField, pointMesh>
new PointField<Type>
(
IOobject
(
@ -149,7 +149,7 @@ void Foam::pointFieldReconstructor::reconstructFields
{
word fieldClassName
(
GeometricField<Type, pointPatchField, pointMesh>::typeName
PointField<Type>::typeName
);
IOobjectList fields = objects.lookupClass(fieldClassName);

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
@ -533,7 +533,7 @@ void ensightField
template<class Type>
void ensightPointField
(
const GeometricField<Type, pointPatchField, pointMesh>& pf,
const PointField<Type>& pf,
const ensightMesh& eMesh,
const fileName& postProcPath,
const word& prepend,
@ -729,7 +729,7 @@ void ensightField
{
if (nodeValues)
{
tmp<GeometricField<Type, pointPatchField, pointMesh>> pfld
tmp<PointField<Type>> pfld
(
volPointInterpolation::New(vf.mesh()).interpolate(vf)
);

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
@ -123,7 +123,7 @@ public:
(
const UPtrList
<
const GeometricField<Type, pointPatchField, pointMesh>
const PointField<Type>
>&
);

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
@ -66,12 +66,12 @@ void Foam::patchWriter::write
template<class Type>
void Foam::patchWriter::write
(
const UPtrList<const GeometricField<Type, pointPatchField, pointMesh>>& flds
const UPtrList<const PointField<Type>>& flds
)
{
forAll(flds, fieldi)
{
const GeometricField<Type, pointPatchField, pointMesh>& fld =
const PointField<Type>& fld =
flds[fieldi];
os_ << fld.name() << ' ' << pTraits<Type>::nComponents << ' '

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
@ -68,7 +68,7 @@ namespace vtkWriteOps
(
std::ostream&,
const bool binary,
const GeometricField<Type, pointPatchField, pointMesh>&,
const PointField<Type>&,
const vtkMesh&
);
@ -80,7 +80,7 @@ namespace vtkWriteOps
std::ostream&,
const bool binary,
const GeometricField<Type, fvPatchField, volMesh>&,
const GeometricField<Type, pointPatchField, pointMesh>&,
const PointField<Type>&,
const vtkMesh&
);

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
@ -65,7 +65,7 @@ void Foam::vtkWriteOps::write
(
std::ostream& os,
const bool binary,
const GeometricField<Type, pointPatchField, pointMesh>& pvf,
const PointField<Type>& pvf,
const vtkMesh& vMesh
)
{
@ -98,7 +98,7 @@ void Foam::vtkWriteOps::write
std::ostream& os,
const bool binary,
const GeometricField<Type, fvPatchField, volMesh>& vvf,
const GeometricField<Type, pointPatchField, pointMesh>& pvf,
const PointField<Type>& pvf,
const vtkMesh& vMesh
)
{

View File

@ -535,7 +535,7 @@ class vtkPVFoam
void convertVolFieldBlock
(
const GeometricField<Type, fvPatchField, volMesh>&,
autoPtr<GeometricField<Type, pointPatchField, pointMesh>>&,
autoPtr<PointField<Type>>&,
vtkMultiBlockDataSet* output,
const arrayRange&,
const List<polyDecomp>& decompLst
@ -641,7 +641,7 @@ class vtkPVFoam
template<class Type>
void convertPointFieldBlock
(
const GeometricField<Type, pointPatchField, pointMesh>&,
const PointField<Type>&,
vtkMultiBlockDataSet* output,
const arrayRange&,
const List<polyDecomp>&
@ -651,7 +651,7 @@ class vtkPVFoam
template<class Type>
void convertPointField
(
const GeometricField<Type, pointPatchField, pointMesh>&,
const PointField<Type>&,
const GeometricField<Type, fvPatchField, volMesh>&,
vtkMultiBlockDataSet* output,
const arrayRange&,

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
@ -54,7 +54,7 @@ void Foam::vtkPVFoam::convertPointFields
if
(
iter()->headerClassName()
!= GeometricField<Type, pointPatchField, pointMesh>::typeName
!= PointField<Type>::typeName
)
{
continue;
@ -66,7 +66,7 @@ void Foam::vtkPVFoam::convertPointFields
<< fieldName << endl;
}
GeometricField<Type, pointPatchField, pointMesh> ptf
PointField<Type> ptf
(
*iter(),
pMesh
@ -172,7 +172,7 @@ void Foam::vtkPVFoam::convertPointFields
template<class Type>
void Foam::vtkPVFoam::convertPointFieldBlock
(
const GeometricField<Type, pointPatchField, pointMesh>& ptf,
const PointField<Type>& ptf,
vtkMultiBlockDataSet* output,
const arrayRange& range,
const List<polyDecomp>& decompLst
@ -201,7 +201,7 @@ void Foam::vtkPVFoam::convertPointFieldBlock
template<class Type>
void Foam::vtkPVFoam::convertPointField
(
const GeometricField<Type, pointPatchField, pointMesh>& ptf,
const PointField<Type>& ptf,
const GeometricField<Type, fvPatchField, volMesh>& tf,
vtkMultiBlockDataSet* output,
const arrayRange& range,

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
@ -73,7 +73,7 @@ void Foam::vtkPVFoam::convertVolFields
);
// Interpolated field (demand driven)
autoPtr<GeometricField<Type, pointPatchField, pointMesh>> ptfPtr;
autoPtr<PointField<Type>> ptfPtr;
if (interpFields)
{
if (debug)
@ -329,7 +329,7 @@ template<class Type>
void Foam::vtkPVFoam::convertVolFieldBlock
(
const GeometricField<Type, fvPatchField, volMesh>& tf,
autoPtr<GeometricField<Type, pointPatchField, pointMesh>>& ptfPtr,
autoPtr<PointField<Type>>& ptfPtr,
vtkMultiBlockDataSet* output,
const arrayRange& range,
const List<polyDecomp>& decompLst