diff --git a/Graphics/drawMesh.cpp b/Graphics/drawMesh.cpp index ea278a65e9f470f5950ae2ff9b039d5ef28a589b..ca45b85e73e695697538d0cfcf69d3e24cf0e644 100644 --- a/Graphics/drawMesh.cpp +++ b/Graphics/drawMesh.cpp @@ -119,11 +119,16 @@ static void drawVertexLabel(drawContext *ctx, GEntity *e, MVertex *v, else sprintf(str, "%d", v->getNum()); - if(v->getPolynomialOrder() > 1) - glColor4ubv((GLubyte *) & CTX::instance()->color.mesh.vertexSup); - else - glColor4ubv((GLubyte *) & CTX::instance()->color.mesh.vertex); - + if(CTX::instance()->mesh.colorCarousel == 0){ // by element type + if(v->getPolynomialOrder() > 1) + glColor4ubv((GLubyte *) & CTX::instance()->color.mesh.vertexSup); + else + glColor4ubv((GLubyte *) & CTX::instance()->color.mesh.vertex); + } + else{ + unsigned int col = getColorByEntity(e); + glColor4ubv((GLubyte *) & col); + } double offset = (0.5 * CTX::instance()->mesh.pointSize + 0.1 * CTX::instance()->glFontSize) * ctx->pixel_equiv_x; glRasterPos3d(v->x() + offset / ctx->s[0], @@ -139,10 +144,16 @@ static void drawVerticesPerEntity(drawContext *ctx, GEntity *e) for(unsigned int i = 0; i < e->mesh_vertices.size(); i++){ MVertex *v = e->mesh_vertices[i]; if(!v->getVisibility()) continue; - if(v->getPolynomialOrder() > 1) - glColor4ubv((GLubyte *) & CTX::instance()->color.mesh.vertexSup); - else - glColor4ubv((GLubyte *) & CTX::instance()->color.mesh.vertex); + if(CTX::instance()->mesh.colorCarousel == 0){ // by element type + if(v->getPolynomialOrder() > 1) + glColor4ubv((GLubyte *) & CTX::instance()->color.mesh.vertexSup); + else + glColor4ubv((GLubyte *) & CTX::instance()->color.mesh.vertex); + } + else{ + unsigned int col = getColorByEntity(e); + glColor4ubv((GLubyte *) & col); + } ctx->drawSphere(CTX::instance()->mesh.pointSize, v->x(), v->y(), v->z(), CTX::instance()->mesh.light); } @@ -152,10 +163,16 @@ static void drawVerticesPerEntity(drawContext *ctx, GEntity *e) for(unsigned int i = 0; i < e->mesh_vertices.size(); i++){ MVertex *v = e->mesh_vertices[i]; if(!v->getVisibility()) continue; - if(v->getPolynomialOrder() > 1) - glColor4ubv((GLubyte *) & CTX::instance()->color.mesh.vertexSup); - else - glColor4ubv((GLubyte *) & CTX::instance()->color.mesh.vertex); + if(CTX::instance()->mesh.colorCarousel == 0){ // by element type + if(v->getPolynomialOrder() > 1) + glColor4ubv((GLubyte *) & CTX::instance()->color.mesh.vertexSup); + else + glColor4ubv((GLubyte *) & CTX::instance()->color.mesh.vertex); + } + else{ + unsigned int col = getColorByEntity(e); + glColor4ubv((GLubyte *) & col); + } glVertex3d(v->x(), v->y(), v->z()); } glEnd(); @@ -181,10 +198,16 @@ static void drawVerticesPerElement(drawContext *ctx, GEntity *e, // vertex array for drawing vertices... if(isElementVisible(ele) && v->getVisibility()){ if(CTX::instance()->mesh.points) { - if(v->getPolynomialOrder() > 1) - glColor4ubv((GLubyte *) & CTX::instance()->color.mesh.vertexSup); - else - glColor4ubv((GLubyte *) & CTX::instance()->color.mesh.vertex); + if(CTX::instance()->mesh.colorCarousel == 0){ // by element type + if(v->getPolynomialOrder() > 1) + glColor4ubv((GLubyte *) & CTX::instance()->color.mesh.vertexSup); + else + glColor4ubv((GLubyte *) & CTX::instance()->color.mesh.vertex); + } + else{ + unsigned int col = getColorByEntity(e); + glColor4ubv((GLubyte *) & col); + } if(CTX::instance()->mesh.pointType) ctx->drawSphere(CTX::instance()->mesh.pointSize, v->x(), v->y(), v->z(), CTX::instance()->mesh.light); @@ -575,7 +598,6 @@ class drawMeshGRegion { static void beginFakeTransparency() { return; - CTX::instance()->color.mesh.triangle = CTX::instance()->packColor(255, 0, 0, 128); // simple additive blending "a la xpost": glBlendFunc(GL_SRC_ALPHA, GL_ONE); // glBlendEquation(GL_FUNC_ADD); // maximum intensity projection "a la volsuite": diff --git a/Mesh/meshGFaceDelaunayInsertion.cpp b/Mesh/meshGFaceDelaunayInsertion.cpp index 85b2f1b6fba7963950541cef620842d749194974..368fef636203c56387c778971e475d311ae167da 100644 --- a/Mesh/meshGFaceDelaunayInsertion.cpp +++ b/Mesh/meshGFaceDelaunayInsertion.cpp @@ -1237,3 +1237,106 @@ void bowyerWatsonFrontalQuad(GFace *gf) backgroundMesh::unset(); } + +// give it a try : add one quad layer on the + /* +void addOneLayerOnContour(GFace *gf, GVertex *gv){ +, int nbLayers, double hplus, double factor){ + // for each vertex + std::map<MVertex*,std::vector<MVertex*> >layers; + std::vector<MQuadrangle*> newQuads; + std::vector<MTriangle*> newTris; + + std::list<GEdgeLoop>::iterator it = gf->edgeLoops.begin(); + for (; it != gf->edgeLoops.end(); ++it){ + bool found = false; + std::list<GEdge*> ed; + for (GEdgeLoop::iter it2 = it->begin(); it2 != it->end(); ++it2){ + if (it2->ge->getBeginVertex() == gv || it2->ge->getEndVertex() == gv) { + found = true; + } + ed.push_back(it2->ge); + } + // we found an edge loop with the GVertex that was specified + if (found){ + // compute model vertices that will produce fans + for (GEdgeLoop::iter it2 = it->begin(); it2 != it->end(); ++it2){ + GEdgeLoop::iter it3 = it2; ++it3; + GVertex *gv = it2->getEndVertex(); + GEdgeSigned *before,*after = *it2; + if (it3 == it->end()){ + before = *(it->begin()); + } + else{ + before = *it2; + } + } + + for (std::list<GEdge*>::iterator it = ed.begin(); it != ed.end(); ++it){ + GEdge *ge = *it; + for (int i=0;i<ge->lines.size();i++){ + SPoint2 p[2]; + reparamMeshEdgeOnFace ( ge->lines[i]->getVertex(0), ge->lines[i]->getVertex(1),gf,p[0],p[1]); + MVertex *vd[2]; + for (int j=0;j<2;j++){ + MVertex *v = ge->lines[i]->getVertex(j); + std::map<MVertex*,MVertex*>::iterator itv = duplicates.find(v); + if (itv == duplicates.end()){ + vd[j] = new MFaceVertex(v->x(),v->y(),v->z(),gf,p[j].x(),p[j].y()); + duplicates[v] = vd[j]; + gf->mesh_vertices.push_back(vd[j]); + } + else + vd[j] = itv->second; + } + newQuads.push_back(new MQuadrangle(ge->lines[i]->getVertex(0), ge->lines[i]->getVertex(1),vd[1],vd[0])); + } + } + for (int i=0;i<gf->quadrangles.size();i++){ + MQuadrangle *q = gf->quadrangles[i]; + MVertex *vs[4]; + for (int j=0;j<4;j++){ + MVertex *v = q->getVertex(j); + std::map<MVertex*,MVertex*>::iterator itv = duplicates.find(v); + if (itv == duplicates.end()){ + vs[j] = v; + } + else{ + vs[j] = itv->second; + } + } + newQuads.push_back(new MQuadrangle(vs[0],vs[1],vs[2],vs[3])); + delete q; + } + for (int i=0;i<gf->triangles.size();i++){ + MTriangle *t = gf->triangles[i]; + MVertex *vs[3]; + for (int j=0;j<3;j++){ + MVertex *v = t->getVertex(j); + std::map<MVertex*,MVertex*>::iterator itv = duplicates.find(v); + if (itv == duplicates.end()){ + vs[j] = v; + } + else{ + vs[j] = itv->second; + } + } + newTris.push_back(new MTriangle(vs[0],vs[1],vs[2])); + delete t; + } + + gf->triangles = newTris; + gf->quadrangles = newQuads; + } + } +} +*/ + +void addBoundaryLayers(GFace *gf) +{ + if (backgroundMesh::current()){ + } + // first compute the cross field if it is not computed yet + // start from a selection of edges and create points in the boundary layer + // connect everybody with delaunay +}