Skip to content

[C++] Provide const access to falloff rate parameters#1857

Merged
ischoegl merged 1 commit intoCantera:mainfrom
g3bk47:patch-9
Mar 12, 2025
Merged

[C++] Provide const access to falloff rate parameters#1857
ischoegl merged 1 commit intoCantera:mainfrom
g3bk47:patch-9

Conversation

@g3bk47
Copy link
Copy Markdown
Contributor

@g3bk47 g3bk47 commented Mar 11, 2025

Changes proposed in this pull request

Currently, a constant kinetics object cannot be used to obtain the Arrhenius parameters of falloff reactions in the C++ interface without creating a copy of the reaction. Let's assume I need to access the Arrhenius parameters of a falloff reaction. I am working on a constant reference of the kinetics object:

void f(const BulkKinetics& kin) // pass the kinetics object as const ref
{
    // I want to access the Arrhenius parameters of the first reaction,
    // which I know is of type falloff
    const ArrheniusRate& rate = std::dynamic_pointer_cast<const FalloffRate>
                                 (kin.reaction(0)->rate())->lowRate();
    // ERROR: lowRate() is not a constant member function
}

To address this, constant variants of the lowRate() and highRate() member functions are added in this PR.

  • The pull request includes a clear description of this code change
  • Commit messages have short titles and reference relevant issues
  • Build passes (scons build & scons test) and unit tests address code coverage
  • Style & formatting of contributed code follows contributing guidelines
  • The pull request is ready for review

A constant kinetics object cannot be used to obtain the Arrhenius parameters of falloff reactions
Copy link
Copy Markdown
Member

@ischoegl ischoegl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @g3bk47 ... this all looks good to me! (The CI failures appear to be due to an unrelated regression.)

@ischoegl ischoegl merged commit fce3183 into Cantera:main Mar 12, 2025
33 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants