Skip to content

Python Bindings for base engine retreival are insufficient #11

@tboudreaux

Description

@tboudreaux

Currently the python bindings to access the base engines of either EngineViews or to access the engine stack from a Policy are insufficnent. There is a huge amount of boiler plate needed for what should be a simple operation. Further, there is a bug in getBaseEngine() on most engine views due to an incorrect return value policy.

Consider the following code

AEngine: AdaptiveEngineView
QSEEngine : MultiscalePartitioningEngineView = AEngine.getBaseEngine()

This crashes with the following error

Traceback (most recent call last):
  File "/Users/tboudreaux/Programming/4DSTAR/GridFire/validation/vv/GridFireValidationSuite.py", line 117, in <module>
    instance(args.pynucastro_compare, args.pync_engine)
    ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tboudreaux/Programming/4DSTAR/GridFire/validation/vv/GridFireValidationSuite.py", line 35, in __call__
    self.evolve(engine, netIn, pynucastro_compare = pynucastro_compare, policy=policy, depth=EngineNameToDepth[pync_engine.lower()])
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tboudreaux/Programming/4DSTAR/GridFire/validation/vv/testsuite.py", line 248, in evolve
    l_engine = l_engine.getBaseEngine()
RuntimeError: return_value_policy = copy, but type is non-copyable! (#define PYBIND11_DETAILED_ERROR_MESSAGES or compile in debug mode for details)

The issue here is that we are returning a reference without setting the proper return value policy in pybind.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature or request

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions