Open SylvainPlessis opened 9 years ago
The default problem:
when building/resetting kinetics rate constant:
method_name(KineticsType<CoeffType,VectorCoeffType> & rate, other stuff)
{
switch(rate.type())
{
...
static_cast<HercourtEssenRate<CoeffType>*>(&rate)->do_something;
...
static_cast<PhotochemicalRate<CoeffType,VectorCoeffType>*>(&rate)->do_something;
}
}
VectorCoeffType
is always std::vector<CoeffType>
, so it never arose that a default declaration of VectorCoeffType
implies it cannot be otherwise:
KineticsType<CoeffType,VectorCoeffType>
in the Hercourt-Essen static cast is necessarily a KineticsType<CoeffType,DefaultVectorType>
whereas, if passing a photochemical rate, we have in the argument a KineticsType<CoeffType,CustomVectorType>
. It can't work if Custom =/ Default.
Basically, either we move the VectorCoeffType
up to the other kinetics model, or we totally separate the particle flux reaction rates. The second choice seems more appropriate. We derive from KineticsType<CoeffType>
a FluxKineticsType<CoeffType,VectorCoeffType>
and we overload all the necessary methods.
I'm putting this here to be sure I won't forget it.
The
VectorCoeffType
type is required for photochemistry. It is defined in _read_reaction_setdata.h at line 430. The type of the data defined at that line is theVectorCoeffType
and isstd::vector<CoeffType>
, using theCoeffType
denomination.The chain of template inheritance is:
KineticsType<CoeffType,VectorCoeffType = std::vector<CoeffType> >
---->Reaction<CoeffType, VectorCoeffType = std::vector<CoeffType> >
--////-->ReactionSet<CoeffType>
--////-->KineticsEvaluator<CoeffType,StateType>
VectorCoeffType
custom definition stops atReactionSet<CoeffType>
as it contains astd::vector<Reaction<CoeffType>*>
.So we need to finish the template inheritance with
ReactionSet
andKineticsEvaluator
. One consequence will be that _read_reaction_setdata will require to be templated aroundVectorCoeffType
too.Once the template inheritance chain is done,
VectorCoeffType
will be defined by the declaration ofReactionSet
andKineticsEvaluator
, and the world will be a better place.