[Gmsh] Creating invalid 3d-mesh

Geordie McBain gdmcbain at freeshell.org
Thu Dec 2 01:29:44 CET 2010

2010/11/24 Alexis Blasselle <alexis.blasselle at gmail.com>:
> Hi everybody,
> here is my problem: with the attached geometry, I create a 3d-mesh, with the
> last version of Gmsh, running on my Mac 10.6.4.
> I save it as a .mesh (Medit Inria Mesh), and when I simply open it with
> FreeFem++ (Free Finite Element Software), with the command
> mesh3 Th3 = readmesh3("maillage.mesh");
> I have the following error message: Assertion fail : (kerr==0)
>     line :712, in file ../femlib/GenericMesh.hpp
> which means that one or several points of the mesh do(es) not belong to any
> triangle.
> What is more strange is that this error message does not appear on older
> version of Mac Os X (with the exact same mesh).
> Do you know why this mesh is not valid, and how could I correct it ?

Hello.  I ran your alexx_rvs.geo through Gmsh (compiled from svn
sources on 64-bit Linux Mint 9) and the resulting alexx_rvs.mesh file
looked O.K.

First I put it through FreeFem++ (v. 3.100000, compiled from
freefem++-3.10 source release) with

mesh3 Th3 = readmesh3 ("alexx_rvs.mesh");
cout << "volume = " << int3d (Th3) (1.0) << endl;
cout << "surface area = " << int2d (Th3) (1.0) << endl;

and it computed

volume = 0.125
surface area = 0.945426

which I confess I didn't check at all but seem reasonable and anyway
FreeFem++ was happy.

Then to look further into your suspicion that some points mightn't
belong to any elements, I read the .mesh file (actually just the block
of 18320 lines between "Tetrahedra" and "End") into Python/NumPy:

import numpy as np
nodes = np.unique (np.loadtxt ('tet.txt', dtype = 'int32') [:,:4])
print nodes, len (nodes)

and it said

[   1    2    3 ..., 3431 3432 3433] 3433

which I think means that in fact all vertices do belong to at least
one tetrahedron.  So I think your .geo is actually O.K. and the
problem must lie elsewhere?