ENH: Updates to ReactionList

This commit is contained in:
andy
2010-10-12 13:10:37 +01:00
parent 51920400c7
commit f2ba3c654b
6 changed files with 17 additions and 32 deletions

View File

@ -108,7 +108,7 @@ public:
virtual const HashPtrTable<ThermoType>& speciesThermo() const = 0;
virtual const PtrList<Reaction<ThermoType> >& reactions() const = 0;
virtual const ReactionList<ThermoType>& reactions() const = 0;
};

View File

@ -858,7 +858,8 @@ Foam::chemkinReader::chemkinReader
:
lineNo_(1),
specieNames_(10),
speciesTable_()
speciesTable_(),
reactions_(speciesTable_, speciesThermo_)
{
read(CHEMKINFileName, thermoFileName);
}
@ -868,7 +869,8 @@ Foam::chemkinReader::chemkinReader(const dictionary& thermoDict)
:
lineNo_(1),
specieNames_(10),
speciesTable_()
speciesTable_(),
reactions_(speciesTable_, speciesThermo_)
{
fileName chemkinFile
(

View File

@ -205,7 +205,7 @@ private:
HashTable<List<specieElement> > specieComposition_;
//- List of the reactions
SLPtrList<Reaction<gasThermoPhysics> > reactions_;
ReactionList<gasThermoPhysics> reactions_;
// Private Member Functions
@ -375,10 +375,9 @@ public:
}
//- List of the reactions
const PtrList<Reaction<gasThermoPhysics> >& reactions() const
const ReactionList<gasThermoPhysics>& reactions() const
{
return PtrList<Reaction<gasThermoPhysics> >(reactions_);
// return reactions_;
return reactions_;
}
};

View File

@ -117,9 +117,9 @@ public:
}
//- List of the reactions
const PtrList<Reaction<ThermoType> >& reactions() const
const ReactionList<ThermoType>& reactions() const
{
return reactions_.reactions();
return reactions_;
}
};

View File

@ -36,7 +36,7 @@ Foam::ReactionList<ThermoType>::ReactionList
const HashPtrTable<ThermoType>& thermoDb
)
:
PtrList<Reaction<ThermoType> >(),
SLPtrList<Reaction<ThermoType> >(),
species_(species),
thermoDb_(thermoDb),
dict_(dictionary::null)
@ -51,7 +51,7 @@ Foam::ReactionList<ThermoType>::ReactionList
const dictionary& dict
)
:
PtrList<Reaction<ThermoType> >(),
SLPtrList<Reaction<ThermoType> >(),
species_(species),
thermoDb_(thermoDb),
dict_(dict)
@ -68,7 +68,7 @@ Foam::ReactionList<ThermoType>::ReactionList
const fileName& fName
)
:
PtrList<Reaction<ThermoType> >
SLPtrList<Reaction<ThermoType> >
(
dictionary(IFstream(fName)()).lookup("reactions"),
Reaction<ThermoType>::iNew(species, thermoDb)
@ -82,7 +82,7 @@ Foam::ReactionList<ThermoType>::ReactionList
template<class ThermoType>
Foam::ReactionList<ThermoType>::ReactionList(const ReactionList& reactions)
:
PtrList<Reaction<ThermoType> >(reactions),
SLPtrList<Reaction<ThermoType> >(reactions),
species_(reactions.species_),
thermoDb_(reactions.thermoDb_),
dict_(reactions.dict_)
@ -102,35 +102,22 @@ template<class ThermoType>
bool Foam::ReactionList<ThermoType>::readReactionDict()
{
const dictionary& reactions(dict_.subDict("reactions"));
PtrList<Reaction<ThermoType> > newPtrs(reactions.size());
label i = 0;
forAllConstIter(dictionary, reactions, iter)
{
newPtrs.set
this->append
(
i++,
Reaction<ThermoType>::New
(
species_,
thermoDb_,
reactions.subDict(iter().keyword())
)
).ptr()
);
}
PtrList<Reaction<ThermoType> >::transfer(newPtrs);
return true;
}
template<class ThermoType>
const Foam::PtrList<Foam::Reaction<ThermoType> >&
Foam::ReactionList<ThermoType>::reactions() const
{
return *this;
}
// ************************************************************************* //

View File

@ -54,7 +54,7 @@ namespace Foam
template<class ThermoType>
class ReactionList
:
private PtrList<Reaction<ThermoType> >
public SLPtrList<Reaction<ThermoType> >
{
// Private data
@ -113,9 +113,6 @@ public:
//- Read reactions from dictionary
bool readReactionDict();
//- Return the list of reactions
const PtrList<Reaction<ThermoType> >& reactions() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //