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
6#include "cantera/kinetics/Custom.h"
7#include "cantera/numerics/Func1.h"
8
9 namespace Cantera
10{
11
12CustomFunc1Rate::CustomFunc1Rate()
13 : m_ratefunc(0)
14{
15}
16
17 void CustomFunc1Rate::setRateFunction(shared_ptr<Func1> f)
18{
19 m_ratefunc = f;
20}
21
22 void 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
30 double 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
38 void CustomFunc1Rate::getParameters(AnyMap& rateNode, const Units& rate_units) const
39{
40 throw NotImplementedError("CustomFunc1Rate::getParameters",
41 "Not implemented by '{}' object.", type());
42}
43
44}
Custom.h
Func1.h
Cantera::AnyMap
A map of string keys to values whose type can vary at runtime.
Definition: AnyMap.h:399
Cantera::CanteraError
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:61
Cantera::Kinetics
Public interface for kinetics managers.
Definition: Kinetics.h:114
Cantera::NotImplementedError
An error indicating that an unimplemented function has been called.
Definition: ctexceptions.h:187
Cantera::Units
A representation of the units associated with a dimensional quantity.
Definition: Units.h:30
Cantera
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:557
Cantera::ArrheniusData
Data container holding shared data specific to ArrheniusRate.
Definition: Arrhenius.h:30
Cantera::ReactionData::temperature
double temperature
temperature
Definition: ReactionData.h:109