[Gmsh] Joining-Merging(?) 2 msh files

Christophe Geuzaine geuzaine at acm.caltech.edu
Fri Jul 16 02:29:49 CEST 2004


jlsonnette at tiscali.fr wrote:

> Dear Gmsh-users
> 
> I am exploring the possibilities in Gmsh to add two geo-files and/or two
> msh-files together -- preferably the later.
> 
> First, I have developed a mesh for the main branch of a river (2D Mesh for
> the Shallow Water Equations), and secondly I have created a mesh for a
> sub-branch. (The two files have been created in a consistent coordinate
> system.) Now, I would like to put them together to create a more complete
> model.
> 
> I am not certain that 'Merge' actually would do what I want.  The
> explanation on the Merge-function I have found on:
> http://www.geuz.org/gmsh/doc/texinfo/gmsh_9.html
> is rather promissing, but at the same time it isn't quite what I am
> looking for, putting two .msh files together.

Jean - 'Merge' will actually try to merge the file, but it will complain
if nodes or elements have identical numbers. And there is no way at the
moment to specify the starting node/element number in Gmsh (unless you
change the source code, of course).

The only way to do what you want is thus be to write a little
program/script that reads the two files, renumbers the nodes and the
elements, and spits out the combination. It is of course more
complicated if you have connections between the two parts (shared
nodes/edges)... If you do write such a script (or if you write a routine
inside Gmsh), please let us know: this might interest other users.

Best,

Christophe

-- 
Christophe Geuzaine
Applied and Computational Mathematics, Caltech
geuzaine at acm.caltech.edu - http://geuz.org