- Run FreeFem++ scripts online.
- A Mathematical Model for Electrostatics as a Literate FreeFem++ Program
- From chapter 9.1.2 of the FreeFem++ documentation.
- Working Template
- Contains everything necessary to create a new FreeFem++-js document.
Here is how to include a runnable FreeFem++ script into any HTML page. A working template is also available.
The <head> section of the HTML document should contain
All script parts should be contained in HTML elements of class="ffjs", but they don't need to be contiguous. The program
listing can be interrupted anywhere to add more explanations as HTML, Latex (i.e. MathJax), pictures, etc. Some overly complex
script details can be hidden from view in a hidden HTML element (if they keep the ffjs class). Some lines of the
FreeFem++ may be modifiable (eg the following program text area can be widened to enter any FreeFem++ script).
<textarea class="ffjs"> mesh Th=square(10,10); plot(Th); </textarea>
The rest of the script can be displayed as fixed text fields with class="ffjs". All the script text is evaluated by
FreeFem++ when clicking on the evaluate button. The filename.edp parameter can be changed at any time.
<button type="button" onclick="ffjs_export('filename.edp')">Save</button> <button type="button" onclick="ffjs_evaluate()">Run</button> <button type="button" onclick="ffjs_reset()">Reset</button>
stdout and stderr are inserted into the same page.
<div id="ffjs_stdout" style="font-family:monospace;"></div> <div id="ffjs_stderr" style="font-family:monospace;"></div>
2D graphical results, with data-ffjs="default" to draw all plots in the same element, or data-ffjs="figure.eps"
to draw a plot with parameter ps="figure.eps" separately.
<canvas class="ffjs_graph" data-ffjs="default" style="width:100%;"> (message for older browsers where canvas is not implemented) </canvas>
- What is the required computer configuration?
- FreeFem++-js works on any computer or smartphone. It runs in the internet browser. No download or install is required.
- Where are the numerical computations done?
- Is there a risk of virus infection?
- How to run FreeFem++-js scripts when disconnected from the internet?
- Saving an HTML page containing FreeFem++-js to a local disk is enough to make it available offline. Saving a page can be also useful to keep a record of a modified script or to save on slow or data-capped internet connections.
- Will any FreeFem++ script run?
- With many thanks to the projects which where used in the making of FreeFem++-js
- Debian Linux, Emscripten, JQuery, Bootstrap, MathJax