[Gmsh] an issue when using api to create second order 2D mesh
    Xin Liu 
    liu1512 at purdue.edu
       
    Wed Sep  6 17:44:47 CEST 2017
    
    
  
Dear all,
I am using gmsh API to create a simple second order 2D mesh. The simplified codes are
#include <stdio.h>
#include "Gmsh.h"
#include "GModel.h"
int main(int argc, char **argv)
{
  GmshInitialize(0, 0);
  GModel *m = new GModel();
  m->setFactory("Gmsh");
  GVertex *v1 = m->addVertex(0, 1, 0, 0.1);
  GVertex *v2 = m->addVertex(0, 2, 0, 0.1);
  GVertex *v3 = m->addVertex(0, 3, 0, 0.1);
  GVertex *v4 = m->addVertex(1, 3, 0, 0.1);
  GVertex *v5 = m->addVertex(1, 2, 0, 0.1);
  GVertex *v6 = m->addVertex(1, 1, 0, 0.1);
  std::vector<GEdge*> edges1;
  edges1.push_back(m->addLine(v1, v2));
  edges1.push_back(m->addLine(v2, v5));
  edges1.push_back(m->addLine(v5, v6));
  edges1.push_back(m->addLine(v6, v1));
  std::vector<GEdge*> edges2;
  edges2.push_back(m->addLine(v2, v3));
  edges2.push_back(m->addLine(v3, v4));
  edges2.push_back(m->addLine(v4, v5));
  edges2.push_back(m->addLine(v5, v2));
  std::vector<std::vector<GEdge*> > loop1;
  loop1.push_back(edges1);
  std::vector<std::vector<GEdge*> > loop2;
  loop2.push_back(edges2);
  GFace *f1 = m->addPlanarFace(loop1);
  f1->addPhysicalEntity(1);
  GFace *f2 = m->addPlanarFace(loop2);
  f2->addPhysicalEntity(2);
  m->mesh(2);
  m->setOrderN(2, 0, 0);
  m->writeSC("test.msh");
  delete m;
  GmshFinalize();
}
After running the codes, I opened the .msh file with Gmsh. Then, I found there are some repeated nodes at the interface of two surfaces (attachment1). However, if I use gmsh gui to create this model and mesh it, then this issue doesn't exist. Any suggestions or comments are great appreciate.
Thanks
Lambert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20170906/5c6689b5/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: attachment1.jpg
Type: image/jpeg
Size: 44208 bytes
Desc: attachment1.jpg
URL: <http://onelab.info/pipermail/gmsh/attachments/20170906/5c6689b5/attachment-0001.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.msh
Type: application/octet-stream
Size: 59983 bytes
Desc: test.msh
URL: <http://onelab.info/pipermail/gmsh/attachments/20170906/5c6689b5/attachment-0001.msh>
    
    
More information about the gmsh
mailing list