FreeFem / FreeFem-sources

FreeFEM source code
https://freefem.org/
Other
770 stars 191 forks source link

Executing FreeFem++ kernels in the Jupyter notebook #85

Open flothesof opened 5 years ago

flothesof commented 5 years ago

Hi there,

I'm interested in using FreeFem in a different environment than text editor + command line to run .edp files.

In particular, I would be interested in running FreeFem scripts in the Jupyter notebook. Do you think this would be possible? I've looked for such a capability and found something that goes in this direction here: https://nbviewer.jupyter.org/github/rrgalvan/pyrunner/blob/master/pyrunner_keller-segel.ipynb

However, what would be really interesting would be to be able to interact with the FreeFem interpreter using cells. This exists for instance in Python but also in C++ (using a dedicated kernel). I think the example that sums it up best is this live example in binder: https://mybinder.org/v2/gh/QuantStack/xeus-cling/stable?filepath=notebooks/xcpp.ipynb

This would allow easier iteration on the model files and a different style of step by step documentation.

What do you think of this idea?

Regards, Florian

rrgalvan commented 5 years ago

Hello,

I completely agree with you. I'm the author of pyrunner, the resource you cited, https://nbviewer.jupyter.org/github/rrgalvan/pyrunner/blob/master/pyrunner_keller-segel.ipynb, https://github.com/rrgalvan/pyrunner. It was programmed with the idea of executing FreeFem++ code on Jupyter. But unfortunately it is far from being the solution, because the FreeFem++ script needed to be programmed separately and then most of Jupyter's advantages were wasted

What is really needed is to program a Jupyter kernel, so that FreeFem++ becomes one of the (dozens of) languages which can be used interactively on Jupyter, https://github.com/jupyter/jupyter/wiki/Jupyter-kernels. I hope that someone with the necessary time and knowledge can do it one day

prj- commented 5 years ago

How about something like https://github.com/sourceryinstitute/jupyter-CAF-kernel or https://github.com/brendan-rius/jupyter-c-kernel (if you don't want to use FreeFem++-mpi)? My idea would be to replace occurrences of gcc by FreeFem++, but I'm a total Jupyter noob.

JoseCarlosGarcia95 commented 5 years ago

Hello,

I started working on a Jupyter Kernel few days ago. Development is on first stage right now, but there are things that on my opinion are working fine.

  1. Syntax highlighting
  2. 2D Graphics.(3D graphics workround is more complex)
  3. I have made some tests with FreeFem++-mpi and should work fine

You can check the project here: https://github.com/JoseCarlosGarcia95/freefem-jupyter