| Cantera 3.0.0

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
6#include "cantera/kinetics/Custom.h"
7#include "cantera/numerics/Func1.h"
8
9 namespace Cantera
10{
11
12CustomFunc1Rate::CustomFunc1Rate(const AnyMap& node, const UnitStack& rate_units)
13 : CustomFunc1Rate()
14{
15 setParameters(node, rate_units);
16}
17
18 void CustomFunc1Rate::setRateFunction(shared_ptr<Func1> f)
19{
20 m_ratefunc = f;
21 m_valid = true;
22}
23
24 void 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
32 double 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
40 void CustomFunc1Rate::getParameters(AnyMap& rateNode, const Units& rate_units) const
41{
42 throw NotImplementedError("CustomFunc1Rate::getParameters",
43 "Not implemented by '{}' object.", type());
44}
45
46}
Custom.h
Func1.h
Cantera::AnyMap
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:427
Cantera::InputFileError
Error thrown for problems processing information contained in an AnyMap or AnyValue.
Definition AnyMap.h:738
Cantera::Kinetics
Public interface for kinetics managers.
Definition Kinetics.h:126
Cantera::NotImplementedError
An error indicating that an unimplemented function has been called.
Definition ctexceptions.h:195
Cantera::Units
A representation of the units associated with a dimensional quantity.
Definition Units.h:35
Cantera
Namespace for the Cantera kernel.
Definition AnyMap.cpp:564
Cantera::ArrheniusData
Data container holding shared data specific to ArrheniusRate.
Definition Arrhenius.h:30
Cantera::ReactionData::temperature
double temperature
temperature
Definition ReactionData.h:110