Commit e71993f8 authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: Updated derived fvPatchField template coding style

parent 34f55c4f
......@@ -163,21 +163,19 @@ tmp<scalarField> advectiveFvPatchField<Type>::advectionSpeed() const
const surfaceScalarField& phi =
this->db().objectRegistry::lookupObject<surfaceScalarField>(phiName_);
fvsPatchField<scalar> phip = this->patch().lookupPatchField
(
phiName_,
reinterpret_cast<const surfaceScalarField*>(0),
reinterpret_cast<const scalar*>(0)
);
fvsPatchField<scalar> phip =
this->patch().template lookupPatchField<surfaceScalarField, scalar>
(
phiName_
);
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());
}
......
......@@ -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,19 +113,18 @@ 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
(
phiName_,
reinterpret_cast<const surfaceScalarField*>(0),
reinterpret_cast<const scalar*>(0)
);
const Field<scalar>& phip =
this->patch().template lookupPatchField<surfaceScalarField, scalar>
(
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
// ************************************************************************* //
......@@ -56,6 +56,7 @@ protected:
// Protected data
//- Name of flux field
word phiName_;
......
......@@ -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,42 +88,43 @@ 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
(
"phi",
reinterpret_cast<const surfaceScalarField*>(0),
reinterpret_cast<const scalar*>(0)
);
const fvsPatchField<scalar>& phip =
this->patch().template lookupPatchField<surfaceScalarField, scalar>
(
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
// ************************************************************************* //
......@@ -52,6 +52,14 @@ class outletInletFvPatchField
public mixedFvPatchField<Type>
{
protected:
// Protected data
//- Name of flux field
word phiName_;
public:
//- Runtime type information
......
......@@ -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,35 +103,32 @@ 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
(
psiName_,
reinterpret_cast<const volScalarField*>(0),
reinterpret_cast<const scalar*>(0)
);
const fvPatchField<scalar>& psip =
this->patch().template lookupPatchField<volScalarField, scalar>
(
psiName_
);
const surfaceScalarField& phi =
this->db().objectRegistry::lookupObject<surfaceScalarField>
(this->phiName_);
this->db().template lookupObject<surfaceScalarField>(this->phiName_);
fvsPatchField<scalar> phip = this->patch().lookupPatchField
(
this->phiName_,
reinterpret_cast<const surfaceScalarField*>(0),
reinterpret_cast<const scalar*>(0)
);
fvsPatchField<scalar> phip =
this->patch().template lookupPatchField<surfaceScalarField, scalar>
(
this->phiName_
);
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
const fvPatchScalarField& rhop = this->patch().lookupPatchField
(
this->rhoName_,
reinterpret_cast<const volScalarField*>(0),
reinterpret_cast<const scalar*>(0)
);
const fvPatchScalarField& rhop =
this->patch().template lookupPatchField<volScalarField, scalar>
(
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
// ************************************************************************* //
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