> On 6 Sep 2017, at 17:44, Xin Liu <liu1...@purdue.edu> wrote: > > 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));
Here you just duplicated curve v2-v5 (with reverse orientation)... Hence the duplicated vertices. PS: note that this undocumented API will be replaced by a documented, much simpler C API in future releases of Gmsh. For more info see http://gitlab.onelab.info/gmsh/gmsh/issues/188 > > 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 > > > > <attachment1.jpg><test.msh>_______________________________________________ > gmsh mailing list > gmsh@onelab.info > http://onelab.info/mailman/listinfo/gmsh -- Prof. Christophe Geuzaine University of Liege, Electrical Engineering and Computer Science http://www.montefiore.ulg.ac.be/~geuzaine Free software: http://gmsh.info | http://getdp.info | http://onelab.info _______________________________________________ gmsh mailing list gmsh@onelab.info http://onelab.info/mailman/listinfo/gmsh