mshr import order causes topology error

Issue #78 new
Nathan Sime created an issue

Compiled dolfin with -DCMAKE_BUILD_TYPE=Debug I notice the following in the Python interface:

import mshr
from dolfin import *

mesh = UnitCubeMesh(1, 1, 1)
V = FunctionSpace(mesh, "CG", 1)
u, v = TrialFunction(V), TestFunction(V)
a = inner(grad(u), grad(v))*dx
assemble(a)

Yields the error:

*** Error:   Unable to complete call to function size().
*** Reason:  Assertion dim < num_entities.size() failed.
*** Where:   This error was encountered inside /home/njcs4/Development/fenics/dolfin/dolfin/mesh/MeshTopology.cpp (line 80).
*** Process: 0
*** 
*** DOLFIN version: 2017.2.0.dev0
*** Git changeset:  943c4fa06962d08fdd773088acc6a8aa52fb7e18

which corresponds to:

std::size_t MeshTopology::size(std::size_t dim) const
{
  if (num_entities.size() == 0)
    return 0;

  dolfin_assert(dim < num_entities.size());
  return num_entities[dim];
}

Printing dim and num_entities.size() I see before the crash:

num_entities.size(): 4
dim: 7

No idea why dim=7 here. If one swaps the import order

from dolfin import *
import mshr

everything runs as expected.

Comments (0)

  1. Log in to comment