[Gmsh] How to work with arrays?

Ruth Vazquez Sabariego ruth.sabariego at kuleuven.be
Wed Sep 14 16:28:40 CEST 2016

Dear Aleksejs,
The problem is the indexing. You should start at 0.

For i In {0:n-1}
   ss1[i] = ...
   ss2[i] = ...
   ss3[i] = …

Otherwise, the first element of the array won’t be correct.
From your error msg, seems to be 0.


Prof. Ruth V. Sabariego
KU Leuven
Dept. Electrical Engineering ESAT/Electa, EnergyVille

Free software: http://gmsh.info | http://getdp.info | http://onelab.info

On 14 Sep 2016, at 12:05, Aleksejs Fomins <aleksejs.fomins at lspr.swiss<mailto:aleksejs.fomins at lspr.swiss>> wrote:

Dear Gmsh,
I am trying to make a complicated surface loop

surfloop = newreg;  Surface Loop(surfloop_air) = {ss1[], ss2[], ss3[], ss4[], s1, s2, s3, s4, s5};

where s* are Plane Surfaces and ss* are arrays of plane surfaces. I generate my surface arrays in a loop

For i In {1:n}
   ss1[i] = ...
   ss2[i] = ...
   ss3[i] = ...

I notice that this works if only ss1 is generated inside the loop, as then the index GMSH assigns to it is continuous. Otherwise I get error "Unknown surface 0". However, I can plot any one entry of any array, e.g. ss2[18], and I would see what I expect, so the arrays are correct.

Could you please explain to me, what is the correct way to pass all entries of an array?

Best regards,

gmsh mailing list
gmsh at onelab.info<mailto:gmsh at onelab.info>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20160914/bfd426d3/attachment.html>

More information about the gmsh mailing list