Commit ba9d58a2 authored by Henry Weller's avatar Henry Weller
Browse files

thermophysicalModels: Ostream operator calls write(os) for consistent IO

parent 72b705ed
......@@ -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<ReactionThermo>::rhs() const
template<class ReactionThermo>
inline Ostream& operator<<(Ostream& os, const Reaction<ReactionThermo>& r)
{
OStringStream reaction;
os << r.reactionStr(reaction)<< token::END_STATEMENT <<nl;
return os;
r.write(os);
return os;
}
......
......@@ -89,9 +89,7 @@ inline Foam::Ostream& Foam::operator<<
const ArrheniusReactionRate& arr
)
{
os << token::BEGIN_LIST
<< arr.A_ << token::SPACE << arr.beta_ << token::SPACE << arr.Ta_
<< token::END_LIST;
arr.write(os);
return os;
}
......
......@@ -108,9 +108,7 @@ inline Foam::Ostream& Foam::operator<<
<ReactionRate, ChemicallyActivationFunction>& carr
)
{
os << token::BEGIN_LIST
<< carr.k0_ << token::SPACE << carr.kInf_ << token::SPACE << carr.F_
<< token::END_LIST;
carr.write(os);
return os;
}
......
......@@ -120,12 +120,7 @@ inline Foam::Ostream& Foam::operator<<
const FallOffReactionRate<ReactionRate, FallOffFunction>& 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;
}
......
......@@ -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<JanevReactionRate::nb_; n++)
{
os << token::SPACE << jrr.b_[n];
}
os << token::END_LIST;
jrr.write(os);
return os;
}
......
......@@ -114,10 +114,7 @@ inline Foam::Ostream& Foam::operator<<
const LandauTellerReactionRate& arr
)
{
os << token::BEGIN_LIST
<< arr.A_ << token::SPACE << arr.beta_ << token::SPACE << arr.Ta_
<< token::SPACE << arr.B_ << token::SPACE << arr.C_
<< token::END_LIST;
arr.write(os);
return os;
}
......
......@@ -109,16 +109,7 @@ inline Foam::Ostream& Foam::operator<<
const LangmuirHinshelwoodReactionRate& lhrr
)
{
os << token::BEGIN_LIST;
for (int i=0; i<LangmuirHinshelwoodReactionRate::n_; i++)
{
os << token::SPACE
<< '(' << lhrr.A_[i] << token::SPACE << lhrr.Ta_[i] << ')';
}
os << token::END_LIST;
lhrr.write(os);
return os;
}
......
......@@ -83,14 +83,7 @@ inline Foam::Ostream& Foam::operator<<
const Foam::SRIFallOffFunction& srifof
)
{
os << token::BEGIN_LIST
<< srifof.a_
<< token::SPACE << srifof.b_
<< token::SPACE << srifof.c_
<< token::SPACE << srifof.d_
<< token::SPACE << srifof.e_
<< token::END_LIST;
srifof.write(os);
return os;
}
......
......@@ -92,13 +92,7 @@ inline Foam::Ostream& Foam::operator<<
const Foam::TroeFallOffFunction& tfof
)
{
os << token::BEGIN_LIST
<< tfof.alpha_
<< token::SPACE << tfof.Tsss_
<< token::SPACE << tfof.Ts_
<< token::SPACE << tfof.Tss_
<< token::END_LIST;
tfof.write(os);
return os;
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -60,8 +60,7 @@ inline Foam::Ostream& Foam::operator<<
const infiniteReactionRate& rr
)
{
os << token::BEGIN_LIST
<< token::END_LIST;
rr.write(os);
return os;
}
......
......@@ -97,16 +97,7 @@ inline Foam::Ostream& Foam::operator<<
const powerSeriesReactionRate& psrr
)
{
os << token::BEGIN_LIST
<< psrr.A_ << token::SPACE << psrr.beta_ << token::SPACE << psrr.Ta_;
for (int n=0; n<powerSeriesReactionRate::nCoeff_; n++)
{
os << token::SPACE << psrr.coeffs_[n];
}
os << token::END_LIST;
psrr.write(os);
return os;
}
......
......@@ -81,10 +81,7 @@ inline Foam::Ostream& Foam::operator<<
const thirdBodyArrheniusReactionRate& arr
)
{
os << token::BEGIN_LIST
<< static_cast<const ArrheniusReactionRate&>(arr)
<< token::SPACE << arr.thirdBodyEfficiencies_
<< token::END_LIST;
arr.write(os);
return os;
}
......
......@@ -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<orderedTbes.size(); i++)
{
if (equal(orderedTbes[i], val))
{
count++;
}
else
{
if (count > 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;
}
......
Supports Markdown
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