evaluatebasisderivatives giving corrupt result due to wrong size of derivatives_p

Issue #148 resolved
Chris Richardson created an issue

Line 578 of evaluatebasisderivatives.py seems to be wrong.

Comments (9)

  1. Chris Richardson reporter

    In the generated code, derivatives_p[] is declared with the wrong size, and overwrites the transform matrix. @blechta, @martinal - can you check? What is correct expression for size of derivatives_p ....?

  2. Martin Sandve Alnæs

    This line?

    https://bitbucket.org/fenics-project/ffc/src/502d0b3384fe3e3c149d7b971b5a211cded92b9d/ffc/evaluatebasisderivatives.py?at=master&fileviewer=file-view-default#evaluatebasisderivatives.py-578
    
  3. Chris Richardson reporter

    It seems to me that there is a simple fix: getting the correct size of derivatives_p. From the look of things, Line 578: nds = tdim**max_degree * gdim should be nds = gdim**max_degree * num_components. But I may be wrong?

  4. Chris Richardson reporter

    OK, maybe I am wrong there. It seems that the 'covariant piola' and 'contravariant piola' should copy into an array of size gdim*num_derivatives, whereas the 'double contra/co variant piola' copy into an array of size num_components*num_derivatives. Is that correct? It looks like the line 571 if "piola" in mapping: is incorrectly setting the wrong size for the 'double piola' transformations...

  5. Chris Richardson reporter

    Yes, clearly it would be good to reuse your new code where possible, and there is a lot of refactoring still to do. I just wanted to get the reference version correct using the old code first, if possible.

  6. Log in to comment