Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delegate reactor implementation to user-provided Python classes #1003

Merged
merged 49 commits into from
Dec 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
df6ba5f
[Reactor] Proof of concept for delegating methods to Python
speth Mar 16, 2021
3f6cc82
[Reactor] Make reference counting for delegated methods more robust
speth Mar 17, 2021
af209a9
[Reactor] Add ability to delegate functions that take array arguments
speth Mar 18, 2021
5c85ec6
[Reactor] Generalize mechanism for registering delegated functions
speth Mar 19, 2021
9c75c36
[Reactor] Add ability to delegate methods with return values
speth Mar 19, 2021
88c9f45
[Reactor] De-virtualize some generic get/set functions
speth Mar 19, 2021
42abbef
[Reactor] Add delegates for remaining core Reactor functions
speth Mar 19, 2021
e38145f
[Reactor] Make some member variables available to DelegatedReactor im…
speth Mar 19, 2021
a347407
[Reactor] Added a DelegatedReactor example with an extra equation
speth Mar 20, 2021
f6d3463
Modify delegate creator functions to return the delegate
speth Mar 22, 2021
ce197ba
Revise behavior of "after" delegates that return a value
speth Mar 22, 2021
54806d8
[Python] Prefix replacement delegate methods with 'replace_'
speth Mar 22, 2021
b0aa180
[Reactor] Use ReactorNet to manage application of sensitivity params
speth Mar 23, 2021
11deb92
[Reactor] Introduce simpler function for reactor ODE function
speth Mar 23, 2021
28436c1
[Python] Add some basic tests of delegated reactors
speth Mar 25, 2021
4f5f2d4
[Reactor] Add methods for restoring thermo states from delegated reac…
speth Mar 25, 2021
95c5d58
[Python] Support multiple levels of inheritance in delegated classes
speth Mar 27, 2021
8a834c3
[Doc] Add documentation for delegation capabilities
speth Mar 28, 2021
6a06560
Added RHS and LHS user variables to Reactor class
chinahg Jun 9, 2021
6155ea2
Created new setDelegate method for void(double, double*, double*) type
chinahg Aug 10, 2021
6925df6
Minor formatting changes
chinahg Dec 1, 2021
7e22e49
Fix custom2.py to use RHS/LHS eval function
chinahg Dec 6, 2021
8a40d1e
Move size calculation out of delegate functions
speth Dec 7, 2021
c5370ba
Simplify delgators for functions that return void
speth Dec 7, 2021
e8a1ce3
Simplify delegation of functions with a return value
speth Dec 7, 2021
c38266c
[Delegator] Fix some formatting issues
speth Dec 8, 2021
495ba2a
Rename DelegatedReactor to ExtensibleReactor
speth Dec 8, 2021
ce86d11
Update delegator-related documentation
speth Dec 8, 2021
dcdaa98
[Test] Add test of ExtensibleReactor with external heat transfer
speth Dec 8, 2021
2edd92f
[Kinetics] Make "declared-species" option work for surfaces
speth Dec 12, 2021
9ca5583
[Python/Reactor] Make attached surfaces available via Reactor object
speth Dec 12, 2021
d2394f3
[Reactor] Modify signature of evalSurfaces
speth Dec 14, 2021
b46bfcf
Check for errors in assign_delegates
speth Dec 14, 2021
71c2276
Make demangle available outside AnyMap
speth Dec 14, 2021
e0fc51f
[Delegator] Check for errors with delegate inputs/outputs
speth Dec 14, 2021
f415c2c
[Python] Indicate additional methods that can throw C++ exceptions
speth Dec 14, 2021
1f68233
[Python/Reactor] Sync state when accessing ReactorSurface.kinetics
speth Dec 15, 2021
a161f26
[Test] Add an ExtensibleReactor test with surfaces
speth Dec 12, 2021
7b667d7
[Delegator] Test raising exceptions from within delegates
speth Dec 15, 2021
ccf03a9
[Reactor] Use more intuitive variable name for species equation RHS
speth Dec 15, 2021
4d0039e
[Test] Add extensible reactor test with multiple connected reactors
speth Dec 15, 2021
58c218d
[Test] Add some more extensible reactor tests
speth Dec 16, 2021
d6bd8c7
[Reactor] Include temperature in ReactorSurface synchronization
speth Dec 16, 2021
1035b7e
[Delegator] Fix calling delegated functions after prior exception
speth Dec 16, 2021
3e5e10b
[Delegator] Hold delegate references in Python instead of C++
speth Dec 17, 2021
aaf6d57
[Delegator] Document delegate mnemonics and make them consistent
speth Dec 17, 2021
c997235
[Delegator] Document return value handling for before/after delegates
speth Dec 17, 2021
942f7af
Document requirements for new delegated function types
speth Dec 17, 2021
3d813ed
[Reactor] Clean up some code formatting issues
speth Dec 31, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ David Fronczek
Mark E. Fuller (@mefuller), Technion
Matteo Giani (@MarcDuQuesne)
Dave Goodwin, California Institute of Technology
China Hagström (@chinahg), Massachusetts Institute of Technology
John Hewson (@jchewson), Sandia National Laboratory
Trevor Hickey (@luxe)
Yuanjie Jiang
Expand Down
16 changes: 16 additions & 0 deletions doc/sphinx/cython/zerodim.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,22 @@ FlowReactor
^^^^^^^^^^^
.. autoclass:: FlowReactor(contents=None, *, name=None, energy='on')

ExtensibleReactor
^^^^^^^^^^^^^^^^^
.. autoclass:: ExtensibleReactor

ExtensibleIdealGasReactor
^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: ExtensibleIdealGasReactor(contents=None, *, name=None, energy='on')

ExtensibleConstPressureReactor
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: ExtensibleConstPressureReactor(contents=None, *, name=None, energy='on')

ExtensibleIdealGasConstPressureReactor
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: ExtensibleIdealGasConstPressureReactor(contents=None, *, name=None, energy='on')

Walls
-----

Expand Down
6 changes: 0 additions & 6 deletions include/cantera/base/AnyMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,6 @@ class AnyValue : public AnyBase
void setFlowStyle(bool flow=true);

private:
std::string demangle(const std::type_info& type) const;

template<class T>
void checkSize(const std::vector<T>& v, size_t nMin, size_t nMax) const;

Expand All @@ -277,10 +275,6 @@ class AnyValue : public AnyBase
//! The held value
std::unique_ptr<boost::any> m_value;

//! Human-readable names for some common types, for use when
//! `boost::demangle` is not available.
static std::map<std::string, std::string> s_typenames;

typedef bool (*Comparer)(const boost::any&, const boost::any&);

//! Equality comparison function used when *lhs* is of type *T*
Expand Down
2 changes: 2 additions & 0 deletions include/cantera/base/AnyMap.inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

namespace Cantera
{
// re-declared to avoid needing to include global.h here
std::string demangle(const std::type_info& type);

// Definitions for AnyValue templated functions

Expand Down
Loading