[Gmsh] gmsh API used in a loop

Guilherme Praciano Karst Caminha gpkc at cin.ufpe.br
Mon Sep 30 23:54:49 CEST 2013


Hello,
I'm having a little trouble using GMSH in a loop. I don't know why, but
when I load a .geo file and mesh it, using a background mesh, it works fine
for the first time, but when the meshing process happens again, it looks
like GMSH still holds some information about the last generated mesh, and
the result is very similar to the previous one, when it shouldn't be.

Here's what the code looks like:

while(...) {

GModel *m = new GModel();
m->setAsCurrent();
m->readGEO("Geometry");
m->mesh(2);
m->writeMSH("Geometry.msh", 1.0);
delete m;

//...
//Do some work and modify the background mesh, etc...
//so the next time the generated mesh should be very different from this one
//...
}

I suspect that this output has something to do with this result:

Error   : 'Geometry', line 2 : Point 162 already exists
Error   : 'Geometry', line 3 : Point 48 already exists
Error   : 'Geometry', line 4 : Point 257 already exists
Error   : 'Geometry', line 5 : Point 260 already exists
... (repeat many times)


Is there a solution for this, or I shouldn't be using GMSH iteratively like
this? Is there some kind of turnaround for this (or maybe I'm using gmsh
completly wrong...)?

Thanks in advance.

Regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20130930/f56cedf6/attachment.html>