Code simplification: GeometricField<Type, fvPatchField, volMesh> -> VolField<Type>

Using the VolField<Type> partial specialisation of
GeometricField<Type, fvPatchField, volMesh>
simplifies the code and improves readability.
This commit is contained in:
Henry Weller
2022-12-02 22:04:45 +00:00
parent fe368d5332
commit 2f4dd4fe27
274 changed files with 1796 additions and 1802 deletions

View File

@ -40,16 +40,16 @@ using namespace Foam;
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<VolField<Type>>
volField
(
const fvMeshSubset& meshSubsetter,
const GeometricField<Type, fvPatchField, volMesh>& vf
const VolField<Type>& vf
)
{
if (meshSubsetter.hasSubMesh())
{
tmp<GeometricField<Type, fvPatchField, volMesh>> tfld
tmp<VolField<Type>> tfld
(
meshSubsetter.interpolate(vf)
);
@ -300,7 +300,7 @@ void writePatchField
template<class Type>
void ensightField
(
const GeometricField<Type, fvPatchField, volMesh>& vf,
const VolField<Type>& vf,
const ensightMesh& eMesh,
const fileName& postProcPath,
const word& prepend,
@ -717,7 +717,7 @@ void ensightPointField
template<class Type>
void ensightField
(
const GeometricField<Type, fvPatchField, volMesh>& vf,
const VolField<Type>& vf,
const ensightMesh& eMesh,
const fileName& postProcPath,
const word& prepend,

View File

@ -229,7 +229,7 @@ void Foam::ensightVolField
partsList.writeField
(
os,
GeometricField<Type, fvPatchField, volMesh>
VolField<Type>
(
fieldObject,
mesh

View File

@ -123,7 +123,7 @@ public:
tmp<Field<Type>> getPatchField
(
const bool nearCellValue,
const GeometricField<Type, fvPatchField, volMesh>& vfld,
const VolField<Type>& vfld,
const label patchi
) const;

View File

@ -68,7 +68,7 @@ template<class Type>
Foam::tmp<Field<Type>> Foam::tecplotWriter::getPatchField
(
const bool nearCellValue,
const GeometricField<Type, fvPatchField, volMesh>& vfld,
const VolField<Type>& vfld,
const label patchi
) 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-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -104,7 +104,7 @@ public:
void write
(
const volPointInterpolation&,
const UPtrList<const GeometricField<Type, fvPatchField, volMesh>>&
const UPtrList<const VolField<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
@ -58,7 +58,7 @@ template<class Type>
void Foam::internalWriter::write
(
const volPointInterpolation& pInterp,
const UPtrList<const GeometricField<Type, fvPatchField, volMesh>>& flds
const UPtrList<const VolField<Type>>& flds
)
{
forAll(flds, i)

View File

@ -114,7 +114,7 @@ public:
template<class Type>
void write
(
const UPtrList<const GeometricField<Type, fvPatchField, volMesh>>&
const UPtrList<const VolField<Type>>&
);
//- Write pointFields
@ -132,7 +132,7 @@ public:
void write
(
const PrimitivePatchInterpolation<primitivePatch>&,
const UPtrList<const GeometricField<Type, fvPatchField, volMesh>>&
const UPtrList<const VolField<Type>>&
);
};

View File

@ -31,12 +31,12 @@ License
template<class Type>
void Foam::patchWriter::write
(
const UPtrList<const GeometricField<Type, fvPatchField, volMesh>>& flds
const UPtrList<const VolField<Type>>& flds
)
{
forAll(flds, fieldi)
{
const GeometricField<Type, fvPatchField, volMesh>& fld = flds[fieldi];
const VolField<Type>& fld = flds[fieldi];
os_ << fld.name() << ' ' << pTraits<Type>::nComponents << ' '
<< nFaces_ << " float" << std::endl;
@ -96,12 +96,12 @@ template<class Type>
void Foam::patchWriter::write
(
const PrimitivePatchInterpolation<primitivePatch>& pInter,
const UPtrList<const GeometricField<Type, fvPatchField, volMesh>>& flds
const UPtrList<const VolField<Type>>& flds
)
{
forAll(flds, fieldi)
{
const GeometricField<Type, fvPatchField, volMesh>& fld = flds[fieldi];
const VolField<Type>& fld = flds[fieldi];
os_ << fld.name() << ' ' << pTraits<Type>::nComponents << ' '
<< nPoints_ << " float" << std::endl;

View File

@ -79,7 +79,7 @@ namespace vtkWriteOps
(
std::ostream&,
const bool binary,
const GeometricField<Type, fvPatchField, volMesh>&,
const VolField<Type>&,
const PointField<Type>&,
const vtkMesh&
);
@ -101,7 +101,7 @@ namespace vtkWriteOps
std::ostream&,
const bool binary,
const volPointInterpolation&,
const PtrList<GeometricField<Type, fvPatchField, volMesh>>&,
const PtrList<VolField<Type>>&,
const vtkMesh&
);

View File

@ -97,7 +97,7 @@ void Foam::vtkWriteOps::write
(
std::ostream& os,
const bool binary,
const GeometricField<Type, fvPatchField, volMesh>& vvf,
const VolField<Type>& vvf,
const PointField<Type>& pvf,
const vtkMesh& vMesh
)
@ -147,7 +147,7 @@ void Foam::vtkWriteOps::write
std::ostream& os,
const bool binary,
const volPointInterpolation& pInterp,
const PtrList<GeometricField<Type, fvPatchField, volMesh>>& flds,
const PtrList<VolField<Type>>& flds,
const vtkMesh& vMesh
)
{

View File

@ -534,7 +534,7 @@ class vtkPVFoam
template<class Type>
void convertVolFieldBlock
(
const GeometricField<Type, fvPatchField, volMesh>&,
const VolField<Type>&,
autoPtr<PointField<Type>>&,
vtkMultiBlockDataSet* output,
const arrayRange&,
@ -545,7 +545,7 @@ class vtkPVFoam
template<class Type>
void convertVolInternalFieldBlock
(
const typename GeometricField<Type, fvPatchField, volMesh>
const typename VolField<Type>
::Internal&,
vtkMultiBlockDataSet* output,
const arrayRange&,
@ -556,7 +556,7 @@ class vtkPVFoam
template<class Type>
void convertVolInternalField
(
const typename GeometricField<Type, fvPatchField, volMesh>
const typename VolField<Type>
::Internal&,
vtkMultiBlockDataSet* output,
const arrayRange&,
@ -579,7 +579,7 @@ class vtkPVFoam
template<class Type>
void convertSurfaceField
(
const GeometricField<Type, fvPatchField, volMesh>&,
const VolField<Type>&,
vtkMultiBlockDataSet* output,
const arrayRange&,
const label datasetNo,
@ -652,7 +652,7 @@ class vtkPVFoam
void convertPointField
(
const PointField<Type>&,
const GeometricField<Type, fvPatchField, volMesh>&,
const VolField<Type>&,
vtkMultiBlockDataSet* output,
const arrayRange&,
const label datasetNo,

View File

@ -187,7 +187,7 @@ void Foam::vtkPVFoam::convertPointFieldBlock
convertPointField
(
ptf,
GeometricField<Type, fvPatchField, volMesh>::null(),
VolField<Type>::null(),
output,
range,
datasetNo,
@ -202,7 +202,7 @@ template<class Type>
void Foam::vtkPVFoam::convertPointField
(
const PointField<Type>& ptf,
const GeometricField<Type, fvPatchField, volMesh>& tf,
const VolField<Type>& tf,
vtkMultiBlockDataSet* output,
const arrayRange& range,
const label datasetNo,
@ -232,7 +232,7 @@ void Foam::vtkPVFoam::convertPointField
// Note: using the name of the original volField
// not the name generated by the interpolation "volPointInterpolate(<name>)"
if (&tf != &GeometricField<Type, fvPatchField, volMesh>::null())
if (&tf != &VolField<Type>::null())
{
pointData->SetName(tf.name().c_str());
}
@ -285,7 +285,7 @@ void Foam::vtkPVFoam::convertPointField
// continue insertion from here
label i = nPoints;
if (&tf != &GeometricField<Type, fvPatchField, volMesh>::null())
if (&tf != &VolField<Type>::null())
{
forAll(addPointCellLabels, apI)
{

View File

@ -45,7 +45,7 @@ InClass
template<class Type>
void Foam::vtkPVFoam::convertSurfaceField
(
const GeometricField<Type, fvPatchField, volMesh>& tf,
const VolField<Type>& tf,
vtkMultiBlockDataSet* output,
const arrayRange& range,
const label datasetNo,

View File

@ -59,14 +59,14 @@ void Foam::vtkPVFoam::convertVolFields
if
(
iter()->headerClassName()
!= GeometricField<Type, fvPatchField, volMesh>::typeName
!= VolField<Type>::typeName
)
{
continue;
}
// Load field
GeometricField<Type, fvPatchField, volMesh> tf
VolField<Type> tf
(
*iter(),
mesh
@ -282,14 +282,14 @@ void Foam::vtkPVFoam::convertVolInternalFields
if
(
iter()->headerClassName()
!= GeometricField<Type, fvPatchField, volMesh>::Internal::typeName
!= VolField<Type>::Internal::typeName
)
{
continue;
}
// Load field
typename GeometricField<Type, fvPatchField, volMesh>::Internal tf
typename VolField<Type>::Internal tf
(
*iter(),
mesh
@ -328,7 +328,7 @@ void Foam::vtkPVFoam::convertVolInternalFields
template<class Type>
void Foam::vtkPVFoam::convertVolFieldBlock
(
const GeometricField<Type, fvPatchField, volMesh>& tf,
const VolField<Type>& tf,
autoPtr<PointField<Type>>& ptfPtr,
vtkMultiBlockDataSet* output,
const arrayRange& range,
@ -370,7 +370,7 @@ void Foam::vtkPVFoam::convertVolFieldBlock
template<class Type>
void Foam::vtkPVFoam::convertVolInternalFieldBlock
(
const typename GeometricField<Type, fvPatchField, volMesh>::Internal& tf,
const typename VolField<Type>::Internal& tf,
vtkMultiBlockDataSet* output,
const arrayRange& range,
const List<polyDecomp>& decompLst
@ -398,7 +398,7 @@ void Foam::vtkPVFoam::convertVolInternalFieldBlock
template<class Type>
void Foam::vtkPVFoam::convertVolInternalField
(
const typename GeometricField<Type, fvPatchField, volMesh>::Internal& tf,
const typename VolField<Type>::Internal& tf,
vtkMultiBlockDataSet* output,
const arrayRange& range,
const label datasetNo,