← Back to team overview

ffc team mailing list archive

Re: [Branch ~ffc-core/ffc/main] Rev 1371: Fix bug in unit tests for evaluate_basis_derivatives.

 


Evaluate_basis_derivatives now returns values which are in agreement with FIAT at least on the reference element for all supported elements of orders up to 3 and derivatives of the same order. I think this was the last issue to be addressed before a release.

Kristian


On 1 February 2010 23:09,  <noreply@xxxxxxxxxxxxx> wrote:
------------------------------------------------------------
revno: 1371
committer: Kristian B. Ølgaard <k.b.oelgaard@xxxxxxxxx>
branch nick: ffc
timestamp: Mon 2010-02-01 23:06:13 +0100
message:
 Fix bug in unit tests for evaluate_basis_derivatives.
modified:
 test/unit/evaluate_basis/test_against_fiat.py


--
lp:ffc
https://code.launchpad.net/~ffc-core/ffc/main

Your team FFC Core Team is subscribed to branch lp:ffc.
To unsubscribe from this branch go to https://code.launchpad.net/~ffc-core/ffc/main/+edit-subscription.

=== modified file 'test/unit/evaluate_basis/test_against_fiat.py'
--- test/unit/evaluate_basis/test_against_fiat.py       2010-02-01 18:15:34 +0000
+++ test/unit/evaluate_basis/test_against_fiat.py       2010-02-01 22:06:13 +0000
@@ -9,7 +9,7 @@
 from ufl import FiniteElement, MixedElement
 from ffc.fiatinterface import create_element, reference_cell
 from ffc.mixedelement import MixedElement as FFCMixedElement
-from ffc.log import info
+from ffc.log import info, error
 import numpy
 import sys, os, commands, numpy, shutil
 from test_common import xcomb, compile_element, print_results, compile_gcc_code,\
@@ -159,6 +159,7 @@
    element, points, geo_dim, ref_coords, deriv_order = get_data(ufl_element)
    values = element.tabulate(deriv_order, points)
    return_values = {}
+    value_shape = element.value_shape()

    # Rearrange values to match what we get from evaluate_basis*()
    for n in range(deriv_order + 1):
@@ -175,19 +176,18 @@
            if n != 0:
                p += element.space_dimension()
            row = [[] for i in range(element.space_dimension())]
-            for deriv in combinations:
-                deriv_vals = values[deriv]
-                shape = numpy.shape(deriv_vals)
-                if len(shape) == 2:
-                    for i in range(shape[0]):
+            for i in range(element.space_dimension()):
+                if value_shape == ():
+                    for deriv in combinations:
+                        deriv_vals = values[deriv]
                        row[i].append(deriv_vals[i][p])
-                elif len(shape) == 3:
-#                    deriv_vals = numpy.transpose(deriv_vals, (1,0,2))
-                    for c in range(shape[1]):
-                        for i in range(shape[0]):
+                elif len(value_shape) == 1:
+                    for c in range(element.value_shape()[0]):
+                        for deriv in combinations:
+                            deriv_vals = values[deriv]
                            row[i].append(deriv_vals[i][c][p])
                else:
-                    print deriv_vals
+                    print values
                    error("Did not expect tensor elements")
            new_row = []
            for r in row:




Attachment: signature.asc
Description: OpenPGP digital signature