I came across a problem in GmshIO::read. The issue is that in some cases
a gmsh mesh contains lower dimensional elements which are just used for
specifying boundary info so they aren't added to the libMesh mesh during
mesh.read() and therefore
assert( ... || e->id() == _elements.size());
in SerialMesh::add_elem fails when we try to add the first actual
element to the mesh.
To get around this I put in another counter in GmshIO::read_mesh, as in
the attached patch.
- Dave
Index: gmsh_io.C
===================================================================
--- gmsh_io.C (revision 2623)
+++ gmsh_io.C (working copy)
@@ -407,6 +407,7 @@
mesh.reserve_elem (numElem);
// read the elements
+ unsigned int elem_id_counter = 0;
for (unsigned int iel=0; iel<numElem; ++iel)
{
unsigned int id, type, physical, elementary,
@@ -445,9 +446,12 @@
{
// add the elements to the mesh
Elem* elem = Elem::build(eletype.type).release();
- elem->set_id(iel);
+ elem->set_id(elem_id_counter);
mesh.add_elem(elem);
+ // different to iel, lower dimensional elems aren't added
+ elem_id_counter++;
+
// check number of nodes. We cannot do that for version 2.0
if (version <= 1.0)
{
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Libmesh-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-devel