Commit c0ba7bf0 authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: use Ostream writeEntry when writing key/value entries

- makes for clearer code

ENH: make writeIfDifferent part of Ostream
parent 0ca0a626
...@@ -209,16 +209,14 @@ void Foam::smoluchowskiJumpTFvPatchScalarField::write(Ostream& os) const ...@@ -209,16 +209,14 @@ void Foam::smoluchowskiJumpTFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchScalarField::write(os); fvPatchScalarField::write(os);
writeEntryIfDifferent<word>(os, "U", "U", UName_); os.writeEntryIfDifferent<word>("U", "U", UName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); os.writeEntryIfDifferent<word>("rho", "rho", rhoName_);
writeEntryIfDifferent<word>(os, "psi", "thermo:psi", psiName_); os.writeEntryIfDifferent<word>("psi", "thermo:psi", psiName_);
writeEntryIfDifferent<word>(os, "mu", "thermo:mu", muName_); os.writeEntryIfDifferent<word>("mu", "thermo:mu", muName_);
os.writeKeyword("accommodationCoeff") os.writeEntry("accommodationCoeff", accommodationCoeff_);
<< accommodationCoeff_ << token::END_STATEMENT << nl;
Twall_.writeEntry("Twall", os); Twall_.writeEntry("Twall", os);
os.writeKeyword("gamma") os.writeEntry("gamma", gamma_);
<< gamma_ << token::END_STATEMENT << nl;
writeEntry("value", os); writeEntry("value", os);
} }
......
...@@ -200,18 +200,16 @@ void Foam::maxwellSlipUFvPatchVectorField::updateCoeffs() ...@@ -200,18 +200,16 @@ void Foam::maxwellSlipUFvPatchVectorField::updateCoeffs()
void Foam::maxwellSlipUFvPatchVectorField::write(Ostream& os) const void Foam::maxwellSlipUFvPatchVectorField::write(Ostream& os) const
{ {
fvPatchVectorField::write(os); fvPatchVectorField::write(os);
writeEntryIfDifferent<word>(os, "T", "T", TName_); os.writeEntryIfDifferent<word>("T", "T", TName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); os.writeEntryIfDifferent<word>("rho", "rho", rhoName_);
writeEntryIfDifferent<word>(os, "psi", "thermo:psi", psiName_); os.writeEntryIfDifferent<word>("psi", "thermo:psi", psiName_);
writeEntryIfDifferent<word>(os, "mu", "thermo:mu", muName_); os.writeEntryIfDifferent<word>("mu", "thermo:mu", muName_);
writeEntryIfDifferent<word>(os, "tauMC", "tauMC", tauMCName_); os.writeEntryIfDifferent<word>("tauMC", "tauMC", tauMCName_);
os.writeKeyword("accommodationCoeff") os.writeEntry("accommodationCoeff", accommodationCoeff_);
<< accommodationCoeff_ << token::END_STATEMENT << nl;
Uwall_.writeEntry("Uwall", os); Uwall_.writeEntry("Uwall", os);
os.writeKeyword("thermalCreep") os.writeEntry("thermalCreep", thermalCreep_);
<< thermalCreep_ << token::END_STATEMENT << nl; os.writeEntry("curvature", curvature_);
os.writeKeyword("curvature") << curvature_ << token::END_STATEMENT << nl;
refValue().writeEntry("refValue", os); refValue().writeEntry("refValue", os);
valueFraction().writeEntry("valueFraction", os); valueFraction().writeEntry("valueFraction", os);
......
...@@ -117,8 +117,8 @@ void Foam::fixedRhoFvPatchScalarField::write(Ostream& os) const ...@@ -117,8 +117,8 @@ void Foam::fixedRhoFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchScalarField::write(os); fvPatchScalarField::write(os);
writeEntryIfDifferent<word>(os, "p", "p", this->pName_); os.writeEntryIfDifferent<word>("p", "p", pName_);
writeEntryIfDifferent<word>(os, "psi", "thermo:psi", psiName_); os.writeEntryIfDifferent<word>("psi", "thermo:psi", psiName_);
writeEntry("value", os); writeEntry("value", os);
} }
......
...@@ -125,8 +125,7 @@ alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField ...@@ -125,8 +125,7 @@ alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
void alphaContactAngleFvPatchScalarField::write(Ostream& os) const void alphaContactAngleFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchScalarField::write(os); fvPatchScalarField::write(os);
os.writeKeyword("thetaProperties") os.writeEntry("thetaProperties", thetaProps_);
<< thetaProps_ << token::END_STATEMENT << nl;
writeEntry("value", os); writeEntry("value", os);
} }
......
...@@ -125,8 +125,7 @@ alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField ...@@ -125,8 +125,7 @@ alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
void alphaContactAngleFvPatchScalarField::write(Ostream& os) const void alphaContactAngleFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchScalarField::write(os); fvPatchScalarField::write(os);
os.writeKeyword("thetaProperties") os.writeEntry("thetaProperties", thetaProps_);
<< thetaProps_ << token::END_STATEMENT << nl;
writeEntry("value", os); writeEntry("value", os);
} }
......
...@@ -125,8 +125,7 @@ alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField ...@@ -125,8 +125,7 @@ alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
void alphaContactAngleFvPatchScalarField::write(Ostream& os) const void alphaContactAngleFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchScalarField::write(os); fvPatchScalarField::write(os);
os.writeKeyword("thetaProperties") os.writeEntry("thetaProperties", thetaProps_);
<< thetaProps_ << token::END_STATEMENT << nl;
writeEntry("value", os); writeEntry("value", os);
} }
......
...@@ -125,8 +125,7 @@ alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField ...@@ -125,8 +125,7 @@ alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
void alphaContactAngleFvPatchScalarField::write(Ostream& os) const void alphaContactAngleFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchScalarField::write(os); fvPatchScalarField::write(os);
os.writeKeyword("thetaProperties") os.writeEntry("thetaProperties", thetaProps_);
<< thetaProps_ << token::END_STATEMENT << nl;
writeEntry("value", os); writeEntry("value", os);
} }
......
...@@ -138,9 +138,9 @@ void alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::write ...@@ -138,9 +138,9 @@ void alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::write
) const ) const
{ {
fvPatchField<scalar>::write(os); fvPatchField<scalar>::write(os);
os.writeKeyword("relax") << relax_ << token::END_STATEMENT << nl; os.writeEntry("relax", relax_);
os.writeKeyword("fixedDmdt") << fixedDmdt_ << token::END_STATEMENT << nl; os.writeEntry("fixedDmdt", fixedDmdt_);
os.writeKeyword("L") << L_ << token::END_STATEMENT << nl; os.writeEntry("L", L_);
dmdt_.writeEntry("dmdt", os); dmdt_.writeEntry("dmdt", os);
writeEntry("value", os); writeEntry("value", os);
} }
......
...@@ -334,10 +334,10 @@ void alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField::write ...@@ -334,10 +334,10 @@ void alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField::write
) const ) const
{ {
fvPatchField<scalar>::write(os); fvPatchField<scalar>::write(os);
os.writeKeyword("Prt") << Prt_ << token::END_STATEMENT << nl; os.writeEntry("Prt", Prt_);
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; os.writeEntry("Cmu", Cmu_);
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; os.writeEntry("kappa", kappa_);
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; os.writeEntry("E", E_);
dmdt_.writeEntry("dmdt", os); dmdt_.writeEntry("dmdt", os);
writeEntry("value", os); writeEntry("value", os);
} }
......
...@@ -596,42 +596,36 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::write(Ostream& os) const ...@@ -596,42 +596,36 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchField<scalar>::write(os); fvPatchField<scalar>::write(os);
os.writeKeyword("phaseType") << phaseTypeNames_[phaseType_] os.writeEntry("phaseType", phaseTypeNames_[phaseType_]);
<< token::END_STATEMENT << nl;
os.writeKeyword("relax") << relax_ << token::END_STATEMENT << nl; os.writeEntry("relax", relax_);
switch (phaseType_) switch (phaseType_)
{ {
case vaporPhase: case vaporPhase:
{ {
os.writeKeyword("partitioningModel") << nl; os.beginBlock("partitioningModel");
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
partitioningModel_->write(os); partitioningModel_->write(os);
os << decrIndent << indent << token::END_BLOCK << nl; os.endBlock();
break; break;
} }
case liquidPhase: case liquidPhase:
{ {
os.writeKeyword("partitioningModel") << nl; os.beginBlock("partitioningModel");
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
partitioningModel_->write(os); partitioningModel_->write(os);
os << decrIndent << indent << token::END_BLOCK << nl; os.endBlock();
os.writeKeyword("nucleationSiteModel") << nl; os.beginBlock("nucleationSiteModel");
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
nucleationSiteModel_->write(os); nucleationSiteModel_->write(os);
os << decrIndent << indent << token::END_BLOCK << nl; os.endBlock();
os.writeKeyword("departureDiamModel") << nl; os.beginBlock("departureDiamModel");
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
departureDiamModel_->write(os); departureDiamModel_->write(os);
os << decrIndent << indent << token::END_BLOCK << nl; os.endBlock();
os.writeKeyword("departureFreqModel") << nl; os.beginBlock("departureFreqModel");
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
departureFreqModel_->write(os); departureFreqModel_->write(os);
os << decrIndent << indent << token::END_BLOCK << nl; os.endBlock();
break; break;
} }
......
...@@ -109,8 +109,7 @@ void Foam::copiedFixedValueFvPatchScalarField::updateCoeffs() ...@@ -109,8 +109,7 @@ void Foam::copiedFixedValueFvPatchScalarField::updateCoeffs()
void Foam::copiedFixedValueFvPatchScalarField::write(Ostream& os) const void Foam::copiedFixedValueFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchField<scalar>::write(os); fvPatchField<scalar>::write(os);
os.writeKeyword("sourceField") os.writeEntry("sourceField", sourceFieldName_);
<< sourceFieldName_ << token::END_STATEMENT << nl;
writeEntry("value", os); writeEntry("value", os);
} }
......
...@@ -183,7 +183,7 @@ void Foam::fixedMultiPhaseHeatFluxFvPatchScalarField::updateCoeffs() ...@@ -183,7 +183,7 @@ void Foam::fixedMultiPhaseHeatFluxFvPatchScalarField::updateCoeffs()
void Foam::fixedMultiPhaseHeatFluxFvPatchScalarField::write(Ostream& os) const void Foam::fixedMultiPhaseHeatFluxFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchField<scalar>::write(os); fvPatchField<scalar>::write(os);
os.writeKeyword("relax") << relax_ << token::END_STATEMENT << nl; os.writeEntry("relax", relax_);
q_.writeEntry("q", os); q_.writeEntry("q", os);
writeEntry("value", os); writeEntry("value", os);
} }
......
...@@ -114,7 +114,7 @@ void Foam::wallBoilingModels::departureDiameterModels:: ...@@ -114,7 +114,7 @@ void Foam::wallBoilingModels::departureDiameterModels::
KocamustafaogullariIshii::write(Ostream& os) const KocamustafaogullariIshii::write(Ostream& os) const
{ {
departureDiameterModel::write(os); departureDiameterModel::write(os);
os.writeKeyword("phi") << phi_ << token::END_STATEMENT << nl; os.writeEntry("phi", phi_);
} }
......
...@@ -90,9 +90,9 @@ void Foam::wallBoilingModels::departureDiameterModels:: ...@@ -90,9 +90,9 @@ void Foam::wallBoilingModels::departureDiameterModels::
TolubinskiKostanchuk::write(Ostream& os) const TolubinskiKostanchuk::write(Ostream& os) const
{ {
departureDiameterModel::write(os); departureDiameterModel::write(os);
os.writeKeyword("dRef") << dRef_ << token::END_STATEMENT << nl; os.writeEntry("dRef", dRef_);
os.writeKeyword("dMax") << dMax_ << token::END_STATEMENT << nl; os.writeEntry("dMax", dMax_);
os.writeKeyword("dMin") << dMin_ << token::END_STATEMENT << nl; os.writeEntry("dMin", dMin_);
} }
......
...@@ -53,7 +53,7 @@ Foam::wallBoilingModels::departureDiameterModel::~departureDiameterModel() ...@@ -53,7 +53,7 @@ Foam::wallBoilingModels::departureDiameterModel::~departureDiameterModel()
void Foam::wallBoilingModels::departureDiameterModel::write(Ostream& os) const void Foam::wallBoilingModels::departureDiameterModel::write(Ostream& os) const
{ {
os.writeKeyword("type") << this->type() << token::END_STATEMENT << nl; os.writeEntry("type", this->type());
} }
// ************************************************************************* // // ************************************************************************* //
...@@ -53,7 +53,7 @@ Foam::wallBoilingModels::departureFrequencyModel::~departureFrequencyModel() ...@@ -53,7 +53,7 @@ Foam::wallBoilingModels::departureFrequencyModel::~departureFrequencyModel()
void Foam::wallBoilingModels::departureFrequencyModel::write(Ostream& os) const void Foam::wallBoilingModels::departureFrequencyModel::write(Ostream& os) const
{ {
os.writeKeyword("type") << this->type() << token::END_STATEMENT << nl; os.writeEntry("type", this->type());
} }
......
...@@ -53,7 +53,7 @@ Foam::wallBoilingModels::nucleationSiteModel::~nucleationSiteModel() ...@@ -53,7 +53,7 @@ Foam::wallBoilingModels::nucleationSiteModel::~nucleationSiteModel()
void Foam::wallBoilingModels::nucleationSiteModel::write(Ostream& os) const void Foam::wallBoilingModels::nucleationSiteModel::write(Ostream& os) const
{ {
os.writeKeyword("type") << this->type() << token::END_STATEMENT << nl; os.writeEntry("type", this->type());
} }
......
...@@ -88,7 +88,7 @@ void Foam::wallBoilingModels::partitioningModels:: ...@@ -88,7 +88,7 @@ void Foam::wallBoilingModels::partitioningModels::
Lavieville::write(Ostream& os) const Lavieville::write(Ostream& os) const
{ {
partitioningModel::write(os); partitioningModel::write(os);
os.writeKeyword("alphaCrit") << alphaCrit_ << token::END_STATEMENT << nl; os.writeEntry("alphaCrit", alphaCrit_);
} }
......
...@@ -97,10 +97,8 @@ void Foam::wallBoilingModels::partitioningModels:: ...@@ -97,10 +97,8 @@ void Foam::wallBoilingModels::partitioningModels::
cosine::write(Ostream& os) const cosine::write(Ostream& os) const
{ {
partitioningModel::write(os); partitioningModel::write(os);
os.writeKeyword("alphaLiquid1") << alphaLiquid1_ os.writeEntry("alphaLiquid1", alphaLiquid1_);
<< token::END_STATEMENT << nl; os.writeEntry("alphaLiquid0", alphaLiquid0_);
os.writeKeyword("alphaLiquid0") << alphaLiquid0_
<< token::END_STATEMENT << nl;
} }
......
...@@ -90,10 +90,8 @@ void Foam::wallBoilingModels::partitioningModels:: ...@@ -90,10 +90,8 @@ void Foam::wallBoilingModels::partitioningModels::
linear::write(Ostream& os) const linear::write(Ostream& os) const
{ {
partitioningModel::write(os); partitioningModel::write(os);
os.writeKeyword("alphaLiquid1") << alphaLiquid1_ os.writeEntry("alphaLiquid1", alphaLiquid1_);
<< token::END_STATEMENT << nl; os.writeEntry("alphaLiquid0", alphaLiquid0_);
os.writeKeyword("alphaLiquid0") << alphaLiquid0_
<< token::END_STATEMENT << nl;
} }
......
...@@ -53,7 +53,7 @@ Foam::wallBoilingModels::partitioningModel::~partitioningModel() ...@@ -53,7 +53,7 @@ Foam::wallBoilingModels::partitioningModel::~partitioningModel()
void Foam::wallBoilingModels::partitioningModel::write(Ostream& os) const void Foam::wallBoilingModels::partitioningModel::write(Ostream& os) const
{ {
os.writeKeyword("type") << this->type() << token::END_STATEMENT << nl; os.writeEntry("type", this->type());
} }
......
...@@ -245,8 +245,7 @@ void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::write ...@@ -245,8 +245,7 @@ void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::write
) const ) const
{ {
fvPatchVectorField::write(os); fvPatchVectorField::write(os);
os.writeKeyword("specularityCoefficient") os.writeEntry("specularityCoefficient", specularityCoefficient_);
<< specularityCoefficient_ << token::END_STATEMENT << nl;
writeEntry("value", os); writeEntry("value", os);
} }
......
...@@ -289,10 +289,8 @@ void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::write ...@@ -289,10 +289,8 @@ void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::write
) const ) const
{ {
fvPatchScalarField::write(os); fvPatchScalarField::write(os);
os.writeKeyword("restitutionCoefficient") os.writeEntry("restitutionCoefficient", restitutionCoefficient_);
<< restitutionCoefficient_ << token::END_STATEMENT << nl; os.writeEntry("specularityCoefficient", specularityCoefficient_);
os.writeKeyword("specularityCoefficient")
<< specularityCoefficient_ << token::END_STATEMENT << nl;
writeEntry