GEdge::GEdge(GModel *model, int tag, GVertex *_v0, GVertex *_v1) : GEntity(model, tag), _tooSmall(false), v0(_v0), v1(_v1), compound(0) { if(v0) v0->addEdge(this); if(v1 && v1 != v0) v1->addEdge(this); meshStatistics.status = GEdge::PENDING; resetMeshAttributes(); }
gmshRegion::gmshRegion(GModel *m, ::Volume *volume) : GRegion(m, volume->Num), v(volume) { for(int i = 0; i < List_Nbr(v->Surfaces); i++){ Surface *s; List_Read(v->Surfaces, i, &s); int ori; List_Read(v->SurfacesOrientations, i, &ori); GFace *f = m->getFaceByTag(abs(s->Num)); if(f){ l_faces.push_back(f); l_dirs.push_back(ori); f->addRegion(this); } else Msg::Error("Unknown surface %d", s->Num); } for(int i = 0; i < List_Nbr(v->SurfacesByTag); i++){ int is; List_Read(v->SurfacesByTag, i, &is); GFace *f = m->getFaceByTag(abs(is)); if(f){ l_faces.push_back(f); l_dirs.push_back(sign(is)); f->addRegion(this); } else Msg::Error("Unknown surface %d", is); } if(v->EmbeddedSurfaces){ for(int i = 0; i < List_Nbr(v->EmbeddedSurfaces); i++){ Surface *s; List_Read(v->EmbeddedSurfaces, i, &s); GFace *gf = m->getFaceByTag(abs(s->Num)); if(gf) addEmbeddedFace(gf); else Msg::Error("Unknown surface %d", s->Num); } } resetMeshAttributes(); }
GRegion::GRegion(GModel *model, int tag) : GEntity (model, tag) { resetMeshAttributes(); }
gmshEdge::gmshEdge(GModel *m, Curve *edge, GVertex *v1, GVertex *v2) : GEdge(m, edge->Num, v1, v2), c(edge) { resetMeshAttributes(); }
gmshVertex::gmshVertex(GModel *m, Vertex *_v) : GVertex(m, _v->Num, _v->lc), v(_v) { resetMeshAttributes(); }
gmshFace::gmshFace(GModel *m, Surface *face) : GFace(m, face->Num), s(face), isSphere(false), radius(0.) { resetMeshAttributes(); // edgeCounterparts = s->edgeCounterparts; // affineTransform = s->affineTransform; std::vector<GEdge*> eds; std::vector<int> nums; for(int i = 0; i < List_Nbr(s->Generatrices); i++){ Curve *c; List_Read(s->Generatrices, i, &c); GEdge *e = m->getEdgeByTag(abs(c->Num)); if(e){ eds.push_back(e); nums.push_back(c->Num); } else Msg::Error("Unknown curve %d", c->Num); } for(int i = 0; i < List_Nbr(s->GeneratricesByTag); i++){ int j; List_Read(s->GeneratricesByTag, i, &j); GEdge *e = m->getEdgeByTag(abs(j)); if(e){ eds.push_back(e); nums.push_back(j); } else Msg::Error("Unknown curve %d", j); } std::list<GEdge*> l_wire; GVertex *first = 0; for(unsigned int i = 0; i < eds.size(); i++){ GEdge *e = eds[i]; int num = nums[i]; GVertex *start = (num > 0) ? e->getBeginVertex() : e->getEndVertex(); GVertex *next = (num > 0) ? e->getEndVertex() : e->getBeginVertex(); if (!first) first = start; l_wire.push_back(e); if (next == first){ edgeLoops.push_back(GEdgeLoop(l_wire)); l_wire.clear(); first = 0; } l_edges.push_back(e); e->addFace(this); l_dirs.push_back((num > 0) ? 1 : -1); if (List_Nbr(s->Generatrices) == 2){ e->meshAttributes.minimumMeshSegments = std::max(e->meshAttributes.minimumMeshSegments, 2); } } // always compute and store the mean plane for plane surfaces (using // the bounding vertices) if(s->Typ == MSH_SURF_PLAN) computeMeanPlane(); if(s->EmbeddedCurves){ for(int i = 0; i < List_Nbr(s->EmbeddedCurves); i++){ Curve *c; List_Read(s->EmbeddedCurves, i, &c); GEdge *e = m->getEdgeByTag(abs(c->Num)); if(e) addEmbeddedEdge(e); else Msg::Error("Unknown curve %d", c->Num); } } if(s->EmbeddedPoints){ for(int i = 0; i < List_Nbr(s->EmbeddedPoints); i++){ Vertex *v; List_Read(s->EmbeddedPoints, i, &v); GVertex *gv = m->getVertexByTag(v->Num); if(gv) embedded_vertices.push_back(gv); else Msg::Error("Unknown point %d", v->Num); } } isSphere = iSRuledSurfaceASphere(s, center, radius); }