← Back to team overview

dolfin team mailing list archive

Re: Bus Error

 

On Wednesday 20 May 2009 23:51:32 Anders Logg wrote:
> On Wed, May 20, 2009 at 11:30:43PM +0200, Johan Hake wrote:
> > On Wednesday 20 May 2009 22:56:39 Anders Logg wrote:
> > > The problem is that the edges in the mesh don't exist until they are
> > > created (or you use a mesh iterator in which case they will be created
> > > automatically).
> > >
> > > Just add the line
> > >
> > >   mesh.init(1)
> > >
> > > (before accessing the facets/edges) and then it should work.
> > >
> > > There should be a sensible error message instead of a bus error.
> >
> > This has to be implemented in the c++ library as the calling graph for
> > that command was quite extensive.
> >
> > Should there be an error message or should there somewhere in the calling
> > sequence be a call to mesh.init(dim). Is this not done due to some
> > performance issues? Couldn't we just add an mesh.init call in the
> > MeshEntity.num_entities, and MeshEntity.entities functions?
> >
> > Johan
>
> I'm not sure. It was a design decision not to do any automatic
> initialization when accessing the data structures directly as is done
> with num_entities() and entities() for performance. As it is now,
> those two functions are inlined all the way down to the underlying
> arrays storing the mesh topology. 

Nice! I didn't know this.

> Initialization is done automatically 
> for the higher level mesh iterator interface.

Ok.

> I think it should be enough to add the test to constructor of
> MeshEntity. I'll try that shortly.

Ok.

Johan


References