Cantera  3.1.0a2
Loading...
Searching...
No Matches
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(const AnyMap& node, const UnitStack& rate_units)
13 : CustomFunc1Rate()
14{
15 setParameters(node, rate_units);
16}
17
18void CustomFunc1Rate::setRateFunction(shared_ptr<Func1> f)
19{
20 m_ratefunc = f;
21 m_valid = true;
22}
23
24void CustomFunc1Rate::validate(const string& equation, const Kinetics& kin)
25{
26 if (!m_ratefunc) {
27 throw InputFileError("CustomFunc1Rate::validate", m_input,
28 "Rate object for reaction '{}' is not configured.", equation);
29 }
30}
31
32double CustomFunc1Rate::evalFromStruct(const ArrheniusData& shared_data) const
33{
34 if (m_ratefunc) {
35 return m_ratefunc->eval(shared_data.temperature);
36 }
37 return NAN;
38}
39
40void CustomFunc1Rate::getParameters(AnyMap& rateNode, const Units& rate_units) const
41{
42 throw NotImplementedError("CustomFunc1Rate::getParameters",
43 "Not implemented by '{}' object.", type());
44}
45
46}
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:427
Error thrown for problems processing information contained in an AnyMap or AnyValue.
Definition AnyMap.h:738
Public interface for kinetics managers.
Definition Kinetics.h:125
An error indicating that an unimplemented function has been called.
A representation of the units associated with a dimensional quantity.
Definition Units.h:35
Namespace for the Cantera kernel.
Definition AnyMap.cpp:564
Data container holding shared data specific to ArrheniusRate.
Definition Arrhenius.h:30
double temperature
temperature