ENH: Updated derived fvPatchField template coding style

This commit is contained in:
andy
2010-12-14 16:29:18 +00:00
parent 34f55c4f9d
commit e71993f896
6 changed files with 83 additions and 98 deletions

View File

@ -163,20 +163,18 @@ tmp<scalarField> advectiveFvPatchField<Type>::advectionSpeed() const
const surfaceScalarField& phi =
this->db().objectRegistry::lookupObject<surfaceScalarField>(phiName_);
fvsPatchField<scalar> phip = this->patch().lookupPatchField
fvsPatchField<scalar> phip =
this->patch().template lookupPatchField<surfaceScalarField, scalar>
(
phiName_,
reinterpret_cast<const surfaceScalarField*>(0),
reinterpret_cast<const scalar*>(0)
phiName_
);
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),
reinterpret_cast<const scalar*>(0)
rhoName_
);
return phip/(rhop*this->patch().magSf());

View File

@ -25,15 +25,10 @@ License
#include "inletOutletFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
inletOutletFvPatchField<Type>::inletOutletFvPatchField
Foam::inletOutletFvPatchField<Type>::inletOutletFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
@ -49,7 +44,7 @@ inletOutletFvPatchField<Type>::inletOutletFvPatchField
template<class Type>
inletOutletFvPatchField<Type>::inletOutletFvPatchField
Foam::inletOutletFvPatchField<Type>::inletOutletFvPatchField
(
const inletOutletFvPatchField<Type>& ptf,
const fvPatch& p,
@ -63,7 +58,7 @@ inletOutletFvPatchField<Type>::inletOutletFvPatchField
template<class Type>
inletOutletFvPatchField<Type>::inletOutletFvPatchField
Foam::inletOutletFvPatchField<Type>::inletOutletFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
@ -93,7 +88,7 @@ inletOutletFvPatchField<Type>::inletOutletFvPatchField
template<class Type>
inletOutletFvPatchField<Type>::inletOutletFvPatchField
Foam::inletOutletFvPatchField<Type>::inletOutletFvPatchField
(
const inletOutletFvPatchField<Type>& ptf
)
@ -104,7 +99,7 @@ inletOutletFvPatchField<Type>::inletOutletFvPatchField
template<class Type>
inletOutletFvPatchField<Type>::inletOutletFvPatchField
Foam::inletOutletFvPatchField<Type>::inletOutletFvPatchField
(
const inletOutletFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
@ -118,18 +113,17 @@ inletOutletFvPatchField<Type>::inletOutletFvPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void inletOutletFvPatchField<Type>::updateCoeffs()
void Foam::inletOutletFvPatchField<Type>::updateCoeffs()
{
if (this->updated())
{
return;
}
const Field<scalar>& phip = this->patch().lookupPatchField
const Field<scalar>& phip =
this->patch().template lookupPatchField<surfaceScalarField, scalar>
(
phiName_,
reinterpret_cast<const surfaceScalarField*>(0),
reinterpret_cast<const scalar*>(0)
phiName_
);
this->valueFraction() = 1.0 - pos(phip);
@ -139,7 +133,7 @@ void inletOutletFvPatchField<Type>::updateCoeffs()
template<class Type>
void inletOutletFvPatchField<Type>::write(Ostream& os) const
void Foam::inletOutletFvPatchField<Type>::write(Ostream& os) const
{
fvPatchField<Type>::write(os);
if (phiName_ != "phi")
@ -154,7 +148,7 @@ void inletOutletFvPatchField<Type>::write(Ostream& os) const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type>
void inletOutletFvPatchField<Type>::operator=
void Foam::inletOutletFvPatchField<Type>::operator=
(
const fvPatchField<Type>& ptf
)
@ -167,8 +161,4 @@ void inletOutletFvPatchField<Type>::operator=
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -56,6 +56,7 @@ protected:
// Protected data
//- Name of flux field
word phiName_;

View File

@ -25,21 +25,17 @@ License
#include "outletInletFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
outletInletFvPatchField<Type>::outletInletFvPatchField
Foam::outletInletFvPatchField<Type>::outletInletFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
mixedFvPatchField<Type>(p, iF)
mixedFvPatchField<Type>(p, iF),
phiName_("phi")
{
this->refValue() = *this;
this->refGrad() = pTraits<Type>::zero;
@ -48,7 +44,7 @@ outletInletFvPatchField<Type>::outletInletFvPatchField
template<class Type>
outletInletFvPatchField<Type>::outletInletFvPatchField
Foam::outletInletFvPatchField<Type>::outletInletFvPatchField
(
const outletInletFvPatchField<Type>& ptf,
const fvPatch& p,
@ -56,19 +52,21 @@ outletInletFvPatchField<Type>::outletInletFvPatchField
const fvPatchFieldMapper& mapper
)
:
mixedFvPatchField<Type>(ptf, p, iF, mapper)
mixedFvPatchField<Type>(ptf, p, iF, mapper),
phiName_(ptf.phiName_)
{}
template<class Type>
outletInletFvPatchField<Type>::outletInletFvPatchField
Foam::outletInletFvPatchField<Type>::outletInletFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
mixedFvPatchField<Type>(p, iF)
mixedFvPatchField<Type>(p, iF),
phiName_(dict.lookupOrDefault<word>("phi", "phi"))
{
this->refValue() = Field<Type>("outletValue", dict, p.size());
@ -90,41 +88,42 @@ outletInletFvPatchField<Type>::outletInletFvPatchField
template<class Type>
outletInletFvPatchField<Type>::outletInletFvPatchField
Foam::outletInletFvPatchField<Type>::outletInletFvPatchField
(
const outletInletFvPatchField<Type>& ptf
)
:
mixedFvPatchField<Type>(ptf)
mixedFvPatchField<Type>(ptf),
phiName_(ptf.phiName_)
{}
template<class Type>
outletInletFvPatchField<Type>::outletInletFvPatchField
Foam::outletInletFvPatchField<Type>::outletInletFvPatchField
(
const outletInletFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
mixedFvPatchField<Type>(ptf, iF)
mixedFvPatchField<Type>(ptf, iF),
phiName_(ptf.phiName_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void outletInletFvPatchField<Type>::updateCoeffs()
void Foam::outletInletFvPatchField<Type>::updateCoeffs()
{
if (this->updated())
{
return;
}
const fvsPatchField<scalar>& phip = this->patch().lookupPatchField
const fvsPatchField<scalar>& phip =
this->patch().template lookupPatchField<surfaceScalarField, scalar>
(
"phi",
reinterpret_cast<const surfaceScalarField*>(0),
reinterpret_cast<const scalar*>(0)
phiName_
);
this->valueFraction() = pos(phip);
@ -134,16 +133,16 @@ void outletInletFvPatchField<Type>::updateCoeffs()
template<class Type>
void outletInletFvPatchField<Type>::write(Ostream& os) const
void Foam::outletInletFvPatchField<Type>::write(Ostream& os) const
{
fvPatchField<Type>::write(os);
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
this->refValue().writeEntry("outletValue", os);
this->writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -52,6 +52,14 @@ class outletInletFvPatchField
public mixedFvPatchField<Type>
{
protected:
// Protected data
//- Name of flux field
word phiName_;
public:
//- Runtime type information

View File

@ -31,15 +31,10 @@ License
#include "CrankNicholsonDdtScheme.H"
#include "backwardDdtScheme.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
Foam::waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
@ -52,7 +47,7 @@ waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
template<class Type>
waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
Foam::waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
(
const waveTransmissiveFvPatchField& ptf,
const fvPatch& p,
@ -67,7 +62,7 @@ waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
template<class Type>
waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
Foam::waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
@ -81,7 +76,7 @@ waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
template<class Type>
waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
Foam::waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
(
const waveTransmissiveFvPatchField& ptpsf
)
@ -93,7 +88,7 @@ waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
template<class Type>
waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
Foam::waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
(
const waveTransmissiveFvPatchField& ptpsf,
const DimensionedField<Type, volMesh>& iF
@ -108,34 +103,31 @@ waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
tmp<scalarField> waveTransmissiveFvPatchField<Type>::advectionSpeed() const
Foam::tmp<Foam::scalarField>
Foam::waveTransmissiveFvPatchField<Type>::advectionSpeed() const
{
// Lookup the velocity and compressibility of the patch
const fvPatchField<scalar>& psip = this->patch().lookupPatchField
const fvPatchField<scalar>& psip =
this->patch().template lookupPatchField<volScalarField, scalar>
(
psiName_,
reinterpret_cast<const volScalarField*>(0),
reinterpret_cast<const scalar*>(0)
psiName_
);
const surfaceScalarField& phi =
this->db().objectRegistry::lookupObject<surfaceScalarField>
(this->phiName_);
this->db().template lookupObject<surfaceScalarField>(this->phiName_);
fvsPatchField<scalar> phip = this->patch().lookupPatchField
fvsPatchField<scalar> phip =
this->patch().template lookupPatchField<surfaceScalarField, scalar>
(
this->phiName_,
reinterpret_cast<const surfaceScalarField*>(0),
reinterpret_cast<const scalar*>(0)
this->phiName_
);
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
const fvPatchScalarField& rhop = this->patch().lookupPatchField
const fvPatchScalarField& rhop =
this->patch().template lookupPatchField<volScalarField, scalar>
(
this->rhoName_,
reinterpret_cast<const volScalarField*>(0),
reinterpret_cast<const scalar*>(0)
this->rhoName_
);
phip /= rhop;
@ -149,7 +141,7 @@ tmp<scalarField> waveTransmissiveFvPatchField<Type>::advectionSpeed() const
template<class Type>
void waveTransmissiveFvPatchField<Type>::write(Ostream& os) const
void Foam::waveTransmissiveFvPatchField<Type>::write(Ostream& os) const
{
fvPatchField<Type>::write(os);
@ -165,6 +157,7 @@ void waveTransmissiveFvPatchField<Type>::write(Ostream& os) const
{
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
}
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl;
if (this->lInf_ > SMALL)
@ -179,8 +172,4 @@ void waveTransmissiveFvPatchField<Type>::write(Ostream& os) const
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //