[Gmsh] Doubts about Merge files

Christophe Geuzaine cgeuzaine at ulg.ac.be
Fri Apr 5 09:56:18 CEST 2013


On 26 Mar 2013, at 21:25, Bruno Correia da Silva <bcs2 at cin.ufpe.br> wrote:

> Hi everyone,
> 
> I am using of GMSH  to make merge in meshes.
> I did this cpp:
> 

Merge simply adds everything in the same model: in your case this results in an invalid resulting mesh (you can reproduce the same behavior in the GUI). To fuse two grids, you would need to make sure they don't contain entities with clashing tags, then remove the duplicate vertices (m->removeDuplicateMeshVertices()).

> 
> #include <stdio.h>
> #include "Gmsh.h"
> #include "GModel.h"
> #include "MElement.h"
> 
> #include <iostream>
> using namespace std;
> #include <stdio.h>
> #include <string.h>
> 
> int main(int argc, char **argv)
> {
>  GmshInitialize(argc, argv);
>  if(argc ==1){
>       	GmshSetOption("General", "Terminal", 1.);
>        char str[80];
>        strcpy (str,argv[1]);
>        strcat (str,".msh");
>       	GModel *m = new GModel();
>        m->readGEO(argv[1]);
>        m->mesh(3);
>        m->writeMSH(str, 1.0);
>        delete m;
>  }
>  else if (argc >2){
>    GmshSetOption("General", "Terminal", 1.);
>    GModel *m = new GModel();
>    m->readMSH(argv[1]);//mesh1.msh
>    GmshMergeFile(argv[2]);//mesh2.msh
>    m->writeMSH("test.msh", 1.0);
>    delete m;
>  }
>  GmshFinalize();
> }
> 
> The GMSH show me this error when i try open the test.msh:
> Error  Wrong vertex index 0
> Error Error loading 'test.msh'
> 
> The two input files are attached.
> 
> Some clues to correct this?
> 
> att.
> Bruno Correia
> <M1.msh><M2.msh>_______________________________________________
> 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