diff --git a/Geo/GModelIO_Mesh.cpp b/Geo/GModelIO_Mesh.cpp index 04480a73410a128e625836ea25104622a2a81654..efaf35b09fd012256c31db579de299b7337d983a 100644 --- a/Geo/GModelIO_Mesh.cpp +++ b/Geo/GModelIO_Mesh.cpp @@ -2201,7 +2201,7 @@ int GModel::writeDIFF(const std::string &name, bool binary, bool saveAll, fprintf(fp, " Only one subdomain el : dpFALSE\n"); fprintf(fp, " Lattice data ? 0\n\n\n\n"); int nbi = getNumFaces(); - fprintf(fp, " %d Boundary indicators: ", getNumFaces()); + fprintf(fp, " %d Boundary indicators: ", nbi); for(fiter it = firstFace(); it != lastFace(); ++it){ if(saveAll || (*it)->physicals.size()){ fprintf(fp, " %d", (*it)->tag()); @@ -2221,18 +2221,15 @@ 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++){ entities[i]->mesh_vertices[j]->writeDIFF(fp, binary, scalingFactor); - for(unsigned int k = 0; k < entities[i]->physicals.size(); k++){ - fprintf(fp," %d %d\n", entities[i]->tag(), entities[i]->physicals[k]); - } - } - /* - for(viter it = firstVertex(); it != lastVertex(); ++it){ - for(unsigned int j = 0; j < (*it)->mesh_vertices.size(); j++) { - (*it)->mesh_vertices[j]->writeDIFF(fp, binary, scalingFactor); - fprintf(fp," %d\n",(*it)->physicals.size()); + fprintf(fp," [%d] ",entities[i]->faces().size()); + std::list<GFace*> lf = entities[i]->faces(); + std::list<GFace*>::iterator it = lf.begin(); + for(unsigned int k = 0; k < lf.size(); k++){ + fprintf(fp," %d ",(*it)->tag()); + it++; + } + fprintf(fp,"\n"); } - } - */ fprintf(fp, "\n"); fprintf(fp, "\n"); @@ -2252,8 +2249,7 @@ int GModel::writeDIFF(const std::string &name, bool binary, bool saveAll, int type = entities[i]->getMeshElement(j)->getTypeForDIFF(); if(type){ element_number++; - int physical_property = 1; - entities[i]->getMeshElement(j)->writeDIFF(fp, binary, physical_property); + entities[i]->getMeshElement(j)->writeDIFF(fp, binary, entities[i]->tag()); } } } diff --git a/Geo/GModelIO_OCC.cpp b/Geo/GModelIO_OCC.cpp index b2afd05c63c5dc619cee6144b8a82595bb96dbfa..67ee1c20f0baeb308c28ab3b87862d80b6fbedc5 100644 --- a/Geo/GModelIO_OCC.cpp +++ b/Geo/GModelIO_OCC.cpp @@ -15,6 +15,7 @@ #if defined(HAVE_OCC_MESH_CONSTRAINTS) #include "MeshGmsh_Constrain.hxx" +#include "MeshGmsh_VertexConstrain.hxx" #include "MeshGmsh_EdgeConstrain.hxx" #endif @@ -573,7 +574,21 @@ static void applyOCCMeshConstraints(GModel *m, const void *constraints) #if defined(HAVE_OCC_MESH_CONSTRAINTS) MeshGmsh_Constrain *meshConstraints = (MeshGmsh_Constrain*)constraints; - // treat mesh constraints (if any) on model edges + // apply mesh constraints on model vertices + MeshGmsh_DataMapOfShapeOfVertexConstrain vertexConstraints; + meshConstraints->GetVertexConstrain(vertexConstraints); + for(GModel::viter it = m->firstVertex(); it != m->lastVertex(); ++it){ + GVertex *gv = *it; + TopoDS_Shape *shape = (TopoDS_Shape*)gv->getNativePtr(); + if(vertexConstraints.IsBound(*shape)) { + Msg::Debug("Applying mesh contraints on vertex %d", gv->tag()); + const MeshGmsh_VertexConstrain &c(vertexConstraints.Find(*shape)); + gv->setPrescribedMeshSizeAtVertex(c.GetSize()); + // TODO embed this vertex in a surface + } + } + + // apply mesh constraints on model edges MeshGmsh_DataMapOfShapeOfEdgeConstrain edgeConstraints; meshConstraints->GetEdgeConstrain(edgeConstraints); for(GModel::eiter it = m->firstEdge(); it != m->lastEdge(); ++it){ @@ -629,7 +644,6 @@ static void applyOCCMeshConstraints(GModel *m, const void *constraints) } } #endif - } int GModel::importOCCShape(const void *shape, const void *meshConstraints) diff --git a/Geo/MVertex.cpp b/Geo/MVertex.cpp index 2aaaa0fac7d4cae32a0322b915e95984b86fc413..1214f57969d031c6722cee47886fda5bbeb31e85 100644 --- a/Geo/MVertex.cpp +++ b/Geo/MVertex.cpp @@ -145,7 +145,7 @@ void MVertex::writeDIFF(FILE *fp, bool binary, double scalingFactor) { if(_index < 0) return; // negative index vertices are never saved - fprintf(fp, " %d ( %25.16E , %25.16E , %25.16E )\n", + fprintf(fp, " %d ( %25.16E , %25.16E , %25.16E )", getIndex(), x() * scalingFactor, y() * scalingFactor, z() * scalingFactor); }