← Back to team overview

ffc team mailing list archive

Re: bug in MixedElement.tabulate()

 

On Tue, Jan 26, 2010 at 05:52:43PM +0100, Kristian Oelgaard wrote:
> The error was related to the following type of code:
>
> table_shape = (self.space_dimension(), self.num_components(), len(points))
> zeros = numpy.zeros(table_shape)
> for element in self._elements:
>  table = element.tabulate(order, points)
>  for dtuple in table.keys():
>      if not dtuple in mixed_table:
>          mixed_table[dtuple] = zeros
>              # Insert non-zero values
>              if (crange[1] - crange[0]) > 1:
>                  mixed_table[dtuple][irange[0]:irange[1], crange[0]:crange[1]] = table[dtuple]
>
> This would cause the zeros array to be update every time we assigned to it because the mixed_element[dtuple] holds a reference
> to zeros, not the values.
>
> Changing the line:
>          mixed_table[dtuple] = zeros
> to
>
>          mixed_table[dtuple] = numpy.zeros(table_shape)
>
> fixed the problem.

ok! Nice.

--
Anders

Attachment: signature.asc
Description: Digital signature


References