Subject: [FFC-dev] - Fix bug in dofmap() for equal order mixed elements [...]

From: [email-masked]
Date: Mon, 26 Sep 2005 17:02:31 +0200

Commit from logg (2005-09-26 17:02 CEST)
----------------

 - Fix bug in dofmap() for equal order mixed elements
 - Add compiler option -d debuglevel

Garth, see if this helps.

Also, there is now a new command-line flag -d debuglevel. If > 0, more
debug info will be printed during compilation (level 1 is reasonable).
Also, ffc won't catch exceptions with this option.

  ffc  ChangeLog                            1.80
  ffc  src/bin/ffc                          1.23
  ffc  src/ffc/common/debug.py              1.4
  ffc  src/ffc/compiler/dofmap.py           1.21
  ffc  src/ffc/compiler/referencetensor.py  1.12

---

From: "Garth N. Wells" <[email-masked]>
Date: Tue, 27 Sep 2005 12:54:34 +0200

> Commit from logg (2005-09-26 17:02 CEST)

The changes in dofmap.py seem to have broken elements with polynomial order > 2. 
Things seem fine in v0.2.0. Below is the Poisson.form file and the error message.

Garth

#----------------------------------------------------
element = FiniteElement("Lagrange", "triangle", 3)

v = BasisFunction(element)
u = BasisFunction(element)
f = Function(element)

a = dot(grad(u), grad(v))*dx
L = f*v*dx
#----------------------------------------------------

Error message:

Traceback (most recent call last):
  File "/usr/bin/ffc", line 107, in ?
    main(sys.argv[1:])
  File "/usr/bin/ffc", line 73, in main
    execfile(outname, ns)
  File "Poisson.py", line 29, in ?
    element = FiniteElement("Lagrange", "triangle", 3)
  File "/usr/lib/python2.4/site-packages/ffc/compiler/finiteelement.py", line
94, in __init__
    self.dofmap = DofMap(self)
  File "/usr/lib/python2.4/site-packages/ffc/compiler/dofmap.py", line 215, in
__init__
    (declarations, data) = compute_dofmap(element, data)
  File "/usr/lib/python2.4/site-packages/ffc/compiler/dofmap.py", line 174, in
compute_dofmap
    declarations += [write_alignment(num_dims, dim, entity, data)]
  File "/usr/lib/python2.4/site-packages/ffc/compiler/dofmap.py", line 81, in
write_alignment
    data["alignment"] += 1
KeyError: 'alignment'

---

From: "Garth N. Wells" <[email-masked]>
Date: Tue, 27 Sep 2005 13:42:25 +0200

In the CVS version of dofmap.py, it looks like line 81 should be 

data["num alignment"] += 1

rather than

data["alignment"] += 1

Garth

Quoting "Garth N. Wells" <[email-masked]>:

> _______________________________________________
> FFC-dev mailing list
> [email-masked]
> http://www.fenics.org/cgi-bin/mailman/listinfo/ffc-dev
>

---

From: Anders Logg <[email-masked]>
Date: Tue, 27 Sep 2005 08:10:23 -0500

Yes, this is correct. It should be "num alignment". Does this fix the
problem?

I'm compiling a series of test forms (everything in src/demo) and
comparing against previously compiled forms (in src/reference) using
the script scripts/verify everytime I commit, but I should add some
more test cases (in particular higher order) to catch things like
this. I can bump up the order in one of the test cases or if someone
has a .form file that I can include in src/demo send it to me and I'll
make sure that form doesn't break in future versions.

/Anders

-- 
Anders Logg
Research Assistant Professor
Toyota Technological Institute at Chicago
http://www.tti-c.org/logg/

---

From: "Garth N. Wells" <[email-masked]>
Date: Tue, 27 Sep 2005 16:42:43 +0200

> Yes, this is correct. It should be "num alignment". Does this fix the

Yes.

> > > The changes in dofmap.py seem to have broken elements with polynomial
> order >
> > > 2. 
> > >   File "/usr/lib/python2.4/site-packages/ffc/compiler/dofmap.py", line
> 215,
> > > in
> > > __init__
> > >   File "/usr/lib/python2.4/site-packages/ffc/compiler/dofmap.py", line
> 174,
> > > in
> > > compute_dofmap
> > >   File "/usr/lib/python2.4/site-packages/ffc/compiler/dofmap.py", line
> 81,
> > > in
> > > write_alignment
> > >     data["alignment"] += 1
> > > KeyError: 'alignment'
> > > 
> > > 
> > > 
> > >