ffc team mailing list archive
-
ffc team
-
Mailing list archive
-
Message #03656
[Fwd: [Branch ~ffc-core/ffc/main] Rev 1369: Fixed Garth's optimised quadrature problem.]
There is still a problem. Now I get an DOLFIN error when I try to
assemble my system. I will look at it some more later today.
Garth
-------- Original Message --------
Subject: [Branch ~ffc-core/ffc/main] Rev 1369: Fixed Garth's optimised
quadrature problem.
Date: Mon, 01 Feb 2010 20:30:28 -0000
From: noreply@xxxxxxxxxxxxx
Reply-To: noreply@xxxxxxxxxxxxx
To: Garth Wells <gnw20@xxxxxxxxx>
------------------------------------------------------------
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
--
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 '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.