diff --git a/Common/gmsh.cpp b/Common/gmsh.cpp index 2b751cddce6c98d9b668a771d7cf38d27746b4b3..1e514b84c88e75fb6bed44cfc61623037131b0a8 100644 --- a/Common/gmsh.cpp +++ b/Common/gmsh.cpp @@ -482,7 +482,6 @@ GMSH_API int gmsh::model::addDiscreteEntity(const int dim, const int tag, case 0: { GVertex *gv = new discreteVertex(GModel::current(), outTag); GModel::current()->add(gv); - e = gv; break; } case 1: { diff --git a/Geo/GModelIO_MSH4.cpp b/Geo/GModelIO_MSH4.cpp index 94720ee0f830f6f693b21da80addf0937bb383e4..bb85d8d078523f315b03d342569e608cf2796065 100644 --- a/Geo/GModelIO_MSH4.cpp +++ b/Geo/GModelIO_MSH4.cpp @@ -579,9 +579,36 @@ readMSH4Nodes(GModel *const model, FILE *fp, bool binary, bool &dense, GEntity *entity = model->getEntityByTag(entityDim, entityTag); if(!entity) { - Msg::Error("Unknown entity %d of dimension %d", entityTag, entityDim); - delete [] vertexCache; - return 0; + switch(entityDim) { + case 0: { + Msg::Info("Creating discrete point %d", entityTag); + GVertex *gv = new discreteVertex(model, entityTag); + GModel::current()->add(gv); + entity = gv; + break; + } + case 1: { + Msg::Info("Creating discrete curve %d", entityTag); + GEdge *ge = new discreteEdge(model, entityTag, 0, 0); + GModel::current()->add(ge); + entity = ge; + break; + } + case 2: { + Msg::Info("Creating discrete surface %d", entityTag); + GFace *gf = new discreteFace(model, entityTag); + GModel::current()->add(gf); + entity = gf; + break; + } + case 3: { + Msg::Info("Creating discrete volume %d", entityTag); + GRegion *gr = new discreteRegion(model, entityTag); + GModel::current()->add(gr); + entity = gr; + break; + } + } } for(std::size_t j = 0; j < numNodes; j++) { diff --git a/doc/texinfo/gmsh.texi b/doc/texinfo/gmsh.texi index 8168800ecdc151f8818f4806527b38c91e6a111e..3075932fed2fba2a8d3d8439a139bba56077e1ff 100644 --- a/doc/texinfo/gmsh.texi +++ b/doc/texinfo/gmsh.texi @@ -3606,7 +3606,7 @@ The MSH file format 4 (at its current revision, version 4.1) contains one mandatory section giving information about the file (@code{$MeshFormat}), followed by several sections defining the physical group names (@code{$PhysicalName}, optional), the entities -(@code{$Entities}), the partitioned entities +(@code{$Entities}, optional), the partitioned entities (@code{$PartitionedEntities}, optional), nodes (@code{$Nodes}), elements (@code{$Elements}), periodicity relations (@code{$Periodic}, optional), ghost elements (@code{$GhostElements}, optional) and post-processing @@ -3644,6 +3644,8 @@ the entries designating counts which were previsouly encoded as @code{int} are also changed to @code{size_t}. (This only impacts binary files.) @item +The @code{$Entities} section is now optional. +@item The bounding box for point entities is simply replaced by the 3 coordinates of the point (instead of the six bounding box values). @item @@ -3674,7 +3676,7 @@ $EndMeshFormat ... <$EndPhysicalNames> -$Entities +<$Entities> numPoints(size_t) numCurves(size_t) numSurfaces(size_t) numVolumes(size_t) pointTag(int) X(double) Y(double) Z(double) @@ -3695,7 +3697,7 @@ $Entities numPhysicals(size_t) physicalTag(int) ... numBoundngSurfaces(size_t) surfaceTag(int) ... ... -$EndEntities +<$EndEntities> <$PartitionedEntities> numPartitions(size_t)