← Back to team overview

ffc team mailing list archive

Re: [Branch ~ffc-core/ffc/main] Rev 1369: Fixed Garth's optimised quadrature problem.

 



On 1 February 2010 22:32, Marie Rognes <meg@xxxxxxxxx> wrote:
Kristian Oelgaard wrote:


On 1 February 2010 22:02, Marie Rognes <meg@xxxxxxxxx> wrote:

Kristian Oelgaard wrote:


On 1 February 2010 21:37, Anders Logg <logg@xxxxxxxxx> wrote:

Impressive! :-)

It sure is, many things could be handled in a much simpler way if it
wasn't for memory and runtime considerations of the optimisations. If I
get
around to implementing the other optimisation strategy, we could make
life
simpler in these classes and only let the symbolics stuff work on
moderately
complex forms.


Sorry if I messed something up. I just thought it was better to have
something working (but suboptimal) than something broken (and optimal ;)
)

Agree, the code looks OK.

Is it release time or are we waiting for Kristian to do some magic
with evaluate_derivatives for Hdiv/curl?

Actually, I'm waiting for Marie to fix this one too :)

I'm taking a look, but it is not likely to happen within the next couple
of
hours.

I'm lost in the vectors: What is 'derivatives' and 'values' supposed to
be
holding? (Math, please ;)

'values' is the argument to evaluate_basis_derivatives that will hold the
return values (derivatives on the physical cell) from the function. It is
the users responsibility to make sure it has the correct size.
'derivatives' is the derivatives on the reference element, which is
computed like it is done inside FIAT (multiplication of coefficients, dmats
and basis values of the expansion).


Ok. And the values are ordered so that first all derivatives for value
dimension 0, then all derivatives for value dimension 1, etc.?

Yes. There is a comment at the top of evaluatebasisderivatives.py, but it might be a good idea to put in the generated code too?

Currently only the first two (out of four?) 'derivatives' are mapped for BDM
_1on triangle?

      derivatives[0] = (1.0/detJ)*((J_00*tmp_ref0 + J_01*tmp_ref1));
      derivatives[1] = (1.0/detJ)*((J_10*tmp_ref0 + J_11*tmp_ref1));

I pushed a fix for this a while back, I was hoping that was the error, but I still get wrong results.
It should be like below of course.

Kristian

but you use higher indices later:

      values[row] += transform[row][col]*derivatives[col];
      values[num_derivatives + row] +=
transform[row][col]*(derivatives[num_derivatives + col]);

Is this intentional?

--
Marie

Kristian

--
Marie


I'm having problems with the transformation back to the physical
element,
at least that's where I think the problem is. On the other hand, when
I'm
computing values on the reference element (for the tests) should it
really
matter for these elements? I don't see any transformation in FIAT for
Hdiv/curl elements.

Kristian

--
Anders


On Mon, Feb 01, 2010 at 08:30:28PM -0000, noreply@xxxxxxxxxxxxx wrote:

------------------------------------------------------------
revno: 1369
committer: Marie E. Rognes <meg@xxxxxxxxx>
branch nick: ffc
timestamp: Mon 2010-02-01 21:27:04 +0100
message:
 Fixed Garth's optimised quadrature problem.
modified:
 ffc/quadrature/fraction.py



=== modified file 'ffc/quadrature/fraction.py'
--- ffc/quadrature/fraction.py        2010-01-30 19:50:03 +0000
+++ ffc/quadrature/fraction.py        2010-02-01 20:27:04 +0000
@@ -5,7 +5,7 @@
 __copyright__ = "Copyright (C) 2009-2010 Kristian B. Oelgaard"
 __license__  = "GNU GPL version 3 or any later version"

-# Last changed: 2010-01-21
+# Last changed: 2010-02-01

 # FFC modules.
 from ffc.log import error
@@ -241,9 +241,14 @@
       self = found*remain."""

       # Reduce the numerator by the var type.
-        # Handle case where numerator is a sum.
       if self.num._prec == 3:
-            num_found, num_remain =
self.num.reduce_vartype(var_type)[0]
+            foo = self.num.reduce_vartype(var_type)
+            if len(foo) == 1:
+                num_found, num_remain =
self.num.reduce_vartype(var_type)[0]
+            else:
+                # meg: I have only a marginal idea of what I'm doing
here!
+                return
create_sum([create_fraction(create_product([num_found, num_remain]),
self.denom)
+                                   for (num_found, num_remain) in
foo]).expand().reduce_vartype(var_type)
       else:
           num_found, num_remain = self.num.reduce_vartype(var_type)

@@ -259,7 +264,7 @@
           denom_found, denom_remain =
self.denom.reduce_vartype(var_type)

       # If we have a Sum in the denominator, all terms must be
reduced
by
-        # the same terms to make sense.
+        # the same terms to make sense
       else:
           remain = []
           for m in self.denom.vrs:
@@ -294,6 +299,7 @@
       # TODO: Add more checks to avoid expansion.
       found = None
       # There is always a remainder.
+
       remain = create_fraction(num_remain, denom_remain).expand()

       if num_found:
@@ -306,6 +312,7 @@
               found = create_fraction(create_float(1), denom_found)
           else:
               found = ()
+
       return (found, remain)

 # FFC quadrature modules.



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAktnO54ACgkQTuwUCDsYZdEMIgCfQj7hbvwXKDVzP72ykidr29E9
3s8An1xmHf6nfXJUbnwkwCeZ7dDq5cO0
=9wkW
-----END PGP SIGNATURE-----

_______________________________________________
Mailing list: https://launchpad.net/~ffc
Post to     : ffc@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~ffc
More help   : https://help.launchpad.net/ListHelp



------------------------------------------------------------------------

_______________________________________________
Mailing list: https://launchpad.net/~ffc
Post to     : ffc@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~ffc
More help   : https://help.launchpad.net/ListHelp
 






Attachment: signature.asc
Description: OpenPGP digital signature


Follow ups

References