Replaced inconsistently named local typedefs with VolField, SurfaceField and PointField

making the code more consistent and readable.
This commit is contained in:
Henry Weller
2022-12-02 10:54:21 +00:00
parent 73c5624acf
commit 5f7993dab4
26 changed files with 225 additions and 243 deletions

View File

@ -36,10 +36,11 @@ void Foam::readFields
const bool readOldTime const bool readOldTime
) )
{ {
typedef GeometricField<Type, PatchField, GeoMesh> GeoField; // Search list of objects for fields
IOobjectList fieldObjects(objects.lookupClass
// Search list of objects for fields of type GeomField (
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName)); GeometricField<Type, PatchField, GeoMesh>::typeName)
);
// Remove the cellProc field // Remove the cellProc field
IOobjectList::iterator cellProcIter = fieldObjects.find("cellProc"); IOobjectList::iterator cellProcIter = fieldObjects.find("cellProc");
@ -59,7 +60,16 @@ void Foam::readFields
{ {
const IOobject& io = *fieldObjects[masterNames[i]]; const IOobject& io = *fieldObjects[masterNames[i]];
fields.set(i, new GeoField(io, mesh, readOldTime)); fields.set
(
i,
new GeometricField<Type, PatchField, GeoMesh>
(
io,
mesh,
readOldTime
)
);
} }
} }

View File

@ -43,16 +43,14 @@ void processField
return; return;
} }
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const word timeName(mesh.time().name()); const word timeName(mesh.time().name());
IOobjectList fieldObjbjects(objects.lookupClass(fieldType::typeName)); IOobjectList fieldObjbjects(objects.lookupClass(VolField<Type>::typeName));
if (fieldObjbjects.lookup(fieldName) != nullptr) if (fieldObjbjects.lookup(fieldName) != nullptr)
{ {
fieldType vtf(*fieldObjbjects.lookup(fieldName), mesh); VolField<Type> vtf(*fieldObjbjects.lookup(fieldName), mesh);
const typename fieldType::Boundary& bf = const typename VolField<Type>::Boundary& bf =
vtf.boundaryField(); vtf.boundaryField();
forAll(bf, patchi) forAll(bf, patchi)

View File

@ -43,12 +43,10 @@ void MapConsistentVolFields
const meshToMesh0::order& mapOrder const meshToMesh0::order& mapOrder
) )
{ {
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const fvMesh& meshSource = meshToMesh0Interp.fromMesh(); const fvMesh& meshSource = meshToMesh0Interp.fromMesh();
const fvMesh& meshTarget = meshToMesh0Interp.toMesh(); const fvMesh& meshTarget = meshToMesh0Interp.toMesh();
IOobjectList fields = objects.lookupClass(fieldType::typeName); IOobjectList fields = objects.lookupClass(VolField<Type>::typeName);
forAllIter(IOobjectList, fields, fieldIter) forAllIter(IOobjectList, fields, fieldIter)
{ {
@ -56,9 +54,9 @@ void MapConsistentVolFields
<< endl; << endl;
// Read field // Read field
fieldType fieldSource(*fieldIter(), meshSource); VolField<Type> fieldSource(*fieldIter(), meshSource);
typeIOobject<fieldType> fieldTargetIOobject typeIOobject<VolField<Type>> fieldTargetIOobject
( (
fieldIter()->name(), fieldIter()->name(),
meshTarget.time().name(), meshTarget.time().name(),
@ -70,7 +68,7 @@ void MapConsistentVolFields
if (fieldTargetIOobject.headerOk()) if (fieldTargetIOobject.headerOk())
{ {
// Read fieldTarget // Read fieldTarget
fieldType fieldTarget VolField<Type> fieldTarget
( (
fieldTargetIOobject, fieldTargetIOobject,
meshTarget meshTarget
@ -92,7 +90,7 @@ void MapConsistentVolFields
fieldTargetIOobject.readOpt() = IOobject::NO_READ; fieldTargetIOobject.readOpt() = IOobject::NO_READ;
// Interpolate field // Interpolate field
fieldType fieldTarget VolField<Type> fieldTarget
( (
fieldTargetIOobject, fieldTargetIOobject,
meshToMesh0Interp.interpolate meshToMesh0Interp.interpolate

View File

@ -43,16 +43,14 @@ void MapVolFields
const meshToMesh0::order& mapOrder const meshToMesh0::order& mapOrder
) )
{ {
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const fvMesh& meshSource = meshToMesh0Interp.fromMesh(); const fvMesh& meshSource = meshToMesh0Interp.fromMesh();
const fvMesh& meshTarget = meshToMesh0Interp.toMesh(); const fvMesh& meshTarget = meshToMesh0Interp.toMesh();
IOobjectList fields = objects.lookupClass(fieldType::typeName); IOobjectList fields = objects.lookupClass(VolField<Type>::typeName);
forAllIter(IOobjectList, fields, fieldIter) forAllIter(IOobjectList, fields, fieldIter)
{ {
typeIOobject<fieldType> fieldTargetIOobject typeIOobject<VolField<Type>> fieldTargetIOobject
( (
fieldIter()->name(), fieldIter()->name(),
meshTarget.time().name(), meshTarget.time().name(),
@ -66,10 +64,10 @@ void MapVolFields
Info<< " interpolating " << fieldIter()->name() << endl; Info<< " interpolating " << fieldIter()->name() << endl;
// Read field fieldSource // Read field fieldSource
fieldType fieldSource(*fieldIter(), meshSource); VolField<Type> fieldSource(*fieldIter(), meshSource);
// Read fieldTarget // Read fieldTarget
fieldType fieldTarget VolField<Type> fieldTarget
( (
fieldTargetIOobject, fieldTargetIOobject,
meshTarget meshTarget

View File

@ -50,9 +50,7 @@ bool setCellFieldType
Istream& fieldValueStream Istream& fieldValueStream
) )
{ {
typedef GeometricField<Type, fvPatchField, volMesh> fieldType; if (fieldTypeDesc != VolField<Type>::typeName + "Value")
if (fieldTypeDesc != fieldType::typeName + "Value")
{ {
return false; return false;
} }
@ -60,7 +58,7 @@ bool setCellFieldType
word fieldName(fieldValueStream); word fieldName(fieldValueStream);
// Check the current time directory // Check the current time directory
typeIOobject<fieldType> fieldHeader typeIOobject<VolField<Type>> fieldHeader
( (
fieldName, fieldName,
mesh.time().name(), mesh.time().name(),
@ -71,7 +69,7 @@ bool setCellFieldType
// Check the "constant" directory // Check the "constant" directory
if (!fieldHeader.headerOk()) if (!fieldHeader.headerOk())
{ {
fieldHeader = typeIOobject<fieldType> fieldHeader = typeIOobject<VolField<Type>>
( (
fieldName, fieldName,
mesh.time().constant(), mesh.time().constant(),
@ -87,7 +85,7 @@ bool setCellFieldType
<< fieldHeader.headerClassName() << fieldHeader.headerClassName()
<< " " << fieldName << endl; << " " << fieldName << endl;
fieldType field(fieldHeader, mesh); VolField<Type> field(fieldHeader, mesh);
const Type value = pTraits<Type>(fieldValueStream); const Type value = pTraits<Type>(fieldValueStream);
@ -196,9 +194,7 @@ bool setFaceFieldType
Istream& fieldValueStream Istream& fieldValueStream
) )
{ {
typedef GeometricField<Type, fvPatchField, volMesh> fieldType; if (fieldTypeDesc != VolField<Type>::typeName + "Value")
if (fieldTypeDesc != fieldType::typeName + "Value")
{ {
return false; return false;
} }
@ -206,7 +202,7 @@ bool setFaceFieldType
word fieldName(fieldValueStream); word fieldName(fieldValueStream);
// Check the current time directory // Check the current time directory
typeIOobject<fieldType> fieldHeader typeIOobject<VolField<Type>> fieldHeader
( (
fieldName, fieldName,
mesh.time().name(), mesh.time().name(),
@ -217,7 +213,7 @@ bool setFaceFieldType
// Check the "constant" directory // Check the "constant" directory
if (!fieldHeader.headerOk()) if (!fieldHeader.headerOk())
{ {
fieldHeader = typeIOobject<fieldType> fieldHeader = typeIOobject<VolField<Type>>
( (
fieldName, fieldName,
mesh.time().constant(), mesh.time().constant(),
@ -234,8 +230,8 @@ bool setFaceFieldType
<< " " << fieldName << endl; << " " << fieldName << endl;
// Read the field // Read the field
fieldType field(fieldHeader, mesh); VolField<Type> field(fieldHeader, mesh);
typename fieldType::Boundary& fieldBf = field.boundaryFieldRef(); typename VolField<Type>::Boundary& fieldBf = field.boundaryFieldRef();
// Read the value // Read the value
const Type value = pTraits<Type>(fieldValueStream); const Type value = pTraits<Type>(fieldValueStream);
@ -252,9 +248,9 @@ bool setFaceFieldType
} }
// Create a copy of the boundary field // Create a copy of the boundary field
typename fieldType::Boundary fieldBfCopy typename VolField<Type>::Boundary fieldBfCopy
( (
fieldType::Internal::null(), VolField<Type>::Internal::null(),
fieldBf fieldBf
); );

View File

@ -553,31 +553,29 @@ void Foam::fvMeshAdder::MapSurfaceFields
const fvMesh& meshToAdd const fvMesh& meshToAdd
) )
{ {
typedef GeometricField<Type, fvsPatchField, surfaceMesh> fldType; HashTable<const SurfaceField<Type>*> fields
HashTable<const fldType*> fields
( (
mesh.objectRegistry::lookupClass<fldType>() mesh.objectRegistry::lookupClass<SurfaceField<Type>>()
); );
HashTable<const fldType*> fieldsToAdd HashTable<const SurfaceField<Type>*> fieldsToAdd
( (
meshToAdd.objectRegistry::lookupClass<fldType>() meshToAdd.objectRegistry::lookupClass<SurfaceField<Type>>()
); );
for for
( (
typename HashTable<const fldType*>:: typename HashTable<const SurfaceField<Type>*>::
iterator fieldIter = fields.begin(); iterator fieldIter = fields.begin();
fieldIter != fields.end(); fieldIter != fields.end();
++fieldIter ++fieldIter
) )
{ {
fldType& fld = const_cast<fldType&>(*fieldIter()); SurfaceField<Type>& fld = const_cast<SurfaceField<Type>&>(*fieldIter());
if (fieldsToAdd.found(fld.name())) if (fieldsToAdd.found(fld.name()))
{ {
const fldType& fldToAdd = *fieldsToAdd[fld.name()]; const SurfaceField<Type>& fldToAdd = *fieldsToAdd[fld.name()];
if (debug) if (debug)
{ {
@ -856,24 +854,25 @@ void Foam::fvMeshAdder::MapPointFields
const objectRegistry& meshToAdd const objectRegistry& meshToAdd
) )
{ {
typedef GeometricField<Type, pointPatchField, pointMesh> fldType; HashTable<const PointField<Type>*>
fields(mesh.thisDb().lookupClass<PointField<Type>>());
HashTable<const fldType*> fields(mesh.thisDb().lookupClass<fldType>()); HashTable<const PointField<Type>*>
HashTable<const fldType*> fieldsToAdd(meshToAdd.lookupClass<fldType>()); fieldsToAdd(meshToAdd.lookupClass<PointField<Type>>());
for for
( (
typename HashTable<const fldType*>:: typename HashTable<const PointField<Type>*>::
iterator fieldIter = fields.begin(); iterator fieldIter = fields.begin();
fieldIter != fields.end(); fieldIter != fields.end();
++fieldIter ++fieldIter
) )
{ {
fldType& fld = const_cast<fldType&>(*fieldIter()); PointField<Type>& fld = const_cast<PointField<Type>&>(*fieldIter());
if (fieldsToAdd.found(fld.name())) if (fieldsToAdd.found(fld.name()))
{ {
const fldType& fldToAdd = *fieldsToAdd[fld.name()]; const PointField<Type>& fldToAdd = *fieldsToAdd[fld.name()];
if (debug) if (debug)
{ {
@ -923,33 +922,32 @@ void Foam::fvMeshAdder::MapDimFields
const fvMesh& meshToAdd const fvMesh& meshToAdd
) )
{ {
typedef DimensionedField<Type, volMesh> fldType;
// Note: use strict flag on lookupClass to avoid picking up // Note: use strict flag on lookupClass to avoid picking up
// volFields // volFields
HashTable<const fldType*> fields HashTable<const VolInternalField<Type>*> fields
( (
mesh.objectRegistry::lookupClass<fldType>(true) mesh.objectRegistry::lookupClass<VolInternalField<Type>>(true)
); );
HashTable<const fldType*> fieldsToAdd HashTable<const VolInternalField<Type>*> fieldsToAdd
( (
meshToAdd.objectRegistry::lookupClass<fldType>(true) meshToAdd.objectRegistry::lookupClass<VolInternalField<Type>>(true)
); );
for for
( (
typename HashTable<const fldType*>:: typename HashTable<const VolInternalField<Type>*>::
iterator fieldIter = fields.begin(); iterator fieldIter = fields.begin();
fieldIter != fields.end(); fieldIter != fields.end();
++fieldIter ++fieldIter
) )
{ {
fldType& fld = const_cast<fldType&>(*fieldIter()); VolInternalField<Type>& fld =
const_cast<VolInternalField<Type>&>(*fieldIter());
if (fieldsToAdd.found(fld.name())) if (fieldsToAdd.found(fld.name()))
{ {
const fldType& fldToAdd = *fieldsToAdd[fld.name()]; const VolInternalField<Type>& fldToAdd = *fieldsToAdd[fld.name()];
if (debug) if (debug)
{ {

View File

@ -113,30 +113,30 @@ class fvMeshDistribute
label findNonEmptyPatch() const; label findNonEmptyPatch() const;
//- Save boundary fields //- Save boundary fields
template<class T, class Mesh> template<class Type, class Mesh>
void saveBoundaryFields void saveBoundaryFields
( (
PtrList<FieldField<fvsPatchField, T>>& bflds PtrList<FieldField<fvsPatchField, Type>>& bflds
) const; ) const;
//- Map boundary fields //- Map boundary fields
template<class T, class Mesh> template<class Type, class Mesh>
void mapBoundaryFields void mapBoundaryFields
( (
const polyTopoChangeMap& map, const polyTopoChangeMap& map,
const PtrList<FieldField<fvsPatchField, T>>& oldBflds const PtrList<FieldField<fvsPatchField, Type>>& oldBflds
); );
//- Set value of exposed patch faces //- Set value of exposed patch faces
template<class T> template<class Type>
void initMapExposedFaces(PtrList<Field<T>>& iflds) const; void initMapExposedFaces(PtrList<Field<Type>>& iflds) const;
//- Set value of exposed patch faces //- Set value of exposed patch faces
template<class T> template<class Type>
void mapExposedFaces void mapExposedFaces
( (
const polyTopoChangeMap& map, const polyTopoChangeMap& map,
const PtrList<Field<T>>& oldFlds const PtrList<Field<Type>>& oldFlds
); );
//- Correct coupled patch fields //- Correct coupled patch fields

View File

@ -55,28 +55,27 @@ void Foam::fvMeshDistribute::printFieldInfo(const fvMesh& mesh)
} }
template<class T, class Mesh> template<class Type, class Mesh>
void Foam::fvMeshDistribute::saveBoundaryFields void Foam::fvMeshDistribute::saveBoundaryFields
( (
PtrList<FieldField<fvsPatchField, T>>& bflds PtrList<FieldField<fvsPatchField, Type>>& bflds
) const ) const
{ {
// Save whole boundary field // Save whole boundary field
typedef GeometricField<T, fvsPatchField, Mesh> fldType; HashTable<const SurfaceField<Type>*> flds
HashTable<const fldType*> flds
( (
static_cast<const fvMesh&>(mesh_).objectRegistry::lookupClass<fldType>() static_cast<const fvMesh&>(mesh_)
.objectRegistry::lookupClass<SurfaceField<Type>>()
); );
bflds.setSize(flds.size()); bflds.setSize(flds.size());
label i = 0; label i = 0;
forAllConstIter(typename HashTable<const fldType*>, flds, iter) forAllConstIter(typename HashTable<const SurfaceField<Type>*>, flds, iter)
{ {
const fldType& fld = *iter(); const SurfaceField<Type>& fld = *iter();
bflds.set(i, fld.boundaryField().clone().ptr()); bflds.set(i, fld.boundaryField().clone().ptr());
@ -85,11 +84,11 @@ void Foam::fvMeshDistribute::saveBoundaryFields
} }
template<class T, class Mesh> template<class Type, class Mesh>
void Foam::fvMeshDistribute::mapBoundaryFields void Foam::fvMeshDistribute::mapBoundaryFields
( (
const polyTopoChangeMap& map, const polyTopoChangeMap& map,
const PtrList<FieldField<fvsPatchField, T>>& oldBflds const PtrList<FieldField<fvsPatchField, Type>>& oldBflds
) )
{ {
// Map boundary field // Map boundary field
@ -97,11 +96,9 @@ void Foam::fvMeshDistribute::mapBoundaryFields
const labelList& oldPatchStarts = map.oldPatchStarts(); const labelList& oldPatchStarts = map.oldPatchStarts();
const labelList& faceMap = map.faceMap(); const labelList& faceMap = map.faceMap();
typedef GeometricField<T, fvsPatchField, Mesh> fldType; HashTable<SurfaceField<Type>*> flds
HashTable<fldType*> flds
( (
mesh_.objectRegistry::lookupClass<fldType>() mesh_.objectRegistry::lookupClass<SurfaceField<Type>>()
); );
if (flds.size() != oldBflds.size()) if (flds.size() != oldBflds.size())
@ -112,19 +109,19 @@ void Foam::fvMeshDistribute::mapBoundaryFields
label fieldi = 0; label fieldi = 0;
forAllIter(typename HashTable<fldType*>, flds, iter) forAllIter(typename HashTable<SurfaceField<Type>*>, flds, iter)
{ {
fldType& fld = *iter(); SurfaceField<Type>& fld = *iter();
typename fldType::Boundary& bfld = typename SurfaceField<Type>::Boundary& bfld =
fld.boundaryFieldRef(); fld.boundaryFieldRef();
const FieldField<fvsPatchField, T>& oldBfld = oldBflds[fieldi++]; const FieldField<fvsPatchField, Type>& oldBfld = oldBflds[fieldi++];
// Pull from old boundary field into bfld. // Pull from old boundary field into bfld.
forAll(bfld, patchi) forAll(bfld, patchi)
{ {
fvsPatchField<T>& patchFld = bfld[patchi]; fvsPatchField<Type>& patchFld = bfld[patchi];
label facei = patchFld.patch().start(); label facei = patchFld.patch().start();
forAll(patchFld, i) forAll(patchFld, i)
@ -147,35 +144,35 @@ void Foam::fvMeshDistribute::mapBoundaryFields
} }
template<class T> template<class Type>
void Foam::fvMeshDistribute::initMapExposedFaces void Foam::fvMeshDistribute::initMapExposedFaces
( (
PtrList<Field<T>>& iflds PtrList<Field<Type>>& iflds
) const ) const
{ {
HashTable<const SurfaceField<T>*> flds HashTable<const SurfaceField<Type>*> flds
( (
static_cast<const fvMesh&>(mesh_).lookupClass<SurfaceField<T>>() static_cast<const fvMesh&>(mesh_).lookupClass<SurfaceField<Type>>()
); );
iflds.setSize(flds.size()); iflds.setSize(flds.size());
label fieldi = 0; label fieldi = 0;
forAllConstIter(typename HashTable<const SurfaceField<T>*>, flds, iter) forAllConstIter(typename HashTable<const SurfaceField<Type>*>, flds, iter)
{ {
iflds.set(fieldi, Field<T>(mesh_.nFaces())); iflds.set(fieldi, Field<Type>(mesh_.nFaces()));
const SurfaceField<T>& fld = *iter(); const SurfaceField<Type>& fld = *iter();
SubList<T>(iflds[fieldi], fld.primitiveField().size()) = SubList<Type>(iflds[fieldi], fld.primitiveField().size()) =
fld.primitiveField(); fld.primitiveField();
forAll(fld.boundaryField(), patchi) forAll(fld.boundaryField(), patchi)
{ {
const fvsPatchField<T>& pfld = fld.boundaryField()[patchi]; const fvsPatchField<Type>& pfld = fld.boundaryField()[patchi];
SubList<T>(iflds[fieldi], pfld.size(), pfld.patch().start()) = SubList<Type>(iflds[fieldi], pfld.size(), pfld.patch().start()) =
pfld; pfld;
} }
@ -184,31 +181,31 @@ void Foam::fvMeshDistribute::initMapExposedFaces
} }
template<class T> template<class Type>
void Foam::fvMeshDistribute::mapExposedFaces void Foam::fvMeshDistribute::mapExposedFaces
( (
const polyTopoChangeMap& map, const polyTopoChangeMap& map,
const PtrList<Field<T>>& oldFlds const PtrList<Field<Type>>& oldFlds
) )
{ {
HashTable<SurfaceField<T>*> flds HashTable<SurfaceField<Type>*> flds
( (
mesh_.objectRegistry::lookupClass<SurfaceField<T>>() mesh_.objectRegistry::lookupClass<SurfaceField<Type>>()
); );
label fieldi = 0; label fieldi = 0;
forAllIter(typename HashTable<SurfaceField<T>*>, flds, iter) forAllIter(typename HashTable<SurfaceField<Type>*>, flds, iter)
{ {
SurfaceField<T>& fld = *iter(); SurfaceField<Type>& fld = *iter();
const Field<T>& oldFld = oldFlds[fieldi]; const Field<Type>& oldFld = oldFlds[fieldi];
const bool negateIfFlipped = isFlux(fld); const bool negateIfFlipped = isFlux(fld);
forAll(fld.boundaryField(), patchi) forAll(fld.boundaryField(), patchi)
{ {
fvsPatchField<T>& patchFld = fld.boundaryFieldRef()[patchi]; fvsPatchField<Type>& patchFld = fld.boundaryFieldRef()[patchi];
forAll(patchFld, i) forAll(patchFld, i)
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,8 +38,6 @@ void Foam::motionSmootherAlgo::checkConstraints
GeometricField<Type, pointPatchField, pointMesh>& pf GeometricField<Type, pointPatchField, pointMesh>& pf
) )
{ {
typedef GeometricField<Type, pointPatchField, pointMesh> FldType;
const polyMesh& mesh = pf.mesh(); const polyMesh& mesh = pf.mesh();
const polyBoundaryMesh& bm = mesh.boundaryMesh(); const polyBoundaryMesh& bm = mesh.boundaryMesh();
@ -57,7 +55,7 @@ void Foam::motionSmootherAlgo::checkConstraints
} }
typename FldType::Boundary& bFld = pf.boundaryField(); typename PointField<Type>::Boundary& bFld = pf.boundaryField();
// Evaluate in reverse order // Evaluate in reverse order

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -72,9 +72,7 @@ void Foam::convergenceControl::getInitialTypeResiduals
scalar& r scalar& r
) )
{ {
typedef GeometricField<Type, fvPatchField, volMesh> fieldType; if (mesh.foundObject<VolField<Type>>(fieldName))
if (mesh.foundObject<fieldType>(fieldName))
{ {
const DynamicList<SolverPerformance<Type>>& sp const DynamicList<SolverPerformance<Type>>& sp
( (

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -35,9 +35,7 @@ void Foam::correctorConvergenceControl::getNTypeSolves
label& n label& n
) )
{ {
typedef GeometricField<Type, fvPatchField, volMesh> fieldType; if (mesh.foundObject<VolField<Type>>(fieldName))
if (mesh.foundObject<fieldType>(fieldName))
{ {
const DynamicList<SolverPerformance<Type>>& sp const DynamicList<SolverPerformance<Type>>& sp
( (

View File

@ -28,14 +28,12 @@ License
template<class Type> template<class Type>
void Foam::singleRegionSolutionControl::storePrevIterTypeFields() const void Foam::singleRegionSolutionControl::storePrevIterTypeFields() const
{ {
typedef GeometricField<Type, fvPatchField, volMesh> fieldType; HashTable<VolField<Type>*>
flds(mesh_.objectRegistry::lookupClass<VolField<Type>>());
HashTable<fieldType*> forAllIter(typename HashTable<VolField<Type>*>, flds, iter)
flds(mesh_.objectRegistry::lookupClass<fieldType>());
forAllIter(typename HashTable<fieldType*>, flds, iter)
{ {
fieldType& fld = *iter(); VolField<Type>& fld = *iter();
const word& fName = fld.name(); const word& fName = fld.name();

View File

@ -64,12 +64,12 @@ void Foam::externalCoupledMixedFvPatchField<Type>::setMaster
const labelList& patchIDs const labelList& patchIDs
) )
{ {
const volFieldType& cvf = const VolField<Type>& cvf =
static_cast<const volFieldType&>(this->internalField()); static_cast<const VolField<Type>&>(this->internalField());
volFieldType& vf = const_cast<volFieldType&>(cvf); VolField<Type>& vf = const_cast<VolField<Type>&>(cvf);
typename volFieldType::Boundary& bf = vf.boundaryFieldRef(); typename VolField<Type>::Boundary& bf = vf.boundaryFieldRef();
// number of patches can be different in parallel... // number of patches can be different in parallel...
label nPatch = bf.size(); label nPatch = bf.size();
@ -87,7 +87,8 @@ void Foam::externalCoupledMixedFvPatchField<Type>::setMaster
{ {
label patchi = patchIDs[i]; label patchi = patchIDs[i];
patchType& pf = refCast<patchType>(bf[patchi]); externalCoupledMixedFvPatchField<Type>& pf =
refCast<externalCoupledMixedFvPatchField<Type>>(bf[patchi]);
offsets_[patchi][Pstream::myProcNo()] = pf.size(); offsets_[patchi][Pstream::myProcNo()] = pf.size();
@ -242,17 +243,18 @@ void Foam::externalCoupledMixedFvPatchField<Type>::startWait() const
{ {
// only wait on master patch // only wait on master patch
const volFieldType& cvf = const VolField<Type>& cvf =
static_cast<const volFieldType&>(this->internalField()); static_cast<const VolField<Type>&>(this->internalField());
const typename volFieldType::Boundary& bf = const typename VolField<Type>::Boundary& bf =
cvf.boundaryField(); cvf.boundaryField();
forAll(coupledPatchIDs_, i) forAll(coupledPatchIDs_, i)
{ {
label patchi = coupledPatchIDs_[i]; label patchi = coupledPatchIDs_[i];
const patchType& pf = refCast<const patchType>(bf[patchi]); const externalCoupledMixedFvPatchField<Type>& pf =
refCast<const externalCoupledMixedFvPatchField<Type>>(bf[patchi]);
if (pf.master()) if (pf.master())
{ {
@ -406,17 +408,18 @@ void Foam::externalCoupledMixedFvPatchField<Type>::writeData
writeHeader(os); writeHeader(os);
const volFieldType& cvf = const VolField<Type>& cvf =
static_cast<const volFieldType&>(this->internalField()); static_cast<const VolField<Type>&>(this->internalField());
const typename volFieldType::Boundary& bf = const typename VolField<Type>::Boundary& bf =
cvf.boundaryField(); cvf.boundaryField();
forAll(coupledPatchIDs_, i) forAll(coupledPatchIDs_, i)
{ {
label patchi = coupledPatchIDs_[i]; label patchi = coupledPatchIDs_[i];
const patchType& pf = refCast<const patchType>(bf[patchi]); const externalCoupledMixedFvPatchField<Type>& pf =
refCast<const externalCoupledMixedFvPatchField<Type>>(bf[patchi]);
pf.transferData(os); pf.transferData(os);
} }
@ -586,19 +589,19 @@ void Foam::externalCoupledMixedFvPatchField<Type>::initialise
return; return;
} }
const volFieldType& cvf = const VolField<Type>& cvf =
static_cast<const volFieldType&>(this->internalField()); static_cast<const VolField<Type>&>(this->internalField());
volFieldType& vf = const_cast<volFieldType&>(cvf); VolField<Type>& vf = const_cast<VolField<Type>&>(cvf);
typename volFieldType::Boundary& bf = vf.boundaryFieldRef(); typename VolField<Type>::Boundary& bf = vf.boundaryFieldRef();
// identify all coupled patches // identify all coupled patches
DynamicList<label> coupledPatchIDs(bf.size()); DynamicList<label> coupledPatchIDs(bf.size());
forAll(bf, patchi) forAll(bf, patchi)
{ {
if (isA<patchType>(bf[patchi])) if (isA<externalCoupledMixedFvPatchField<Type>>(bf[patchi]))
{ {
coupledPatchIDs.append(patchi); coupledPatchIDs.append(patchi);
} }
@ -617,7 +620,8 @@ void Foam::externalCoupledMixedFvPatchField<Type>::initialise
{ {
label patchi = coupledPatchIDs_[i]; label patchi = coupledPatchIDs_[i];
patchType& pf = refCast<patchType>(bf[patchi]); externalCoupledMixedFvPatchField<Type>& pf =
refCast<externalCoupledMixedFvPatchField<Type>>(bf[patchi]);
pf.setMaster(coupledPatchIDs_); pf.setMaster(coupledPatchIDs_);
} }
@ -633,7 +637,8 @@ void Foam::externalCoupledMixedFvPatchField<Type>::initialise
{ {
label patchi = coupledPatchIDs_[i]; label patchi = coupledPatchIDs_[i];
patchType& pf = refCast<patchType>(bf[patchi]); externalCoupledMixedFvPatchField<Type>& pf =
refCast<externalCoupledMixedFvPatchField<Type>>(bf[patchi]);
pf.readData(transferFile); pf.readData(transferFile);
} }
@ -755,10 +760,10 @@ void Foam::externalCoupledMixedFvPatchField<Type>::transferData
template<class Type> template<class Type>
void Foam::externalCoupledMixedFvPatchField<Type>::writeGeometry() const void Foam::externalCoupledMixedFvPatchField<Type>::writeGeometry() const
{ {
const volFieldType& cvf = const VolField<Type>& cvf =
static_cast<const volFieldType&>(this->internalField()); static_cast<const VolField<Type>&>(this->internalField());
const typename volFieldType::Boundary& bf = const typename VolField<Type>::Boundary& bf =
cvf.boundaryField(); cvf.boundaryField();
OFstream osPoints(baseDir()/"patchPoints"); OFstream osPoints(baseDir()/"patchPoints");
@ -772,9 +777,13 @@ void Foam::externalCoupledMixedFvPatchField<Type>::writeGeometry() const
forAll(bf, patchi) forAll(bf, patchi)
{ {
if (isA<patchType>(bf[patchi])) if (isA<externalCoupledMixedFvPatchField<Type>>(bf[patchi]))
{ {
const patchType& pf = refCast<const patchType>(bf[patchi]); const externalCoupledMixedFvPatchField<Type>& pf =
refCast<const externalCoupledMixedFvPatchField<Type>>
(
bf[patchi]
);
pf.writeGeometry(osPoints, osFaces); pf.writeGeometry(osPoints, osFaces);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -136,10 +136,6 @@ class externalCoupledMixedFvPatchField
{ {
// Private Data // Private Data
//- Convenience typedefs
typedef externalCoupledMixedFvPatchField<Type> patchType;
typedef GeometricField<Type, fvPatchField, volMesh> volFieldType;
//- Path to communications directory //- Path to communications directory
fileName commsDir_; fileName commsDir_;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -109,8 +109,8 @@ Foam::cyclicFvsPatchField<Type>::patchNeighbourField
const Pstream::commsTypes commsType const Pstream::commsTypes commsType
) const ) const
{ {
typedef GeometricField<Type, fvsPatchField, surfaceMesh> geoField; const SurfaceField<Type>& gf =
const geoField& gf = refCast<const geoField>(this->internalField()); refCast<const SurfaceField<Type>>(this->internalField());
const cyclicFvPatch& cp = refCast<const cyclicFvPatch>(this->patch()); const cyclicFvPatch& cp = refCast<const cyclicFvPatch>(this->patch());

View File

@ -190,12 +190,7 @@ public:
const GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) = 0; ) = 0;
typedef GeometricField typedef SurfaceField<typename flux<Type>::type> fluxFieldType;
<
typename flux<Type>::type,
fvsPatchField,
surfaceMesh
> fluxFieldType;
virtual tmp<surfaceScalarField> fvcDdtPhiCoeff virtual tmp<surfaceScalarField> fvcDdtPhiCoeff
( (

View File

@ -40,13 +40,11 @@ Foam::fvc::cellReduce
const Type& nullValue const Type& nullValue
) )
{ {
typedef GeometricField<Type, fvPatchField, volMesh> volFieldType;
const fvMesh& mesh = ssf.mesh(); const fvMesh& mesh = ssf.mesh();
tmp<volFieldType> tresult tmp<VolField<Type>> tresult
( (
volFieldType::New VolField<Type>::New
( (
"cellReduce(" + ssf.name() + ')', "cellReduce(" + ssf.name() + ')',
mesh, mesh,
@ -59,7 +57,7 @@ Foam::fvc::cellReduce
) )
); );
volFieldType& result = tresult.ref(); VolField<Type>& result = tresult.ref();
const labelUList& own = mesh.owner(); const labelUList& own = mesh.owner();
const labelUList& nbr = mesh.neighbour(); const labelUList& nbr = mesh.neighbour();

View File

@ -97,20 +97,23 @@ Foam::fv::gradScheme<Type>::grad
) const ) const
{ {
typedef typename outerProduct<vector, Type>::type GradType; typedef typename outerProduct<vector, Type>::type GradType;
typedef GeometricField<GradType, fvPatchField, volMesh> GradFieldType;
if (!this->mesh().changing() && this->mesh().solution().cache(name)) if (!this->mesh().changing() && this->mesh().solution().cache(name))
{ {
if (!mesh().objectRegistry::template foundObject<GradFieldType>(name)) if
(
!mesh().objectRegistry::template
foundObject<VolField<GradType>>(name)
)
{ {
solution::cachePrintMessage("Calculating and caching", name, vsf); solution::cachePrintMessage("Calculating and caching", name, vsf);
tmp<GradFieldType> tgGrad = calcGrad(vsf, name); tmp<VolField<GradType>> tgGrad = calcGrad(vsf, name);
regIOobject::store(tgGrad.ptr()); regIOobject::store(tgGrad.ptr());
} }
solution::cachePrintMessage("Retrieving", name, vsf); solution::cachePrintMessage("Retrieving", name, vsf);
GradFieldType& gGrad = VolField<GradType>& gGrad =
mesh().objectRegistry::template lookupObjectRef<GradFieldType> mesh().objectRegistry::template lookupObjectRef<VolField<GradType>>
( (
name name
); );
@ -126,12 +129,13 @@ Foam::fv::gradScheme<Type>::grad
delete &gGrad; delete &gGrad;
solution::cachePrintMessage("Recalculating", name, vsf); solution::cachePrintMessage("Recalculating", name, vsf);
tmp<GradFieldType> tgGrad = calcGrad(vsf, name); tmp<VolField<GradType>> tgGrad = calcGrad(vsf, name);
solution::cachePrintMessage("Storing", name, vsf); solution::cachePrintMessage("Storing", name, vsf);
regIOobject::store(tgGrad.ptr()); regIOobject::store(tgGrad.ptr());
GradFieldType& gGrad = VolField<GradType>& gGrad =
mesh().objectRegistry::template lookupObjectRef<GradFieldType> mesh().objectRegistry::template
lookupObjectRef<VolField<GradType>>
( (
name name
); );
@ -141,10 +145,15 @@ Foam::fv::gradScheme<Type>::grad
} }
else else
{ {
if (mesh().objectRegistry::template foundObject<GradFieldType>(name)) if
(
mesh().objectRegistry::template
foundObject<VolField<GradType>>(name)
)
{ {
GradFieldType& gGrad = VolField<GradType>& gGrad =
mesh().objectRegistry::template lookupObjectRef<GradFieldType> mesh().objectRegistry::template
lookupObjectRef<VolField<GradType>>
( (
name name
); );
@ -198,9 +207,8 @@ Foam::fv::gradScheme<Type>::grad
) const ) const
{ {
typedef typename outerProduct<vector, Type>::type GradType; typedef typename outerProduct<vector, Type>::type GradType;
typedef GeometricField<GradType, fvPatchField, volMesh> GradFieldType;
tmp<GradFieldType> tgrad = grad(tvsf()); tmp<VolField<GradType>> tgrad = grad(tvsf());
tvsf.clear(); tvsf.clear();
return tgrad; return tgrad;
} }

View File

@ -139,8 +139,7 @@ class fvMatrix
//- Face flux field for non-orthogonal correction //- Face flux field for non-orthogonal correction
mutable GeometricField<Type, fvsPatchField, surfaceMesh> mutable SurfaceField<Type>* faceFluxCorrectionPtr_;
*faceFluxCorrectionPtr_;
protected: protected:
@ -330,13 +329,8 @@ public:
return boundaryCoeffs_; return boundaryCoeffs_;
} }
//- Declare return type of the faceFluxCorrectionPtr() function
typedef GeometricField<Type, fvsPatchField, surfaceMesh>
*surfaceTypeFieldPtr;
//- Return pointer to face-flux non-orthogonal correction field //- Return pointer to face-flux non-orthogonal correction field
surfaceTypeFieldPtr& faceFluxCorrectionPtr() SurfaceField<Type>*& faceFluxCorrectionPtr()
{ {
return faceFluxCorrectionPtr_; return faceFluxCorrectionPtr_;
} }

View File

@ -46,8 +46,6 @@ Foam::tmp
) )
{ {
typedef typename outerProduct<WeightType, Type>::type WeightedType; typedef typename outerProduct<WeightType, Type>::type WeightedType;
typedef GeometricField<WeightedType, fvPatchField, volMesh>
WeightedFieldType;
const fvMesh& mesh = fld.mesh(); const fvMesh& mesh = fld.mesh();
@ -55,9 +53,9 @@ Foam::tmp
List<List<Type>> stencilFld; List<List<Type>> stencilFld;
extendedCellToFaceStencil::collectData(map, stencil, fld, stencilFld); extendedCellToFaceStencil::collectData(map, stencil, fld, stencilFld);
tmp<WeightedFieldType> twf tmp<VolField<WeightedType>> twf
( (
new WeightedFieldType new VolField<WeightedType>
( (
IOobject IOobject
( (
@ -74,7 +72,7 @@ Foam::tmp
) )
) )
); );
WeightedFieldType& wf = twf(); VolField<WeightedType>& wf = twf();
forAll(wf, celli) forAll(wf, celli)
{ {

View File

@ -86,12 +86,10 @@ Foam::fvMeshToFvMesh::mapSrcToTgt
const GeometricField<Type, fvPatchField, volMesh>& field const GeometricField<Type, fvPatchField, volMesh>& field
) const ) const
{ {
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const fvMesh& tgtMesh = static_cast<const fvMesh&>(meshToMesh::tgtMesh()); const fvMesh& tgtMesh = static_cast<const fvMesh&>(meshToMesh::tgtMesh());
const fvBoundaryMesh& tgtBm = tgtMesh.boundary(); const fvBoundaryMesh& tgtBm = tgtMesh.boundary();
const typename fieldType::Boundary& srcBfld = const typename VolField<Type>::Boundary& srcBfld =
field.boundaryField(); field.boundaryField();
PtrList<fvPatchField<Type>> tgtPatchFields(tgtBm.size()); PtrList<fvPatchField<Type>> tgtPatchFields(tgtBm.size());
@ -143,9 +141,9 @@ Foam::fvMeshToFvMesh::mapSrcToTgt
} }
} }
tmp<fieldType> tresult tmp<VolField<Type>> tresult
( (
new fieldType new VolField<Type>
( (
IOobject IOobject
( (

View File

@ -421,18 +421,16 @@ Foam::volPointInterpolation::interpolate
const bool cache const bool cache
) const ) const
{ {
typedef GeometricField<Type, pointPatchField, pointMesh> PointFieldType;
const pointMesh& pm = pointMesh::New(vf.mesh()); const pointMesh& pm = pointMesh::New(vf.mesh());
const objectRegistry& db = pm.thisDb(); const objectRegistry& db = pm.thisDb();
if (!cache || vf.mesh().changing()) if (!cache || vf.mesh().changing())
{ {
// Delete any old occurrences to avoid double registration // Delete any old occurrences to avoid double registration
if (db.objectRegistry::template foundObject<PointFieldType>(name)) if (db.objectRegistry::template foundObject<PointField<Type>>(name))
{ {
PointFieldType& pf = PointField<Type>& pf =
db.objectRegistry::template lookupObjectRef<PointFieldType> db.objectRegistry::template lookupObjectRef<PointField<Type>>
( (
name name
); );
@ -462,18 +460,18 @@ Foam::volPointInterpolation::interpolate
} }
else else
{ {
if (!db.objectRegistry::template foundObject<PointFieldType>(name)) if (!db.objectRegistry::template foundObject<PointField<Type>>(name))
{ {
solution::cachePrintMessage("Calculating and caching", name, vf); solution::cachePrintMessage("Calculating and caching", name, vf);
tmp<PointFieldType> tpf = interpolate(vf, name, false); tmp<PointField<Type>> tpf = interpolate(vf, name, false);
PointFieldType* pfPtr = tpf.ptr(); PointField<Type>* pfPtr = tpf.ptr();
regIOobject::store(pfPtr); regIOobject::store(pfPtr);
return *pfPtr; return *pfPtr;
} }
else else
{ {
PointFieldType& pf = PointField<Type>& pf =
db.objectRegistry::template lookupObjectRef<PointFieldType> db.objectRegistry::template lookupObjectRef<PointField<Type>>
( (
name name
); );
@ -490,10 +488,10 @@ Foam::volPointInterpolation::interpolate
delete &pf; delete &pf;
solution::cachePrintMessage("Recalculating", name, vf); solution::cachePrintMessage("Recalculating", name, vf);
tmp<PointFieldType> tpf = interpolate(vf, name, false); tmp<PointField<Type>> tpf = interpolate(vf, name, false);
solution::cachePrintMessage("Storing", name, vf); solution::cachePrintMessage("Storing", name, vf);
PointFieldType* pfPtr = tpf.ptr(); PointField<Type>* pfPtr = tpf.ptr();
regIOobject::store(pfPtr); regIOobject::store(pfPtr);
// Note: return reference, not pointer // Note: return reference, not pointer

View File

@ -158,18 +158,16 @@ Foam::volPointInterpolation::interpolate
const bool cache const bool cache
) const ) const
{ {
typedef GeometricField<Type, pointPatchField, pointMesh> PointFieldType;
const pointMesh& pm = pointMesh::New(vf.mesh()); const pointMesh& pm = pointMesh::New(vf.mesh());
const objectRegistry& db = pm.thisDb(); const objectRegistry& db = pm.thisDb();
if (!cache || vf.mesh().changing()) if (!cache || vf.mesh().changing())
{ {
// Delete any old occurrences to avoid double registration // Delete any old occurrences to avoid double registration
if (db.objectRegistry::template foundObject<PointFieldType>(name)) if (db.objectRegistry::template foundObject<PointField<Type>>(name))
{ {
PointFieldType& pf = PointField<Type>& pf =
db.objectRegistry::template lookupObjectRef<PointFieldType> db.objectRegistry::template lookupObjectRef<PointField<Type>>
( (
name name
); );
@ -198,18 +196,18 @@ Foam::volPointInterpolation::interpolate
} }
else else
{ {
if (!db.objectRegistry::template foundObject<PointFieldType>(name)) if (!db.objectRegistry::template foundObject<PointField<Type>>(name))
{ {
solution::cachePrintMessage("Calculating and caching", name, vf); solution::cachePrintMessage("Calculating and caching", name, vf);
tmp<PointFieldType> tpf = interpolate(vf, name, false); tmp<PointField<Type>> tpf = interpolate(vf, name, false);
PointFieldType* pfPtr = tpf.ptr(); PointField<Type>* pfPtr = tpf.ptr();
regIOobject::store(pfPtr); regIOobject::store(pfPtr);
return *pfPtr; return *pfPtr;
} }
else else
{ {
PointFieldType& pf = PointField<Type>& pf =
db.objectRegistry::template lookupObjectRef<PointFieldType> db.objectRegistry::template lookupObjectRef<PointField<Type>>
( (
name name
); );
@ -226,10 +224,10 @@ Foam::volPointInterpolation::interpolate
delete &pf; delete &pf;
solution::cachePrintMessage("Recalculating", name, vf); solution::cachePrintMessage("Recalculating", name, vf);
tmp<PointFieldType> tpf = interpolate(vf, name, false); tmp<PointField<Type>> tpf = interpolate(vf, name, false);
solution::cachePrintMessage("Storing", name, vf); solution::cachePrintMessage("Storing", name, vf);
PointFieldType* pfPtr = tpf.ptr(); PointField<Type>* pfPtr = tpf.ptr();
regIOobject::store(pfPtr); regIOobject::store(pfPtr);
return *pfPtr; return *pfPtr;

View File

@ -201,7 +201,7 @@ void NaNGeometricFields
const fvMeshToFvMesh& mapper const fvMeshToFvMesh& mapper
) )
{ {
typedef GeometricField<Type, PatchField, GeoMesh> Gfield; typedef GeometricField<Type, PatchField, GeoMesh> GField;
//- Mapper for sizing only - does not do any actual mapping. //- Mapper for sizing only - does not do any actual mapping.
class patchFieldResizeMapper class patchFieldResizeMapper
@ -220,25 +220,25 @@ void NaNGeometricFields
{} {}
}; };
HashTable<const Gfield*> fields HashTable<const GField*> fields
( (
mesh.objectRegistry::template lookupClass<Gfield>() mesh.objectRegistry::template lookupClass<GField>()
); );
// Deleted old time fields // Deleted old time fields
for for
( (
typename HashTable<const Gfield*>:: typename HashTable<const GField*>::
iterator fieldIter = fields.begin(); iterator fieldIter = fields.begin();
fieldIter != fields.end(); fieldIter != fields.end();
++fieldIter ++fieldIter
) )
{ {
Gfield& field = const_cast<Gfield&>(*fieldIter()); GField& field = const_cast<GField&>(*fieldIter());
field.clearOldTimes(); field.clearOldTimes();
} }
fields = mesh.objectRegistry::template lookupClass<Gfield>(); fields = mesh.objectRegistry::template lookupClass<GField>();
Type NaN; Type NaN;
@ -249,12 +249,12 @@ void NaNGeometricFields
for for
( (
typename HashTable<const Gfield*>::iterator fieldIter = fields.begin(); typename HashTable<const GField*>::iterator fieldIter = fields.begin();
fieldIter != fields.end(); fieldIter != fields.end();
++fieldIter ++fieldIter
) )
{ {
Gfield& field = const_cast<Gfield&>(*fieldIter()); GField& field = const_cast<GField&>(*fieldIter());
if (fvMeshToFvMesh::debug) if (fvMeshToFvMesh::debug)
{ {
@ -262,7 +262,7 @@ void NaNGeometricFields
<< endl; << endl;
} }
const typename Gfield::Mesh& mesh = field.mesh(); const typename GField::Mesh& mesh = field.mesh();
field.primitiveFieldRef().setSize(GeoMesh::size(mesh)); field.primitiveFieldRef().setSize(GeoMesh::size(mesh));
field.primitiveFieldRef() = NaN; field.primitiveFieldRef() = NaN;
@ -286,7 +286,7 @@ void NaNGeometricFields
} }
else else
{ {
typename Gfield::Patch& pf = field.boundaryFieldRef()[patchi]; typename GField::Patch& pf = field.boundaryFieldRef()[patchi];
pf.autoMap(patchFieldResizeMapper(pf.patch().size())); pf.autoMap(patchFieldResizeMapper(pf.patch().size()));
} }

View File

@ -66,21 +66,26 @@ void Foam::fvMeshTopoChangers::raw::zeroUnmappedValues
const PackedBoolList& mappedFace const PackedBoolList& mappedFace
) const ) const
{ {
typedef GeometricField<Type, PatchField, GeoMesh> FieldType; const wordList fldNames
(
const wordList fldNames(mesh().names(FieldType::typeName)); mesh().names(GeometricField<Type, PatchField, GeoMesh>::typeName)
);
forAll(fldNames, i) forAll(fldNames, i)
{ {
// Pout<< "Checking field " << fldNames[i] << endl; // Pout<< "Checking field " << fldNames[i] << endl;
FieldType& fld = mesh().lookupObjectRef<FieldType>(fldNames[i]); GeometricField<Type, PatchField, GeoMesh>& fld =
mesh().lookupObjectRef<GeometricField<Type, PatchField, GeoMesh>>
(
fldNames[i]
);
setUnmappedValues setUnmappedValues
( (
fld, fld,
mappedFace, mappedFace,
FieldType GeometricField<Type, PatchField, GeoMesh>
( (
IOobject IOobject
( (

View File

@ -164,13 +164,11 @@ void Foam::fv::rotorDiskSource::writeField
const bool writeNow const bool writeNow
) const ) const
{ {
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
if (mesh().time().writeTime() || writeNow) if (mesh().time().writeTime() || writeNow)
{ {
tmp<fieldType> tfield tmp<VolField<Type>> tfield
( (
new fieldType new VolField<Type>
( (
IOobject IOobject
( (