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
)
{
typedef GeometricField<Type, PatchField, GeoMesh> GeoField;
// Search list of objects for fields of type GeomField
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
// Search list of objects for fields
IOobjectList fieldObjects(objects.lookupClass
(
GeometricField<Type, PatchField, GeoMesh>::typeName)
);
// Remove the cellProc field
IOobjectList::iterator cellProcIter = fieldObjects.find("cellProc");
@ -59,7 +60,16 @@ void Foam::readFields
{
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;
}
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const word timeName(mesh.time().name());
IOobjectList fieldObjbjects(objects.lookupClass(fieldType::typeName));
IOobjectList fieldObjbjects(objects.lookupClass(VolField<Type>::typeName));
if (fieldObjbjects.lookup(fieldName) != nullptr)
{
fieldType vtf(*fieldObjbjects.lookup(fieldName), mesh);
const typename fieldType::Boundary& bf =
VolField<Type> vtf(*fieldObjbjects.lookup(fieldName), mesh);
const typename VolField<Type>::Boundary& bf =
vtf.boundaryField();
forAll(bf, patchi)

View File

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

View File

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

View File

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

View File

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

View File

@ -113,30 +113,30 @@ class fvMeshDistribute
label findNonEmptyPatch() const;
//- Save boundary fields
template<class T, class Mesh>
template<class Type, class Mesh>
void saveBoundaryFields
(
PtrList<FieldField<fvsPatchField, T>>& bflds
PtrList<FieldField<fvsPatchField, Type>>& bflds
) const;
//- Map boundary fields
template<class T, class Mesh>
template<class Type, class Mesh>
void mapBoundaryFields
(
const polyTopoChangeMap& map,
const PtrList<FieldField<fvsPatchField, T>>& oldBflds
const PtrList<FieldField<fvsPatchField, Type>>& oldBflds
);
//- Set value of exposed patch faces
template<class T>
void initMapExposedFaces(PtrList<Field<T>>& iflds) const;
template<class Type>
void initMapExposedFaces(PtrList<Field<Type>>& iflds) const;
//- Set value of exposed patch faces
template<class T>
template<class Type>
void mapExposedFaces
(
const polyTopoChangeMap& map,
const PtrList<Field<T>>& oldFlds
const PtrList<Field<Type>>& oldFlds
);
//- 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
(
PtrList<FieldField<fvsPatchField, T>>& bflds
PtrList<FieldField<fvsPatchField, Type>>& bflds
) const
{
// Save whole boundary field
typedef GeometricField<T, fvsPatchField, Mesh> fldType;
HashTable<const fldType*> flds
HashTable<const SurfaceField<Type>*> flds
(
static_cast<const fvMesh&>(mesh_).objectRegistry::lookupClass<fldType>()
static_cast<const fvMesh&>(mesh_)
.objectRegistry::lookupClass<SurfaceField<Type>>()
);
bflds.setSize(flds.size());
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());
@ -85,11 +84,11 @@ void Foam::fvMeshDistribute::saveBoundaryFields
}
template<class T, class Mesh>
template<class Type, class Mesh>
void Foam::fvMeshDistribute::mapBoundaryFields
(
const polyTopoChangeMap& map,
const PtrList<FieldField<fvsPatchField, T>>& oldBflds
const PtrList<FieldField<fvsPatchField, Type>>& oldBflds
)
{
// Map boundary field
@ -97,11 +96,9 @@ void Foam::fvMeshDistribute::mapBoundaryFields
const labelList& oldPatchStarts = map.oldPatchStarts();
const labelList& faceMap = map.faceMap();
typedef GeometricField<T, fvsPatchField, Mesh> fldType;
HashTable<fldType*> flds
HashTable<SurfaceField<Type>*> flds
(
mesh_.objectRegistry::lookupClass<fldType>()
mesh_.objectRegistry::lookupClass<SurfaceField<Type>>()
);
if (flds.size() != oldBflds.size())
@ -112,19 +109,19 @@ void Foam::fvMeshDistribute::mapBoundaryFields
label fieldi = 0;
forAllIter(typename HashTable<fldType*>, flds, iter)
forAllIter(typename HashTable<SurfaceField<Type>*>, flds, iter)
{
fldType& fld = *iter();
typename fldType::Boundary& bfld =
SurfaceField<Type>& fld = *iter();
typename SurfaceField<Type>::Boundary& bfld =
fld.boundaryFieldRef();
const FieldField<fvsPatchField, T>& oldBfld = oldBflds[fieldi++];
const FieldField<fvsPatchField, Type>& oldBfld = oldBflds[fieldi++];
// Pull from old boundary field into bfld.
forAll(bfld, patchi)
{
fvsPatchField<T>& patchFld = bfld[patchi];
fvsPatchField<Type>& patchFld = bfld[patchi];
label facei = patchFld.patch().start();
forAll(patchFld, i)
@ -147,35 +144,35 @@ void Foam::fvMeshDistribute::mapBoundaryFields
}
template<class T>
template<class Type>
void Foam::fvMeshDistribute::initMapExposedFaces
(
PtrList<Field<T>>& iflds
PtrList<Field<Type>>& iflds
) 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());
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();
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;
}
@ -184,31 +181,31 @@ void Foam::fvMeshDistribute::initMapExposedFaces
}
template<class T>
template<class Type>
void Foam::fvMeshDistribute::mapExposedFaces
(
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;
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);
forAll(fld.boundaryField(), patchi)
{
fvsPatchField<T>& patchFld = fld.boundaryFieldRef()[patchi];
fvsPatchField<Type>& patchFld = fld.boundaryFieldRef()[patchi];
forAll(patchFld, i)
{

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-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -38,8 +38,6 @@ void Foam::motionSmootherAlgo::checkConstraints
GeometricField<Type, pointPatchField, pointMesh>& pf
)
{
typedef GeometricField<Type, pointPatchField, pointMesh> FldType;
const polyMesh& mesh = pf.mesh();
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

View File

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

View File

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

View File

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

View File

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

View File

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

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
@ -109,8 +109,8 @@ Foam::cyclicFvsPatchField<Type>::patchNeighbourField
const Pstream::commsTypes commsType
) const
{
typedef GeometricField<Type, fvsPatchField, surfaceMesh> geoField;
const geoField& gf = refCast<const geoField>(this->internalField());
const SurfaceField<Type>& gf =
refCast<const SurfaceField<Type>>(this->internalField());
const cyclicFvPatch& cp = refCast<const cyclicFvPatch>(this->patch());

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -86,12 +86,10 @@ Foam::fvMeshToFvMesh::mapSrcToTgt
const GeometricField<Type, fvPatchField, volMesh>& field
) const
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const fvMesh& tgtMesh = static_cast<const fvMesh&>(meshToMesh::tgtMesh());
const fvBoundaryMesh& tgtBm = tgtMesh.boundary();
const typename fieldType::Boundary& srcBfld =
const typename VolField<Type>::Boundary& srcBfld =
field.boundaryField();
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
(

View File

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

View File

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

View File

@ -201,7 +201,7 @@ void NaNGeometricFields
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.
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
for
(
typename HashTable<const Gfield*>::
typename HashTable<const GField*>::
iterator fieldIter = fields.begin();
fieldIter != fields.end();
++fieldIter
)
{
Gfield& field = const_cast<Gfield&>(*fieldIter());
GField& field = const_cast<GField&>(*fieldIter());
field.clearOldTimes();
}
fields = mesh.objectRegistry::template lookupClass<Gfield>();
fields = mesh.objectRegistry::template lookupClass<GField>();
Type NaN;
@ -249,12 +249,12 @@ void NaNGeometricFields
for
(
typename HashTable<const Gfield*>::iterator fieldIter = fields.begin();
typename HashTable<const GField*>::iterator fieldIter = fields.begin();
fieldIter != fields.end();
++fieldIter
)
{
Gfield& field = const_cast<Gfield&>(*fieldIter());
GField& field = const_cast<GField&>(*fieldIter());
if (fvMeshToFvMesh::debug)
{
@ -262,7 +262,7 @@ void NaNGeometricFields
<< endl;
}
const typename Gfield::Mesh& mesh = field.mesh();
const typename GField::Mesh& mesh = field.mesh();
field.primitiveFieldRef().setSize(GeoMesh::size(mesh));
field.primitiveFieldRef() = NaN;
@ -286,7 +286,7 @@ void NaNGeometricFields
}
else
{
typename Gfield::Patch& pf = field.boundaryFieldRef()[patchi];
typename GField::Patch& pf = field.boundaryFieldRef()[patchi];
pf.autoMap(patchFieldResizeMapper(pf.patch().size()));
}

View File

@ -66,21 +66,26 @@ void Foam::fvMeshTopoChangers::raw::zeroUnmappedValues
const PackedBoolList& mappedFace
) const
{
typedef GeometricField<Type, PatchField, GeoMesh> FieldType;
const wordList fldNames(mesh().names(FieldType::typeName));
const wordList fldNames
(
mesh().names(GeometricField<Type, PatchField, GeoMesh>::typeName)
);
forAll(fldNames, i)
{
// 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
(
fld,
mappedFace,
FieldType
GeometricField<Type, PatchField, GeoMesh>
(
IOobject
(

View File

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