[Gmsh] fields: MathEval with "dynamic" field ID

Nico Schlömer nico.schloemer at gmail.com
Tue Feb 5 00:53:16 CET 2013


Hi all,

I would like to refine a mesh around an attractor using MathEval.
It all works when hardcoding field IDs, e.g.,

Field[0] = Attractor;
Field[0].NodesList = {1,2};
Field[5] = MathEval;
Field[5].F = Sprintf("F0^2 + %g", lc / 100);

as in the fields.geo example.
However, when using "variable" field IDs such as

id = newf;
Field[id] = Attractor;
Field[id].NodesList = {1,2};
Field[5] = MathEval;
Field[5].F = Sprintf("F%d^2 + %g", id, lc / 100);

it doesn't. -- What would I need to put into Sprintf() for this to work?

--Nico