Skip to content

Experimental CLib oneD API#1863

Merged
speth merged 16 commits intoCantera:mainfrom
ischoegl:clib-onedim
Apr 23, 2025
Merged

Experimental CLib oneD API#1863
speth merged 16 commits intoCantera:mainfrom
ischoegl:clib-onedim

Conversation

@ischoegl
Copy link
Copy Markdown
Member

@ischoegl ischoegl commented Mar 22, 2025

Changes proposed in this pull request

Implement oneD API in the experimental CLib. Further:

  • Differentiate CLib function names for class specializations
  • Clarify templates for header and source files
  • Add experimental CLib to uploaded shared libraries

If applicable, fill in the issue number this pull request is fixing

Addresses Cantera/enhancements#220

If applicable, provide an example illustrating new features this pull request is introducing

Checklist

  • 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

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.34%. Comparing base (a3eb9cd) to head (5dc587d).
Report is 85 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##             main    #1863     +/-   ##
=========================================
  Coverage   74.33%   74.34%             
=========================================
  Files         387      443     +56     
  Lines       53652    55420   +1768     
  Branches     9074     9106     +32     
=========================================
+ Hits        39884    41203   +1319     
- Misses      10696    11118    +422     
- Partials     3072     3099     +27     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ischoegl ischoegl force-pushed the clib-onedim branch 11 times, most recently from 348e861 to 6cb8a86 Compare March 23, 2025 17:58
@ischoegl ischoegl marked this pull request as ready for review March 23, 2025 18:23
@ischoegl ischoegl requested a review from a team March 23, 2025 18:27
@ischoegl ischoegl force-pushed the clib-onedim branch 2 times, most recently from ad27841 to 41f6383 Compare March 31, 2025 19:40
@ischoegl

This comment was marked as outdated.

Copy link
Copy Markdown
Member

@speth speth left a comment

Choose a reason for hiding this comment

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

Thanks, @ischoegl. I think this generally looks good. Just a couple of minor comments.

Comment on lines 513 to +516

//! Set up initial grid.
//! @since New in %Cantera 3.2.
void setupGrid(const vector<double>& grid);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we avoid introducing this overload for setupGrid? If we did this for every method that took double*, we'd have a lot of extra boilerplate code, and I don't want to force users to use std::vector.

Copy link
Copy Markdown
Member Author

@ischoegl ischoegl Apr 21, 2025

Choose a reason for hiding this comment

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

This is a little more than meets the eye. The current setupGrid(size_t n, const double* z) is an outlier as it takes the array size as an additional argument rather than just the pointer. I currently don't have a rule to handle that outlier in the logic of CLibSourceGenerator and am hesitant to add it as it's different from what we do elsewhere. We have the alternative of introducing a setupGrid(const double* z) and deprecate the current version to be consistent with the remainder of our API. (Edit: that won't work as different to other cases the size of the array isn't known a priori). I opted for the inherently safer version of a std::vector.

PPS: Fwiw, the signature setupGrid(size_t n, const double* z) with size followed by array pointer is consistent with how we handle things in CLib. This is about the decision whether we allow for an overload that can be handled by standard logic or we add an edge case.

@speth speth merged commit 1367c9f into Cantera:main Apr 23, 2025
49 checks passed
@ischoegl ischoegl deleted the clib-onedim branch April 23, 2025 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants