← 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 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.

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 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



Attachment: signature.asc
Description: OpenPGP digital signature


Follow ups

References