diff --git a/Geo/GModelIO_Mesh.cpp b/Geo/GModelIO_Mesh.cpp index 812275c1074e69bb4e1993c80596598f8e3a74db..be4d7bf54ee4b6c7eb7f7da435cae75d050c383d 100644 --- a/Geo/GModelIO_Mesh.cpp +++ b/Geo/GModelIO_Mesh.cpp @@ -2188,8 +2188,11 @@ int GModel::writeDIFF(const std::string &name, bool binary, bool saveAll, boundaryIndicators.push_back(gf->tag()); for(unsigned int i = 0; i < gf->getNumMeshElements(); i++){ MElement *e = gf->getMeshElement(i); - for(unsigned int j = 0; j < e->getNumVertices(); j++) - vertexTags[e->getVertex(j)->getIndex() - 1].push_back(gf->tag()); + for(unsigned int j = 0; j < e->getNumVertices(); j++){ + MVertex *v = e->getVertex(j); + if(v->getIndex() > 0) + vertexTags[v->getIndex() - 1].push_back(gf->tag()); + } } } } @@ -2210,7 +2213,7 @@ int GModel::writeDIFF(const std::string &name, bool binary, bool saveAll, if(entities[i]->physicals.size() || saveAll){ for(unsigned int j = 0; j < entities[i]->getNumMeshElements(); j++){ MElement *e = entities[i]->getMeshElement(j); - if(e->getTypeForDIFF()){ + if(e->getStringForDIFF()){ numElements++; maxNumNodesPerElement = std::max(maxNumNodesPerElement, e->getNumVertices()); } @@ -2245,12 +2248,14 @@ int GModel::writeDIFF(const std::string &name, bool binary, bool saveAll, for(unsigned int i = 0; i < entities.size(); i++){ for(unsigned int j = 0; j < entities[i]->mesh_vertices.size(); j++){ MVertex *v = entities[i]->mesh_vertices[j]; - v->writeDIFF(fp, binary, scalingFactor); - fprintf(fp, " [%d] ", vertexTags[v->getIndex() - 1].size()); - for(std::list<int>::iterator it = vertexTags[v->getIndex() - 1].begin(); - it != vertexTags[v->getIndex() - 1].end(); it++) - fprintf(fp," %d ", *it); - fprintf(fp,"\n"); + if(v->getIndex() > 0){ + v->writeDIFF(fp, binary, scalingFactor); + fprintf(fp, " [%d] ", vertexTags[v->getIndex() - 1].size()); + for(std::list<int>::iterator it = vertexTags[v->getIndex() - 1].begin(); + it != vertexTags[v->getIndex() - 1].end(); it++) + fprintf(fp," %d ", *it); + fprintf(fp,"\n"); + } } } @@ -2270,7 +2275,7 @@ int GModel::writeDIFF(const std::string &name, bool binary, bool saveAll, if(entities[i]->physicals.size() || saveAll){ for(unsigned int j = 0; j < entities[i]->getNumMeshElements(); j++){ MElement *e = entities[i]->getMeshElement(j); - if(e->getTypeForDIFF()) + if(e->getStringForDIFF()) e->writeDIFF(fp, ++num, binary, entities[i]->tag()); } } diff --git a/Geo/MElement.cpp b/Geo/MElement.cpp index d05d169733377c86288270170bcd1d338012d1b6..00f94cd86f845c91b013e79e8b05ff6cc74ae17d 100644 --- a/Geo/MElement.cpp +++ b/Geo/MElement.cpp @@ -619,26 +619,19 @@ void MElement::writeBDF(FILE *fp, int format, int elementary) void MElement::writeDIFF(FILE *fp, int num, bool binary, int physical_property) { - int type = getTypeForDIFF(); - if(!type) return; + const char *str = getStringForDIFF(); + if(!str) return; setVolumePositive(); + int n = getNumVertices(); if(binary){ - int verts[60]; - verts[0] = n; - for(int i = 0; i < n; i++) - verts[i + 1] = getVertexVTK(i)->getIndex(); - fwrite(verts, sizeof(int), n + 1, fp); + // TODO } else{ - if(type == MSH_TET_10) - fprintf(fp, "%d %s", num, "ElmT10n3D "); - else - fprintf(fp, "%d %s", num, "ElmT4n3D "); - fprintf(fp, " %d ", physical_property); + fprintf(fp, "%d %s %d ", num, str, physical_property); for(int i = 0; i < n; i++) - fprintf(fp, " %d", getVertexVTK(i)->getIndex()); + fprintf(fp, " %d", getVertexDIFF(i)->getIndex()); fprintf(fp, "\n"); } } diff --git a/Geo/MElement.h b/Geo/MElement.h index fe3c89df408e774fb62bbfdbdd9732a932533b16..51098ec8c22036c38be0336202407420c01ee946 100644 --- a/Geo/MElement.h +++ b/Geo/MElement.h @@ -92,6 +92,10 @@ class MElement // get the vertex using MED ordering virtual MVertex *getVertexMED(int num){ return getVertex(num); } + // get the vertex using DIFF ordering (at least for tetrahedra it's + // the same as in the MED format) + virtual MVertex *getVertexDIFF(int num){ return getVertexMED(num); } + // get the number of vertices associated with edges, faces and // volumes (nonzero only for higher order elements) virtual int getNumEdgeVertices() const { return 0; } @@ -230,9 +234,9 @@ class MElement virtual int getTypeForMSH() const { return 0; } virtual int getTypeForUNV() const { return 0; } virtual int getTypeForVTK() const { return 0; } - virtual int getTypeForDIFF() const { return 0; } virtual const char *getStringForPOS() const { return 0; } virtual const char *getStringForBDF() const { return 0; } + virtual const char *getStringForDIFF() const { return 0; } // return the number of vertices, as well as the element name if // 'name' != 0 @@ -1133,7 +1137,7 @@ class MTetrahedron : public MElement { virtual MVertex *getVertexMED(int num) { static const int map[4] = {0, 2, 1, 3}; - return getVertex(map[num]); + return getVertex(map[num]); } virtual int getNumEdges(){ return 6; } virtual MEdge getEdge(int num) @@ -1173,9 +1177,9 @@ class MTetrahedron : public MElement { virtual int getTypeForMSH() const { return MSH_TET_4; } virtual int getTypeForUNV() const { return 111; } // solid linear tetrahedron virtual int getTypeForVTK() const { return 10; } - virtual int getTypeForDIFF() const { return MSH_TET_4; } virtual const char *getStringForPOS() const { return "SS"; } virtual const char *getStringForBDF() const { return "CTETRA"; } + virtual const char *getStringForDIFF() const { return "ElmT4n3D"; } virtual void revert() { MVertex *tmp = _v[0]; _v[0] = _v[1]; _v[1] = tmp; @@ -1336,9 +1340,9 @@ class MTetrahedron10 : public MTetrahedron { virtual int getTypeForMSH() const { return MSH_TET_10; } virtual int getTypeForUNV() const { return 118; } // solid parabolic tetrahedron //virtual int getTypeForVTK() const { return 24; } - virtual int getTypeForDIFF() const { return MSH_TET_10; } virtual const char *getStringForPOS() const { return "SS2"; } virtual const char *getStringForBDF() const { return "CTETRA"; } + virtual const char *getStringForDIFF() const { return "ElmT10n3D"; } virtual void revert() { MVertex *tmp; diff --git a/Mesh/meshGFaceTransfinite.cpp b/Mesh/meshGFaceTransfinite.cpp index b1fcc3b93482ed0a9a0c4d33dac29b707f69ef1b..08aa4fa2c1ce5b9f3ffa137c59ac1e740b1c6ab5 100644 --- a/Mesh/meshGFaceTransfinite.cpp +++ b/Mesh/meshGFaceTransfinite.cpp @@ -296,7 +296,7 @@ int MeshTransfiniteSurface(GFace *gf) } } - // should we smooth the meshing using an elliptic smoother? + // should we apply the elliptic smoother? int numSmooth = 0; if(gf->meshAttributes.transfiniteSmoothing < 0 && CTX.mesh.nb_smoothing > 1) numSmooth = CTX.mesh.nb_smoothing; diff --git a/doc/VERSIONS.txt b/doc/VERSIONS.txt index 06f8f35e971418d85eb5d00e8be55b1bb4d87971..6b20f26cbde917dabbe6cf83d953745e149c8c1f 100644 --- a/doc/VERSIONS.txt +++ b/doc/VERSIONS.txt @@ -1,4 +1,7 @@ -$Id: VERSIONS.txt,v 1.12 2008-10-25 13:17:32 geuzaine Exp $ +$Id: VERSIONS.txt,v 1.13 2008-11-08 09:45:47 geuzaine Exp $ + +2.2.6 (?): better transfinite smoothing and automatic corner +selection; 2.2.5 (Oct 25, 2008): Gmsh now requires FLTK 1.1.7 or above; various small improvements (STL and VTK mesh IO, Netgen upgrade, Visual C++