fvMesh, pointMesh: Simplified field mapping using FOR_ALL_FIELD_TYPES macro

This commit is contained in:
Henry Weller
2022-03-23 19:33:47 +00:00
parent 48a7f6716b
commit 4c2c4bb43d
2 changed files with 18 additions and 45 deletions

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
@ -48,21 +48,14 @@ void Foam::pointMesh::mapFields(const mapPolyMesh& map)
<< "Mapping all registered pointFields."
<< endl;
}
// Create a mapper
const pointMeshMapper m(*this, map);
MapGeometricFields<scalar, pointPatchField, pointMeshMapper, pointMesh>(m);
MapGeometricFields<vector, pointPatchField, pointMeshMapper, pointMesh>(m);
MapGeometricFields
<
sphericalTensor,
pointPatchField,
pointMeshMapper,
pointMesh
>(m);
MapGeometricFields<symmTensor, pointPatchField, pointMeshMapper, pointMesh>
(m);
MapGeometricFields<tensor, pointPatchField, pointMeshMapper, pointMesh>(m);
// Create the pointMesh mapper
const pointMeshMapper mapper(*this, map);
#define mapPointFieldType(Type, nullArg) \
MapGeometricFields<Type, pointPatchField, pointMeshMapper, pointMesh> \
(mapper);
FOR_ALL_FIELD_TYPES(mapPointFieldType);
}

View File

@ -688,40 +688,20 @@ void Foam::fvMesh::mapFields(const mapPolyMesh& meshMap)
const fvMeshMapper mapper(*this, meshMap);
// Map all the volFields in the objectRegistry
MapGeometricFields<scalar, fvPatchField, fvMeshMapper, volMesh>
(mapper);
MapGeometricFields<vector, fvPatchField, fvMeshMapper, volMesh>
(mapper);
MapGeometricFields<sphericalTensor, fvPatchField, fvMeshMapper, volMesh>
(mapper);
MapGeometricFields<symmTensor, fvPatchField, fvMeshMapper, volMesh>
(mapper);
MapGeometricFields<tensor, fvPatchField, fvMeshMapper, volMesh>
(mapper);
#define mapVolFieldType(Type, nullArg) \
MapGeometricFields<Type, fvPatchField, fvMeshMapper, volMesh>(mapper);
FOR_ALL_FIELD_TYPES(mapVolFieldType);
// Map all the surfaceFields in the objectRegistry
MapGeometricFields<scalar, fvsPatchField, fvMeshMapper, surfaceMesh>
(mapper);
MapGeometricFields<vector, fvsPatchField, fvMeshMapper, surfaceMesh>
(mapper);
MapGeometricFields
<
sphericalTensor,
fvsPatchField,
fvMeshMapper,
surfaceMesh
>(mapper);
MapGeometricFields<symmTensor, fvsPatchField, fvMeshMapper, surfaceMesh>
(mapper);
MapGeometricFields<tensor, fvsPatchField, fvMeshMapper, surfaceMesh>
(mapper);
#define mapSurfaceFieldType(Type, nullArg) \
MapGeometricFields<Type, fvsPatchField, fvMeshMapper, surfaceMesh> \
(mapper);
FOR_ALL_FIELD_TYPES(mapSurfaceFieldType);
// Map all the dimensionedFields in the objectRegistry
MapDimensionedFields<scalar, fvMeshMapper, volMesh>(mapper);
MapDimensionedFields<vector, fvMeshMapper, volMesh>(mapper);
MapDimensionedFields<sphericalTensor, fvMeshMapper, volMesh>(mapper);
MapDimensionedFields<symmTensor, fvMeshMapper, volMesh>(mapper);
MapDimensionedFields<tensor, fvMeshMapper, volMesh>(mapper);
#define mapVolInternalFieldType(Type, nullArg) \
MapDimensionedFields<Type, fvMeshMapper, volMesh>(mapper);
FOR_ALL_FIELD_TYPES(mapVolInternalFieldType);
// Map all the clouds in the objectRegistry
mapClouds(*this, meshMap);