From dc3c78c7579d79a603e843e6278e4a4561eb9eba Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Fri, 17 Feb 2017 16:35:43 +0000 Subject: [PATCH] thermophysicalModels: Ostream operator calls write(os) for consistent IO --- .../reaction/Reactions/Reaction/ReactionI.H | 7 ++- .../ArrheniusReactionRateI.H | 4 +- .../ChemicallyActivatedReactionRateI.H | 4 +- .../FallOffReactionRateI.H | 7 +-- .../JanevReactionRate/JanevReactionRateI.H | 11 +---- .../LandauTellerReactionRateI.H | 5 +- .../LangmuirHinshelwoodReactionRateI.H | 11 +---- .../SRIFallOffFunction/SRIFallOffFunctionI.H | 9 +--- .../TroeFallOffFunctionI.H | 8 +--- .../infiniteReactionRateI.H | 5 +- .../powerSeries/powerSeriesReactionRateI.H | 11 +---- .../thirdBodyArrheniusReactionRateI.H | 5 +- .../thirdBodyEfficienciesI.H | 48 +------------------ 13 files changed, 16 insertions(+), 119 deletions(-) diff --git a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H index 6dece80ba..55287cbfd 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H +++ b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -67,9 +67,8 @@ Reaction::rhs() const template inline Ostream& operator<<(Ostream& os, const Reaction& r) { - OStringStream reaction; - os << r.reactionStr(reaction)<< token::END_STATEMENT <& carr ) { - os << token::BEGIN_LIST - << carr.k0_ << token::SPACE << carr.kInf_ << token::SPACE << carr.F_ - << token::END_LIST; + carr.write(os); return os; } diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRateI.H b/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRateI.H index 0b7fa5f03..fff348d48 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRateI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRateI.H @@ -120,12 +120,7 @@ inline Foam::Ostream& Foam::operator<< const FallOffReactionRate& forr ) { - os << token::BEGIN_LIST - << forr.k0_ << token::SPACE - << forr.kInf_ << token::SPACE - << forr.F_ << token::SPACE - << forr.thirdBodyEfficiencies_ - << token::END_LIST; + forr.write(os); return os; } diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/JanevReactionRate/JanevReactionRateI.H b/src/thermophysicalModels/specie/reaction/reactionRate/JanevReactionRate/JanevReactionRateI.H index 055d6291d..cc76c2c2c 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/JanevReactionRate/JanevReactionRateI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/JanevReactionRate/JanevReactionRateI.H @@ -104,16 +104,7 @@ inline Foam::Ostream& Foam::operator<< const JanevReactionRate& jrr ) { - os << token::BEGIN_LIST - << jrr.A_ << token::SPACE << jrr.beta_ << token::SPACE << jrr.Ta_; - - for (int n=0; n(arr) - << token::SPACE << arr.thirdBodyEfficiencies_ - << token::END_LIST; + arr.write(os); return os; } diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficienciesI.H b/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficienciesI.H index d77df740b..97a0e8eee 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficienciesI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficienciesI.H @@ -114,53 +114,7 @@ inline Foam::Ostream& Foam::operator<< const thirdBodyEfficiencies& tbes ) { - scalarList orderedTbes = tbes; - sort(orderedTbes); - - scalar val = orderedTbes[0]; - label count = 1; - - scalar valMaxCount = val; - label maxCount = 1; - - for (label i=1; i maxCount) - { - maxCount = count; - valMaxCount = val; - } - - count = 1; - val = orderedTbes[i]; - } - } - - if (count > maxCount) - { - maxCount = count; - valMaxCount = val; - } - - os << token::BEGIN_LIST << valMaxCount; - - forAll(tbes, i) - { - if (notEqual(tbes[i], valMaxCount)) - { - os << token::SPACE << tbes.species_[i] - << token::SPACE << tbes[i]; - } - } - - os << token::END_LIST; - + tbes.write(os); return os; }