← Back to team overview

dolfin team mailing list archive

C++-function code in Python interface

 

Is it possible to add member functions to JIT-compiled C++ functions
that will be accessible in Python?

I want to do something like

code = """
class MyFunction : public Function
{
public:

  std::vector<double> _values;

  MyFunction(FunctionSpace& V) : Function(V) {}

  void eval(double* values, const Data& data) const
  {
    values[0] = _values[data.cell().index()];
  }

  void update(stuff)
  {
    // Recompute _values here
  }

};"""

When I try this, the update() function is not accessible from Python.

--
Anders

Attachment: signature.asc
Description: Digital signature


Follow ups