Cantera 2.6.0
Custom.cpp
Go to the documentation of this file.
1//! @file Custom.cpp
2
3// This file is part of Cantera. See License.txt in the top-level directory or
4// at https://cantera.org/license.txt for license and copyright information.
5
8
9namespace Cantera
10{
11
12CustomFunc1Rate::CustomFunc1Rate()
13 : m_ratefunc(0)
14{
15}
16
17void CustomFunc1Rate::setRateFunction(shared_ptr<Func1> f)
18{
19 m_ratefunc = f;
20}
21
22void CustomFunc1Rate::validate(const std::string& equation, const Kinetics& kin)
23{
24 if (!m_ratefunc) {
25 throw CanteraError("CustomFunc1Rate::validate",
26 "Rate object for reaction '{}' is not configured.", equation);
27 }
28}
29
30double CustomFunc1Rate::evalFromStruct(const ArrheniusData& shared_data) const
31{
32 if (m_ratefunc) {
33 return m_ratefunc->eval(shared_data.temperature);
34 }
35 return NAN;
36}
37
38void CustomFunc1Rate::getParameters(AnyMap& rateNode, const Units& rate_units) const
39{
40 throw NotImplementedError("CustomFunc1Rate::getParameters",
41 "Not implemented by '{}' object.", type());
42}
43
44}
A map of string keys to values whose type can vary at runtime.
Definition: AnyMap.h:399
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:61
Public interface for kinetics managers.
Definition: Kinetics.h:114
An error indicating that an unimplemented function has been called.
Definition: ctexceptions.h:187
A representation of the units associated with a dimensional quantity.
Definition: Units.h:30
Namespace for the Cantera kernel.
Definition: AnyMap.h:29
Data container holding shared data specific to ArrheniusRate.
Definition: Arrhenius.h:30
double temperature
temperature
Definition: ReactionData.h:109