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

This commit is contained in:
Mark Olesen
2010-12-17 15:24:15 +01:00
parent 5f9d20e1d8
commit 90ea219f77
21 changed files with 151 additions and 70 deletions

View File

@ -941,7 +941,14 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::relax()
{ {
word name = this->name(); word name = this->name();
if (this->mesh().data::lookupOrDefault<bool>("finalIteration", false)) if
(
this->mesh().data::template lookupOrDefault<bool>
(
"finalIteration",
false
)
)
{ {
name += "Final"; name += "Final";
} }

View File

@ -74,8 +74,8 @@ void MapGeometricFields
{ {
HashTable<const GeometricField<Type, PatchField, GeoMesh>*> fields HashTable<const GeometricField<Type, PatchField, GeoMesh>*> fields
( (
mapper.thisDb().objectRegistry::lookupClass mapper.thisDb().objectRegistry::template
<GeometricField<Type, PatchField, GeoMesh> >() lookupClass<GeometricField<Type, PatchField, GeoMesh> >()
); );
// It is necessary to enforce that all old-time fields are stored // It is necessary to enforce that all old-time fields are stored

View File

@ -52,13 +52,22 @@ const Type& Foam::MeshObject<Mesh, Type>::New
const Mesh& mesh 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 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 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 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 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 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 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 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 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 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> template<class Mesh, class Type>
bool Foam::MeshObject<Mesh, Type>::Delete(const Mesh& mesh) 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 return mesh.thisDb().checkOut
( (
const_cast<Type&> const_cast<Type&>
( (
mesh.thisDb().objectRegistry::lookupObject<Type> mesh.thisDb().objectRegistry::template lookupObject<Type>
( (
Type::typeName Type::typeName
) )

View File

@ -158,23 +158,23 @@ Foam::tmp<Foam::scalarField>
Foam::advectiveFvPatchField<Type>::advectionSpeed() const Foam::advectiveFvPatchField<Type>::advectionSpeed() const
{ {
const surfaceScalarField& phi = 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) if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{ {
const fvPatchScalarField& rhop = this->patch().lookupPatchField const fvPatchScalarField& rhop =
( this->patch().template lookupPatchField<volScalarField, scalar>
rhoName_, (
reinterpret_cast<const volScalarField*>(0), rhoName_
reinterpret_cast<const scalar*>(0) );
);
return phip/(rhop*this->patch().magSf()); return phip/(rhop*this->patch().magSf());
} }
@ -201,7 +201,7 @@ void Foam::advectiveFvPatchField<Type>::updateCoeffs()
scalar deltaT = this->db().time().deltaTValue(); scalar deltaT = this->db().time().deltaTValue();
const GeometricField<Type, fvPatchField, volMesh>& field = const GeometricField<Type, fvPatchField, volMesh>& field =
this->db().objectRegistry:: this->db().objectRegistry::template
lookupObject<GeometricField<Type, fvPatchField, volMesh> > lookupObject<GeometricField<Type, fvPatchField, volMesh> >
( (
this->dimensionedInternalField().name() this->dimensionedInternalField().name()

View File

@ -139,7 +139,9 @@ void Foam::outletMappedUniformInletFvPatchField<Type>::updateCoeffs()
f.boundaryField()[outletPatchID]; f.boundaryField()[outletPatchID];
const surfaceScalarField& phi = const surfaceScalarField& phi =
this->db().objectRegistry::lookupObject<surfaceScalarField>(phiName_); this->db().objectRegistry::template lookupObject<surfaceScalarField>
(phiName_);
const scalarField& outletPatchPhi = phi.boundaryField()[outletPatchID]; const scalarField& outletPatchPhi = phi.boundaryField()[outletPatchID];
scalar sumOutletPatchPhi = gSum(outletPatchPhi); scalar sumOutletPatchPhi = gSum(outletPatchPhi);

View File

@ -115,7 +115,7 @@ Foam::waveTransmissiveFvPatchField<Type>::advectionSpeed() const
); );
const surfaceScalarField& phi = const surfaceScalarField& phi =
this->db().objectRegistry::lookupObject<surfaceScalarField> this->db().objectRegistry::template lookupObject<surfaceScalarField>
(this->phiName_); (this->phiName_);
fvsPatchField<scalar> phip = this->patch().lookupPatchField fvsPatchField<scalar> phip = this->patch().lookupPatchField

View File

@ -50,7 +50,7 @@ CrankNicholsonDdtScheme<Type>::DDt0Field<GeoField>::DDt0Field
: :
GeoField(io, mesh), GeoField(io, mesh),
startTimeIndex_(-2) // This field is for a restart and thus correct so set 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 // Set the time-index to the beginning of the run to ensure the field
// is updated during the first time-step // is updated during the first time-step
@ -108,7 +108,7 @@ CrankNicholsonDdtScheme<Type>::ddt0_
const dimensionSet& dims const dimensionSet& dims
) )
{ {
if (!mesh().objectRegistry::foundObject<GeoField>(name)) if (!mesh().objectRegistry::template foundObject<GeoField>(name))
{ {
const Time& runTime = mesh().time(); const Time& runTime = mesh().time();
word startTimeName = runTime.timeName(runTime.startTime().value()); word startTimeName = runTime.timeName(runTime.startTime().value());
@ -173,7 +173,7 @@ CrankNicholsonDdtScheme<Type>::ddt0_
( (
const_cast<GeoField&> const_cast<GeoField&>
( (
mesh().objectRegistry::lookupObject<GeoField>(name) mesh().objectRegistry::template lookupObject<GeoField>(name)
) )
); );

View File

@ -90,7 +90,8 @@ template<class Type>
tmp<volScalarField> SLTSDdtScheme<Type>::SLrDeltaT() const tmp<volScalarField> SLTSDdtScheme<Type>::SLrDeltaT() const
{ {
const surfaceScalarField& phi = const surfaceScalarField& phi =
mesh().objectRegistry::lookupObject<surfaceScalarField>(phiName_); mesh().objectRegistry::template
lookupObject<surfaceScalarField>(phiName_);
const dimensionedScalar& deltaT = mesh().time().deltaT(); 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)) else if (phi.dimensions() == dimensionSet(1, 0, -1, 0, 0))
{ {
const volScalarField& rho = const volScalarField& rho =
mesh().objectRegistry::lookupObject<volScalarField>(rhoName_) mesh().objectRegistry::template lookupObject<volScalarField>
.oldTime(); (
rhoName_
).oldTime();
rDeltaT.internalField() = max rDeltaT.internalField() = max
( (

View File

@ -42,7 +42,8 @@ namespace fv
template<class Type> template<class Type>
const volScalarField& localEulerDdtScheme<Type>::localRDeltaT() const const volScalarField& localEulerDdtScheme<Type>::localRDeltaT() const
{ {
return mesh().objectRegistry::lookupObject<volScalarField>(rDeltaTName_); return mesh().objectRegistry::template lookupObject<volScalarField>
(rDeltaTName_);
} }

View File

@ -127,7 +127,7 @@ Foam::fv::gradScheme<Type>::grad
if (!this->mesh().changing() && this->mesh().cache(name)) 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); cachePrintMessage("Calculating and caching", name, vsf);
tmp<GradFieldType> tgGrad = calcGrad(vsf, name); tmp<GradFieldType> tgGrad = calcGrad(vsf, name);
@ -137,7 +137,7 @@ Foam::fv::gradScheme<Type>::grad
cachePrintMessage("Retreiving", name, vsf); cachePrintMessage("Retreiving", name, vsf);
GradFieldType& gGrad = const_cast<GradFieldType&> GradFieldType& gGrad = const_cast<GradFieldType&>
( (
mesh().objectRegistry::lookupObject<GradFieldType>(name) mesh().objectRegistry::template lookupObject<GradFieldType>(name)
); );
if (gGrad.upToDate(vsf)) if (gGrad.upToDate(vsf))
@ -157,7 +157,10 @@ Foam::fv::gradScheme<Type>::grad
regIOobject::store(tgGrad.ptr()); regIOobject::store(tgGrad.ptr());
GradFieldType& gGrad = const_cast<GradFieldType&> GradFieldType& gGrad = const_cast<GradFieldType&>
( (
mesh().objectRegistry::lookupObject<GradFieldType>(name) mesh().objectRegistry::template lookupObject<GradFieldType>
(
name
)
); );
return gGrad; return gGrad;
@ -165,11 +168,14 @@ Foam::fv::gradScheme<Type>::grad
} }
else else
{ {
if (mesh().objectRegistry::foundObject<GradFieldType>(name)) if (mesh().objectRegistry::template foundObject<GradFieldType>(name))
{ {
GradFieldType& gGrad = const_cast<GradFieldType&> GradFieldType& gGrad = const_cast<GradFieldType&>
( (
mesh().objectRegistry::lookupObject<GradFieldType>(name) mesh().objectRegistry::template lookupObject<GradFieldType>
(
name
)
); );
if (gGrad.ownedByRegistry()) if (gGrad.ownedByRegistry())

View File

@ -37,7 +37,8 @@ const typename GeometricField::PatchFieldType& Foam::fvPatch::lookupPatchField
{ {
return patchField<GeometricField, Type> return patchField<GeometricField, Type>
( (
boundaryMesh().mesh().objectRegistry::lookupObject<GeometricField>(name) boundaryMesh().mesh().objectRegistry::template
lookupObject<GeometricField>(name)
); );
} }

View File

@ -72,7 +72,7 @@ inline tmp<volScalarField> rhoMagSqr<Type>::operator()
) const ) const
{ {
const volScalarField& rho = const volScalarField& rho =
phi.db().objectRegistry::lookupObject<volScalarField>("rho"); phi.db().objectRegistry::template lookupObject<volScalarField>("rho");
return Foam::magSqr(phi/rho); return Foam::magSqr(phi/rho);
} }
@ -84,7 +84,7 @@ inline tmp<volScalarField> rhoMagSqr<scalar>::operator()
) const ) const
{ {
const volScalarField& rho = const volScalarField& rho =
phi.db().objectRegistry::lookupObject<volScalarField>("rho"); phi.db().objectRegistry::template lookupObject<volScalarField>("rho");
return phi/rho; return phi/rho;
} }

View File

@ -69,7 +69,9 @@ Foam::PhiScheme<Type, PhiLimiter>::limiter
if (this->faceFlux_.dimensions() == dimDensity*dimVelocity*dimArea) if (this->faceFlux_.dimensions() == dimDensity*dimVelocity*dimArea)
{ {
const volScalarField& rho = const volScalarField& rho =
phi.db().objectRegistry::lookupObject<volScalarField>("rho"); phi.db().objectRegistry::template lookupObject<volScalarField>
("rho");
tUflux = this->faceFlux_/fvc::interpolate(rho); tUflux = this->faceFlux_/fvc::interpolate(rho);
} }
else if (this->faceFlux_.dimensions() != dimVelocity*dimArea) else if (this->faceFlux_.dimensions() != dimVelocity*dimArea)

View File

@ -124,7 +124,7 @@ public:
) const ) const
{ {
const surfaceScalarField& blendingFactor = const surfaceScalarField& blendingFactor =
this->mesh().objectRegistry:: this->mesh().objectRegistry::template
lookupObject<const surfaceScalarField> lookupObject<const surfaceScalarField>
( (
word(vf.name() + "BlendingFactor") word(vf.name() + "BlendingFactor")
@ -142,7 +142,7 @@ public:
{ {
const surfaceScalarField& blendingFactor = const surfaceScalarField& blendingFactor =
( (
this->mesh().objectRegistry:: this->mesh().objectRegistry::template
lookupObject<const surfaceScalarField> lookupObject<const surfaceScalarField>
( (
word(vf.name() + "BlendingFactor") word(vf.name() + "BlendingFactor")
@ -171,7 +171,7 @@ public:
) const ) const
{ {
const surfaceScalarField& blendingFactor = const surfaceScalarField& blendingFactor =
this->mesh().objectRegistry:: this->mesh().objectRegistry::template
lookupObject<const surfaceScalarField> lookupObject<const surfaceScalarField>
( (
word(vf.name() + "BlendingFactor") word(vf.name() + "BlendingFactor")

View File

@ -84,8 +84,11 @@ public:
surfaceInterpolationScheme<Type>(mesh), surfaceInterpolationScheme<Type>(mesh),
weights_ weights_
( (
this->mesh().objectRegistry:: this->mesh().objectRegistry::template
lookupObject<const surfaceScalarField>(word(is)) lookupObject<const surfaceScalarField>
(
word(is)
)
) )
{} {}
@ -100,7 +103,7 @@ public:
surfaceInterpolationScheme<Type>(mesh), surfaceInterpolationScheme<Type>(mesh),
weights_ weights_
( (
this->mesh().objectRegistry:: this->mesh().objectRegistry::template
lookupObject<const surfaceScalarField> lookupObject<const surfaceScalarField>
( (
word(is) word(is)

View File

@ -109,11 +109,9 @@ void Foam::cellMotionFvPatchField<Type>::updateCoeffs()
pfName.replace("cell", "point"); pfName.replace("cell", "point");
const GeometricField<Type, pointPatchField, pointMesh>& pointMotion = const GeometricField<Type, pointPatchField, pointMesh>& pointMotion =
this->db().objectRegistry:: this->db().objectRegistry::template
lookupObject<GeometricField<Type, pointPatchField, pointMesh> > lookupObject<GeometricField<Type, pointPatchField, pointMesh> >
( (pfName);
pfName
);
forAll(p, i) forAll(p, i)
{ {

View File

@ -116,7 +116,8 @@ inline Foam::ThermoParcel<ParcelType>::trackData::trackData
interpolation<scalar>::New interpolation<scalar>::New
( (
cloud.solution().interpolationSchemes(), cloud.solution().interpolationSchemes(),
cloud.mesh().objectRegistry::lookupObject<volScalarField>("G") cloud.mesh().objectRegistry::template
lookupObject<volScalarField>("G")
).ptr() ).ptr()
); );
} }

View File

@ -38,7 +38,10 @@ Foam::DispersionRASModel<CloudType>::DispersionRASModel
DispersionModel<CloudType>(owner), DispersionModel<CloudType>(owner),
turbulence_ turbulence_
( (
owner.mesh().objectRegistry::lookupObject<compressible::RASModel> owner.mesh().objectRegistry::template lookupObject
<
compressible::RASModel
>
( (
"RASProperties" "RASProperties"
) )

View File

@ -80,14 +80,14 @@ Foam::FieldActivatedInjection<CloudType>::FieldActivatedInjection
factor_(readScalar(this->coeffDict().lookup("factor"))), factor_(readScalar(this->coeffDict().lookup("factor"))),
referenceField_ referenceField_
( (
owner.db().objectRegistry::lookupObject<volScalarField> owner.db().objectRegistry::template lookupObject<volScalarField>
( (
this->coeffDict().lookup("referenceField") this->coeffDict().lookup("referenceField")
) )
), ),
thresholdField_ thresholdField_
( (
owner.db().objectRegistry::lookupObject<volScalarField> owner.db().objectRegistry::template lookupObject<volScalarField>
( (
this->coeffDict().lookup("thresholdField") this->coeffDict().lookup("thresholdField")
) )

View File

@ -134,7 +134,7 @@ void Foam::SurfaceFilmModel<CloudType>::inject(TrackData& td)
// Retrieve the film model from the owner database // Retrieve the film model from the owner database
const surfaceFilmModels::surfaceFilmModel& filmModel = const surfaceFilmModels::surfaceFilmModel& filmModel =
this->owner().db().objectRegistry::lookupObject this->owner().db().objectRegistry::template lookupObject
<surfaceFilmModels::surfaceFilmModel> <surfaceFilmModels::surfaceFilmModel>
( (
"surfaceFilmProperties" "surfaceFilmProperties"

View File

@ -492,7 +492,10 @@ Foam::ThermoSurfaceFilm<CloudType>::ThermoSurfaceFilm
: :
SurfaceFilmModel<CloudType>(dict, owner, g, typeName), SurfaceFilmModel<CloudType>(dict, owner, g, typeName),
rndGen_(owner.rndGen()), rndGen_(owner.rndGen()),
thermo_(owner.db().objectRegistry::lookupObject<SLGThermo>("SLGThermo")), thermo_
(
owner.db().objectRegistry::template lookupObject<SLGThermo>("SLGThermo")
),
TFilmPatch_(0), TFilmPatch_(0),
CpFilmPatch_(0), CpFilmPatch_(0),
interactionType_ interactionType_
@ -567,7 +570,7 @@ bool Foam::ThermoSurfaceFilm<CloudType>::transferParcel
surfaceFilmModels::surfaceFilmModel& filmModel = surfaceFilmModels::surfaceFilmModel& filmModel =
const_cast<surfaceFilmModels::surfaceFilmModel&> const_cast<surfaceFilmModels::surfaceFilmModel&>
( (
this->owner().db().objectRegistry:: this->owner().db().objectRegistry::template
lookupObject<surfaceFilmModels::surfaceFilmModel> lookupObject<surfaceFilmModels::surfaceFilmModel>
( (
"surfaceFilmProperties" "surfaceFilmProperties"