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

Christophe Geuzaine cgeuzaine at ulg.ac.be
Tue Feb 5 02:16:31 CET 2013


On 04 Feb 2013, at 15:53, Nico Schlömer <nico.schloemer at gmail.com> wrote:

> 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?
> 

Use %g also for id (all variables are floating point in the .geo parser)


> --Nico
> 
> _______________________________________________
> gmsh mailing list
> gmsh at geuz.org
> http://www.geuz.org/mailman/listinfo/gmsh

-- 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science 
http://www.montefiore.ulg.ac.be/~geuzaine