← Back to team overview

ffc team mailing list archive

dofmap() bug for discontinuous Lagrange

 

Hi!

There seems to be a bug in the dofmap generation for discontinuous
Lagrange elements. What happens is that dofmap() seems to think there
are more dofs than there really are. Consider this form:

# Test form for updated elasticity

name = "ElasticityUpdatedSigma0"
element1 = FiniteElement("Vector Lagrange", "tetrahedron", 1)
element2 = FiniteElement("Discontinuous vector Lagrange", "tetrahedron", 0)

c1 = Constant() # Lame coefficient
c2 = Constant() # Lame coefficient

q = BasisFunction(element2)
v = Function(element1)

L = ((2 * c1 * v[i].dx(i) * q[0]) +
        (c2 * (v[i].dx(0) + v[0].dx(i))) * q[i]) * dx

The generated code looks like this:

...

    inline unsigned int spacedim() const
    {
      return 3;
    }

...

    void dofmap(int dofs[], const Cell& cell, const Mesh& mesh) const
    {
      dofs[0] = 3*cell.id() + 0;
      dofs[1] = 3*cell.id() + 1;
      dofs[2] = 3*cell.id() + 2;
      int offset = 3*mesh.noCells();
      dofs[3] = offset + 3*cell.id() + 0;
      dofs[4] = offset + 3*cell.id() + 1;
      dofs[5] = offset + 3*cell.id() + 2;
      offset = offset + 3*mesh.noCells();
      dofs[6] = offset + 3*cell.id() + 0;
      dofs[7] = offset + 3*cell.id() + 1;
      dofs[8] = offset + 3*cell.id() + 2;
    }

...

For some reason dofmap() seems to think there are 9 dofs on the
element. If I just remove the extra lines, then it works ok.

  Johan



Follow ups