Commit 7fb27394 authored by Henry Weller's avatar Henry Weller
Browse files

functionObjects: Standardized field template parameter names

parent 28359c53
......@@ -81,18 +81,21 @@ void Foam::functionObjects::fieldAverage::addMeanField(const label fieldi)
{
if (faItems_[fieldi].mean())
{
typedef GeometricField<Type, fvPatchField, volMesh> volFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> surfFieldType;
typedef GeometricField<Type, fvPatchField, volMesh>
VolFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh>
SurfaceFieldType;
const word& fieldName = faItems_[fieldi].fieldName();
if (obr_.foundObject<volFieldType>(fieldName))
if (obr_.foundObject<VolFieldType>(fieldName))
{
addMeanFieldType<volFieldType>(fieldi);
addMeanFieldType<VolFieldType>(fieldi);
}
else if (obr_.foundObject<surfFieldType>(fieldName))
else if (obr_.foundObject<SurfaceFieldType>(fieldName))
{
addMeanFieldType<surfFieldType>(fieldi);
addMeanFieldType<SurfaceFieldType>(fieldi);
}
}
}
......@@ -152,11 +155,11 @@ void Foam::functionObjects::fieldAverage::addPrime2MeanFieldType
template<class Type1, class Type2>
void Foam::functionObjects::fieldAverage::addPrime2MeanField(const label fieldi)
{
typedef GeometricField<Type1, fvPatchField, volMesh> volFieldType1;
typedef GeometricField<Type1, fvsPatchField, surfaceMesh> surfFieldType1;
typedef GeometricField<Type1, fvPatchField, volMesh> VolFieldType1;
typedef GeometricField<Type1, fvsPatchField, surfaceMesh> SurfaceFieldType1;
typedef GeometricField<Type2, fvPatchField, volMesh> volFieldType2;
typedef GeometricField<Type2, fvsPatchField, surfaceMesh> surfFieldType2;
typedef GeometricField<Type2, fvPatchField, volMesh> VolFieldType2;
typedef GeometricField<Type2, fvsPatchField, surfaceMesh> SurfaceFieldType2;
if (faItems_[fieldi].prime2Mean())
{
......@@ -170,13 +173,16 @@ void Foam::functionObjects::fieldAverage::addPrime2MeanField(const label fieldi)
<< fieldName << nl << exit(FatalError);
}
if (obr_.foundObject<volFieldType1>(fieldName))
if (obr_.foundObject<VolFieldType1>(fieldName))
{
addPrime2MeanFieldType<volFieldType1, volFieldType2>(fieldi);
addPrime2MeanFieldType<VolFieldType1, VolFieldType2>(fieldi);
}
else if (obr_.foundObject<surfFieldType1>(fieldName))
else if (obr_.foundObject<SurfaceFieldType1>(fieldName))
{
addPrime2MeanFieldType<surfFieldType1, surfFieldType2>(fieldi);
addPrime2MeanFieldType<SurfaceFieldType1, SurfaceFieldType2>
(
fieldi
);
}
}
}
......@@ -230,15 +236,15 @@ void Foam::functionObjects::fieldAverage::calculateMeanFieldType
template<class Type>
void Foam::functionObjects::fieldAverage::calculateMeanFields() const
{
typedef GeometricField<Type, fvPatchField, volMesh> volFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> surfFieldType;
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
forAll(faItems_, i)
{
if (faItems_[i].mean())
{
calculateMeanFieldType<volFieldType>(i);
calculateMeanFieldType<surfFieldType>(i);
calculateMeanFieldType<VolFieldType>(i);
calculateMeanFieldType<SurfaceFieldType>(i);
}
}
}
......@@ -297,18 +303,25 @@ void Foam::functionObjects::fieldAverage::calculatePrime2MeanFieldType
template<class Type1, class Type2>
void Foam::functionObjects::fieldAverage::calculatePrime2MeanFields() const
{
typedef GeometricField<Type1, fvPatchField, volMesh> volFieldType1;
typedef GeometricField<Type1, fvsPatchField, surfaceMesh> surfFieldType1;
typedef GeometricField<Type1, fvPatchField, volMesh> VolFieldType1;
typedef GeometricField<Type1, fvsPatchField, surfaceMesh> SurfaceFieldType1;
typedef GeometricField<Type2, fvPatchField, volMesh> volFieldType2;
typedef GeometricField<Type2, fvsPatchField, surfaceMesh> surfFieldType2;
typedef GeometricField<Type2, fvPatchField, volMesh> VolFieldType2;
typedef GeometricField<Type2, fvsPatchField, surfaceMesh> SurfaceFieldType2;
forAll(faItems_, i)
{
if (faItems_[i].prime2Mean())
{
calculatePrime2MeanFieldType<volFieldType1, volFieldType2>(i);
calculatePrime2MeanFieldType<surfFieldType1, surfFieldType2>(i);
calculatePrime2MeanFieldType<VolFieldType1, VolFieldType2>
(
i
);
calculatePrime2MeanFieldType<SurfaceFieldType1, SurfaceFieldType2>
(
i
);
}
}
}
......@@ -340,18 +353,18 @@ void Foam::functionObjects::fieldAverage::addMeanSqrToPrime2MeanType
template<class Type1, class Type2>
void Foam::functionObjects::fieldAverage::addMeanSqrToPrime2Mean() const
{
typedef GeometricField<Type1, fvPatchField, volMesh> volFieldType1;
typedef GeometricField<Type1, fvsPatchField, surfaceMesh> surfFieldType1;
typedef GeometricField<Type1, fvPatchField, volMesh> VolFieldType1;
typedef GeometricField<Type1, fvsPatchField, surfaceMesh> SurfaceFieldType1;
typedef GeometricField<Type2, fvPatchField, volMesh> volFieldType2;
typedef GeometricField<Type2, fvsPatchField, surfaceMesh> surfFieldType2;
typedef GeometricField<Type2, fvPatchField, volMesh> VolFieldType2;
typedef GeometricField<Type2, fvsPatchField, surfaceMesh> SurfaceFieldType2;
forAll(faItems_, i)
{
if (faItems_[i].prime2Mean())
{
addMeanSqrToPrime2MeanType<volFieldType1, volFieldType2>(i);
addMeanSqrToPrime2MeanType<surfFieldType1, surfFieldType2>(i);
addMeanSqrToPrime2MeanType<VolFieldType1, VolFieldType2>(i);
addMeanSqrToPrime2MeanType<SurfaceFieldType1, SurfaceFieldType2>(i);
}
}
}
......@@ -374,22 +387,22 @@ void Foam::functionObjects::fieldAverage::writeFieldType
template<class Type>
void Foam::functionObjects::fieldAverage::writeFields() const
{
typedef GeometricField<Type, fvPatchField, volMesh> volFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> surfFieldType;
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
forAll(faItems_, i)
{
if (faItems_[i].mean())
{
const word& fieldName = faItems_[i].meanFieldName();
writeFieldType<volFieldType>(fieldName);
writeFieldType<surfFieldType>(fieldName);
writeFieldType<VolFieldType>(fieldName);
writeFieldType<SurfaceFieldType>(fieldName);
}
if (faItems_[i].prime2Mean())
{
const word& fieldName = faItems_[i].prime2MeanFieldName();
writeFieldType<volFieldType>(fieldName);
writeFieldType<surfFieldType>(fieldName);
writeFieldType<VolFieldType>(fieldName);
writeFieldType<SurfaceFieldType>(fieldName);
}
}
}
......
......@@ -33,13 +33,13 @@ void Foam::functionObjects::nearWallFields::createFields
PtrList<GeometricField<Type, fvPatchField, volMesh>>& sflds
) const
{
typedef GeometricField<Type, fvPatchField, volMesh> vfType;
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
HashTable<const vfType*> flds(obr_.lookupClass<vfType>());
HashTable<const VolFieldType*> flds(obr_.lookupClass<VolFieldType>());
forAllConstIter(typename HashTable<const vfType*>, flds, iter)
forAllConstIter(typename HashTable<const VolFieldType*>, flds, iter)
{
const vfType& fld = *iter();
const VolFieldType& fld = *iter();
if (fieldMap_.found(fld.name()))
{
......@@ -61,7 +61,7 @@ void Foam::functionObjects::nearWallFields::createFields
io.writeOpt() = IOobject::NO_WRITE;
io.rename(sampleFldName);
sflds.set(sz, new vfType(io, fld));
sflds.set(sz, new VolFieldType(io, fld));
Info<< " created " << sflds[sz].name() << " to sample "
<< fld.name() << endl;
......@@ -127,12 +127,12 @@ void Foam::functionObjects::nearWallFields::sampleFields
PtrList<GeometricField<Type, fvPatchField, volMesh>>& sflds
) const
{
typedef GeometricField<Type, fvPatchField, volMesh> vfType;
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
forAll(sflds, i)
{
const word& fldName = reverseFieldMap_[sflds[i].name()];
const vfType& fld = obr_.lookupObject<vfType>(fldName);
const VolFieldType& fld = obr_.lookupObject<VolFieldType>(fldName);
// Take over internal and boundary values
sflds[i] == fld;
......
......@@ -38,10 +38,10 @@ void Foam::functionObjects::readFields::loadField
PtrList<GeometricField<Type, fvsPatchField, surfaceMesh>>& sflds
) const
{
typedef GeometricField<Type, fvPatchField, volMesh> vfType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sfType;
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
if (obr_.foundObject<vfType>(fieldName))
if (obr_.foundObject<VolFieldType>(fieldName))
{
if (debug)
{
......@@ -49,7 +49,7 @@ void Foam::functionObjects::readFields::loadField
<< endl;
}
}
else if (obr_.foundObject<sfType>(fieldName))
else if (obr_.foundObject<SurfaceFieldType>(fieldName))
{
if (debug)
{
......@@ -71,26 +71,26 @@ void Foam::functionObjects::readFields::loadField
if
(
fieldHeader.headerOk()
&& fieldHeader.headerClassName() == vfType::typeName
&& fieldHeader.headerClassName() == VolFieldType::typeName
)
{
// store field locally
Info<< " Reading " << fieldName << endl;
label sz = vflds.size();
vflds.setSize(sz+1);
vflds.set(sz, new vfType(fieldHeader, mesh_));
vflds.set(sz, new VolFieldType(fieldHeader, mesh_));
}
else if
(
fieldHeader.headerOk()
&& fieldHeader.headerClassName() == sfType::typeName
&& fieldHeader.headerClassName() == SurfaceFieldType::typeName
)
{
// store field locally
Info<< " Reading " << fieldName << endl;
label sz = sflds.size();
sflds.setSize(sz+1);
sflds.set(sz, new sfType(fieldHeader, mesh_));
sflds.set(sz, new SurfaceFieldType(fieldHeader, mesh_));
}
}
}
......
......@@ -35,8 +35,8 @@ void Foam::functionObjects::surfaceInterpolateFields::interpolateFields
PtrList<GeometricField<Type, fvsPatchField, surfaceMesh>>& sflds
) const
{
typedef GeometricField<Type, fvPatchField, volMesh> vfType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sfType;
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
// Convert field to map
HashTable<word> fieldMap(2*fieldSet_.size());
......@@ -46,11 +46,11 @@ void Foam::functionObjects::surfaceInterpolateFields::interpolateFields
}
HashTable<const vfType*> flds(obr_.lookupClass<vfType>());
HashTable<const VolFieldType*> flds(obr_.lookupClass<VolFieldType>());
forAllConstIter(typename HashTable<const vfType*>, flds, iter)
forAllConstIter(typename HashTable<const VolFieldType*>, flds, iter)
{
const vfType& fld = *iter();
const VolFieldType& fld = *iter();
if (fieldMap.found(fld.name()))
{
......@@ -66,7 +66,11 @@ void Foam::functionObjects::surfaceInterpolateFields::interpolateFields
{
label sz = sflds.size();
sflds.setSize(sz+1);
sflds.set(sz, new sfType(sName, linearInterpolate(fld)));
sflds.set
(
sz,
new SurfaceFieldType(sName, linearInterpolate(fld))
);
Info<< " interpolated " << fld.name() << " to create "
<< sflds[sz].name() << endl;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment