multiple Python modules & multiple instances of the global state
YaspGrid keeps global state that is initialized in the YaspGrid::init()
function:
Yasp::BinomialTable<dim>::init();
Yasp::EntityShiftTable<Yasp::calculate_entity_shift<dim>,dim>::init();
Yasp::EntityShiftTable<Yasp::calculate_entity_move<dim>,dim>::init();
The init()
function in turn is called in YaspGrid's constructor.
It looks like the global state is duplicated between Python module, that is when one Python module (e.g. dune.generated.hierarchicalgrid_*.so) creates the YaspGrid and passes the YaspGrid instance to another Python module (e.g. gridglue.so), the global state might not be initialized in the second Python module (as no constructor was called).
Calling YaspGrid's constructor for a dummy grid in gridglue.so made my program work (this should have initialized the second copy of the global state).