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

@ -146,10 +146,10 @@ public:
//- Decompose volume field
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<VolField<Type>>
decomposeField
(
const GeometricField<Type, fvPatchField, volMesh>& field
const VolField<Type>& field
) const;
//- Decompose surface field

View File

@ -86,7 +86,7 @@ template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
Foam::fvFieldDecomposer::decomposeField
(
const GeometricField<Type, fvPatchField, volMesh>& field
const VolField<Type>& field
) const
{
// Create dummy patch fields
@ -106,9 +106,9 @@ Foam::fvFieldDecomposer::decomposeField
}
// Create the processor field with the dummy patch fields
tmp<GeometricField<Type, fvPatchField, volMesh>> tresF
tmp<VolField<Type>> tresF
(
new GeometricField<Type, fvPatchField, volMesh>
new VolField<Type>
(
IOobject
(
@ -125,11 +125,11 @@ Foam::fvFieldDecomposer::decomposeField
patchFields
)
);
GeometricField<Type, fvPatchField, volMesh>& resF = tresF.ref();
VolField<Type>& resF = tresF.ref();
// Change the patch fields to the correct type using a mapper constructor
// (with reference to the now correct internal field)
typename GeometricField<Type, fvPatchField, volMesh>::
typename VolField<Type>::
Boundary& bf = resF.boundaryFieldRef();
forAll(bf, procPatchi)
{

View File

@ -152,16 +152,16 @@ public:
//- Reconstruct volume field
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<VolField<Type>>
reconstructFvVolumeField
(
const IOobject& fieldIoObject,
const PtrList<GeometricField<Type, fvPatchField, volMesh>>&
const PtrList<VolField<Type>>&
) const;
//- Read and reconstruct volume field
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<VolField<Type>>
reconstructFvVolumeField(const IOobject& fieldIoObject) const;

View File

@ -142,7 +142,7 @@ Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
Foam::fvFieldReconstructor::reconstructFvVolumeField
(
const IOobject& fieldIoObject,
const PtrList<GeometricField<Type, fvPatchField, volMesh>>& procFields
const PtrList<VolField<Type>>& procFields
) const
{
// Create the internalField
@ -153,7 +153,7 @@ Foam::fvFieldReconstructor::reconstructFvVolumeField
forAll(procFields, proci)
{
const GeometricField<Type, fvPatchField, volMesh>& procField =
const VolField<Type>& procField =
procFields[proci];
// Set the cell values in the reconstructed field
@ -240,9 +240,9 @@ Foam::fvFieldReconstructor::reconstructFvVolumeField
}
// Construct and return the field
return tmp<GeometricField<Type, fvPatchField, volMesh>>
return tmp<VolField<Type>>
(
new GeometricField<Type, fvPatchField, volMesh>
new VolField<Type>
(
fieldIoObject,
completeMesh_,
@ -261,7 +261,7 @@ Foam::fvFieldReconstructor::reconstructFvVolumeField
const IOobject& fieldIoObject
) const
{
PtrList<GeometricField<Type, fvPatchField, volMesh>>
PtrList<VolField<Type>>
procFields(procMeshes_.size());
forAll(procMeshes_, proci)
@ -269,7 +269,7 @@ Foam::fvFieldReconstructor::reconstructFvVolumeField
procFields.set
(
proci,
new GeometricField<Type, fvPatchField, volMesh>
new VolField<Type>
(
IOobject
(
@ -507,7 +507,7 @@ void Foam::fvFieldReconstructor::reconstructFvVolumeFields
)
{
const word& fieldClassName =
GeometricField<Type, fvPatchField, volMesh>::typeName;
VolField<Type>::typeName;
IOobjectList fields = objects.lookupClass(fieldClassName);