Commit 90ea219f authored by Mark Olesen's avatar Mark Olesen
Browse files

COMP: 'template' keyword for specialization with '.' or '->'

parent 5f9d20e1
......@@ -941,7 +941,14 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::relax()
{
word name = this->name();
if (this->mesh().data::lookupOrDefault<bool>("finalIteration", false))
if
(
this->mesh().data::template lookupOrDefault<bool>
(
"finalIteration",
false
)
)
{
name += "Final";
}
......
......@@ -74,8 +74,8 @@ void MapGeometricFields
{
HashTable<const GeometricField<Type, PatchField, GeoMesh>*> fields
(
mapper.thisDb().objectRegistry::lookupClass
<GeometricField<Type, PatchField, GeoMesh> >()
mapper.thisDb().objectRegistry::template
lookupClass<GeometricField<Type, PatchField, GeoMesh> >()
);
// It is necessary to enforce that all old-time fields are stored
......
......@@ -52,13 +52,22 @@ const Type& Foam::MeshObject<Mesh, Type>::New
const Mesh& mesh
)
{
if (!mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
if
(
mesh.thisDb().objectRegistry::template foundObject<Type>
(
Type::typeName
)
)
{
return store(new Type(mesh));
return mesh.thisDb().objectRegistry::template lookupObject<Type>
(
Type::typeName
);
}
else
{
return mesh.thisDb().objectRegistry::lookupObject<Type>(Type::typeName);
return store(new Type(mesh));
}
}
......@@ -71,13 +80,22 @@ const Type& Foam::MeshObject<Mesh, Type>::New
const Data1& d
)
{
if (!mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
if
(
mesh.thisDb().objectRegistry::template foundObject<Type>
(
Type::typeName
)
)
{
return store(new Type(mesh, d));
return mesh.thisDb().objectRegistry::template lookupObject<Type>
(
Type::typeName
);
}
else
{
return mesh.thisDb().objectRegistry::lookupObject<Type>(Type::typeName);
return store(new Type(mesh, d));
}
}
......@@ -91,13 +109,22 @@ const Type& Foam::MeshObject<Mesh, Type>::New
const Data2& d2
)
{
if (!mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
if
(
mesh.thisDb().objectRegistry::template foundObject<Type>
(
Type::typeName
)
)
{
return store(new Type(mesh, d1, d2));
return mesh.thisDb().objectRegistry::template lookupObject<Type>
(
Type::typeName
);
}
else
{
return mesh.thisDb().objectRegistry::lookupObject<Type>(Type::typeName);
return store(new Type(mesh, d1, d2));
}
}
......@@ -112,13 +139,22 @@ const Type& Foam::MeshObject<Mesh, Type>::New
const Data3& d3
)
{
if (!mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
if
(
mesh.thisDb().objectRegistry::template foundObject<Type>
(
Type::typeName
)
)
{
return store(new Type(mesh, d1, d2, d3));
return mesh.thisDb().objectRegistry::template lookupObject<Type>
(
Type::typeName
);
}
else
{
return mesh.thisDb().objectRegistry::lookupObject<Type>(Type::typeName);
return store(new Type(mesh, d1, d2, d3));
}
}
......@@ -134,13 +170,22 @@ const Type& Foam::MeshObject<Mesh, Type>::New
const Data4& d4
)
{
if (!mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
if
(
mesh.thisDb().objectRegistry::template foundObject<Type>
(
Type::typeName
)
)
{
return store(new Type(mesh, d1, d2, d3, d4));
return mesh.thisDb().objectRegistry::template lookupObject<Type>
(
Type::typeName
);
}
else
{
return mesh.thisDb().objectRegistry::lookupObject<Type>(Type::typeName);
return store(new Type(mesh, d1, d2, d3, d4));
}
}
......@@ -150,13 +195,19 @@ const Type& Foam::MeshObject<Mesh, Type>::New
template<class Mesh, class Type>
bool Foam::MeshObject<Mesh, Type>::Delete(const Mesh& mesh)
{
if (mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
if
(
mesh.thisDb().objectRegistry::template foundObject<Type>
(
Type::typeName
)
)
{
return mesh.thisDb().checkOut
(
const_cast<Type&>
(
mesh.thisDb().objectRegistry::lookupObject<Type>
mesh.thisDb().objectRegistry::template lookupObject<Type>
(
Type::typeName
)
......
......@@ -158,23 +158,23 @@ Foam::tmp<Foam::scalarField>
Foam::advectiveFvPatchField<Type>::advectionSpeed() const
{
const surfaceScalarField& phi =
this->db().objectRegistry::lookupObject<surfaceScalarField>(phiName_);
this->db().objectRegistry::template lookupObject<surfaceScalarField>
(phiName_);
fvsPatchField<scalar> phip =
this->patch().template lookupPatchField<surfaceScalarField, scalar>
(
phiName_
);
fvsPatchField<scalar> phip = this->patch().lookupPatchField
(
phiName_,
reinterpret_cast<const surfaceScalarField*>(0),
reinterpret_cast<const scalar*>(0)
);
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
const fvPatchScalarField& rhop = this->patch().lookupPatchField
(
rhoName_,
reinterpret_cast<const volScalarField*>(0),
reinterpret_cast<const scalar*>(0)
);
const fvPatchScalarField& rhop =
this->patch().template lookupPatchField<volScalarField, scalar>
(
rhoName_
);
return phip/(rhop*this->patch().magSf());
}
......@@ -201,7 +201,7 @@ void Foam::advectiveFvPatchField<Type>::updateCoeffs()
scalar deltaT = this->db().time().deltaTValue();
const GeometricField<Type, fvPatchField, volMesh>& field =
this->db().objectRegistry::
this->db().objectRegistry::template
lookupObject<GeometricField<Type, fvPatchField, volMesh> >
(
this->dimensionedInternalField().name()
......
......@@ -139,7 +139,9 @@ void Foam::outletMappedUniformInletFvPatchField<Type>::updateCoeffs()
f.boundaryField()[outletPatchID];
const surfaceScalarField& phi =
this->db().objectRegistry::lookupObject<surfaceScalarField>(phiName_);
this->db().objectRegistry::template lookupObject<surfaceScalarField>
(phiName_);
const scalarField& outletPatchPhi = phi.boundaryField()[outletPatchID];
scalar sumOutletPatchPhi = gSum(outletPatchPhi);
......
......@@ -115,7 +115,7 @@ Foam::waveTransmissiveFvPatchField<Type>::advectionSpeed() const
);
const surfaceScalarField& phi =
this->db().objectRegistry::lookupObject<surfaceScalarField>
this->db().objectRegistry::template lookupObject<surfaceScalarField>
(this->phiName_);
fvsPatchField<scalar> phip = this->patch().lookupPatchField
......
......@@ -50,7 +50,7 @@ CrankNicholsonDdtScheme<Type>::DDt0Field<GeoField>::DDt0Field
:
GeoField(io, mesh),
startTimeIndex_(-2) // This field is for a restart and thus correct so set
// the start time-index to corespond to a previous run
// the start time-index to correspond to a previous run
{
// Set the time-index to the beginning of the run to ensure the field
// is updated during the first time-step
......@@ -108,7 +108,7 @@ CrankNicholsonDdtScheme<Type>::ddt0_
const dimensionSet& dims
)
{
if (!mesh().objectRegistry::foundObject<GeoField>(name))
if (!mesh().objectRegistry::template foundObject<GeoField>(name))
{
const Time& runTime = mesh().time();
word startTimeName = runTime.timeName(runTime.startTime().value());
......@@ -173,7 +173,7 @@ CrankNicholsonDdtScheme<Type>::ddt0_
(
const_cast<GeoField&>
(
mesh().objectRegistry::lookupObject<GeoField>(name)
mesh().objectRegistry::template lookupObject<GeoField>(name)
)
);
......
......@@ -90,7 +90,8 @@ template<class Type>
tmp<volScalarField> SLTSDdtScheme<Type>::SLrDeltaT() const
{
const surfaceScalarField& phi =
mesh().objectRegistry::lookupObject<surfaceScalarField>(phiName_);
mesh().objectRegistry::template
lookupObject<surfaceScalarField>(phiName_);
const dimensionedScalar& deltaT = mesh().time().deltaT();
......@@ -125,8 +126,10 @@ tmp<volScalarField> SLTSDdtScheme<Type>::SLrDeltaT() const
else if (phi.dimensions() == dimensionSet(1, 0, -1, 0, 0))
{
const volScalarField& rho =
mesh().objectRegistry::lookupObject<volScalarField>(rhoName_)
.oldTime();
mesh().objectRegistry::template lookupObject<volScalarField>
(
rhoName_
).oldTime();
rDeltaT.internalField() = max
(
......
......@@ -42,7 +42,8 @@ namespace fv
template<class Type>
const volScalarField& localEulerDdtScheme<Type>::localRDeltaT() const
{
return mesh().objectRegistry::lookupObject<volScalarField>(rDeltaTName_);
return mesh().objectRegistry::template lookupObject<volScalarField>
(rDeltaTName_);
}
......
......@@ -127,7 +127,7 @@ Foam::fv::gradScheme<Type>::grad
if (!this->mesh().changing() && this->mesh().cache(name))
{
if (!mesh().objectRegistry::foundObject<GradFieldType>(name))
if (!mesh().objectRegistry::template foundObject<GradFieldType>(name))
{
cachePrintMessage("Calculating and caching", name, vsf);
tmp<GradFieldType> tgGrad = calcGrad(vsf, name);
......@@ -137,7 +137,7 @@ Foam::fv::gradScheme<Type>::grad
cachePrintMessage("Retreiving", name, vsf);
GradFieldType& gGrad = const_cast<GradFieldType&>
(
mesh().objectRegistry::lookupObject<GradFieldType>(name)
mesh().objectRegistry::template lookupObject<GradFieldType>(name)
);
if (gGrad.upToDate(vsf))
......@@ -157,7 +157,10 @@ Foam::fv::gradScheme<Type>::grad
regIOobject::store(tgGrad.ptr());
GradFieldType& gGrad = const_cast<GradFieldType&>
(
mesh().objectRegistry::lookupObject<GradFieldType>(name)
mesh().objectRegistry::template lookupObject<GradFieldType>
(
name
)
);
return gGrad;
......@@ -165,11 +168,14 @@ Foam::fv::gradScheme<Type>::grad
}
else
{
if (mesh().objectRegistry::foundObject<GradFieldType>(name))
if (mesh().objectRegistry::template foundObject<GradFieldType>(name))
{
GradFieldType& gGrad = const_cast<GradFieldType&>
(
mesh().objectRegistry::lookupObject<GradFieldType>(name)
mesh().objectRegistry::template lookupObject<GradFieldType>
(
name
)
);
if (gGrad.ownedByRegistry())
......
......@@ -37,7 +37,8 @@ const typename GeometricField::PatchFieldType& Foam::fvPatch::lookupPatchField
{
return patchField<GeometricField, Type>
(
boundaryMesh().mesh().objectRegistry::lookupObject<GeometricField>(name)
boundaryMesh().mesh().objectRegistry::template
lookupObject<GeometricField>(name)
);
}
......
......@@ -72,7 +72,7 @@ inline tmp<volScalarField> rhoMagSqr<Type>::operator()
) const
{
const volScalarField& rho =
phi.db().objectRegistry::lookupObject<volScalarField>("rho");
phi.db().objectRegistry::template lookupObject<volScalarField>("rho");
return Foam::magSqr(phi/rho);
}
......@@ -84,7 +84,7 @@ inline tmp<volScalarField> rhoMagSqr<scalar>::operator()
) const
{
const volScalarField& rho =
phi.db().objectRegistry::lookupObject<volScalarField>("rho");
phi.db().objectRegistry::template lookupObject<volScalarField>("rho");
return phi/rho;
}
......
......@@ -69,7 +69,9 @@ Foam::PhiScheme<Type, PhiLimiter>::limiter
if (this->faceFlux_.dimensions() == dimDensity*dimVelocity*dimArea)
{
const volScalarField& rho =
phi.db().objectRegistry::lookupObject<volScalarField>("rho");
phi.db().objectRegistry::template lookupObject<volScalarField>
("rho");
tUflux = this->faceFlux_/fvc::interpolate(rho);
}
else if (this->faceFlux_.dimensions() != dimVelocity*dimArea)
......
......@@ -124,7 +124,7 @@ public:
) const
{
const surfaceScalarField& blendingFactor =
this->mesh().objectRegistry::
this->mesh().objectRegistry::template
lookupObject<const surfaceScalarField>
(
word(vf.name() + "BlendingFactor")
......@@ -142,7 +142,7 @@ public:
{
const surfaceScalarField& blendingFactor =
(
this->mesh().objectRegistry::
this->mesh().objectRegistry::template
lookupObject<const surfaceScalarField>
(
word(vf.name() + "BlendingFactor")
......@@ -171,7 +171,7 @@ public:
) const
{
const surfaceScalarField& blendingFactor =
this->mesh().objectRegistry::
this->mesh().objectRegistry::template
lookupObject<const surfaceScalarField>
(
word(vf.name() + "BlendingFactor")
......
......@@ -84,8 +84,11 @@ public:
surfaceInterpolationScheme<Type>(mesh),
weights_
(
this->mesh().objectRegistry::
lookupObject<const surfaceScalarField>(word(is))
this->mesh().objectRegistry::template
lookupObject<const surfaceScalarField>
(
word(is)
)
)
{}
......@@ -100,7 +103,7 @@ public:
surfaceInterpolationScheme<Type>(mesh),
weights_
(
this->mesh().objectRegistry::
this->mesh().objectRegistry::template
lookupObject<const surfaceScalarField>
(
word(is)
......
......@@ -109,11 +109,9 @@ void Foam::cellMotionFvPatchField<Type>::updateCoeffs()
pfName.replace("cell", "point");
const GeometricField<Type, pointPatchField, pointMesh>& pointMotion =
this->db().objectRegistry::
lookupObject<GeometricField<Type, pointPatchField, pointMesh> >
(
pfName
);
this->db().objectRegistry::template
lookupObject<GeometricField<Type, pointPatchField, pointMesh> >
(pfName);
forAll(p, i)
{
......
......@@ -116,7 +116,8 @@ inline Foam::ThermoParcel<ParcelType>::trackData::trackData
interpolation<scalar>::New
(
cloud.solution().interpolationSchemes(),
cloud.mesh().objectRegistry::lookupObject<volScalarField>("G")
cloud.mesh().objectRegistry::template
lookupObject<volScalarField>("G")
).ptr()
);
}
......
......@@ -38,7 +38,10 @@ Foam::DispersionRASModel<CloudType>::DispersionRASModel
DispersionModel<CloudType>(owner),
turbulence_
(
owner.mesh().objectRegistry::lookupObject<compressible::RASModel>
owner.mesh().objectRegistry::template lookupObject
<
compressible::RASModel
>
(
"RASProperties"
)
......
......@@ -80,14 +80,14 @@ Foam::FieldActivatedInjection<CloudType>::FieldActivatedInjection
factor_(readScalar(this->coeffDict().lookup("factor"))),
referenceField_
(
owner.db().objectRegistry::lookupObject<volScalarField>
owner.db().objectRegistry::template lookupObject<volScalarField>
(
this->coeffDict().lookup("referenceField")
)
),
thresholdField_
(
owner.db().objectRegistry::lookupObject<volScalarField>
owner.db().objectRegistry::template lookupObject<volScalarField>
(
this->coeffDict().lookup("thresholdField")
)
......
......@@ -134,7 +134,7 @@ void Foam::SurfaceFilmModel<CloudType>::inject(TrackData& td)
// Retrieve the film model from the owner database
const surfaceFilmModels::surfaceFilmModel& filmModel =
this->owner().db().objectRegistry::lookupObject
this->owner().db().objectRegistry::template lookupObject
<surfaceFilmModels::surfaceFilmModel>
(
"surfaceFilmProperties"
......
Supports Markdown
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