leaf_node() method of a Function object not acting correctly

Bug #1079772 reported by mwelland
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
DOLFIN
Fix Released
High
Johan Hake

Bug Description

I'm encountering an error when trying to adapt the highest node of a hierarchical function object. I can adapt the function space and the mesh (and also the problem object which is not demonstrated below) using the .leaf_node() method but the function object is giving me problems. If I use u.child() instead of u.leaf_node() then it works, but then it has to be updated after the third adaptation.

Thanks
Mike

Demo code:
~~~~~~~~~~~
from dolfin import *

mesh = UnitSquare(2,2)

V = FunctionSpace(mesh, "Lagrange", 1) # Order 1 function space
u = Function(V)

print mesh.depth(), V.depth(), u.depth()

print mesh == mesh.leaf_node()
print mesh.leaf_node(), V.leaf_node(), u.leaf_node()
adapt(mesh) # Adapt mesh, new mesh assigned to bottom
adapt(V, mesh.leaf_node()) #Adapt V based on refined mesh
adapt(u,mesh.leaf_node()) #Adapt u based on refined mesh
print mesh.depth(), V.depth(), u.depth()

adapt(mesh.leaf_node()) #Adapt refined mesh, new mesh added to bottom
adapt(V.leaf_node(),mesh.leaf_node()) #Adapt V's leaf node based on newly refined mesh
adapt(u.leaf_node(),mesh.leaf_node()) #Adapt u's leaf node based on newly refined mesh ***FAIL***
#adapt(u.child(),mesh.leaf_node()) #Adapt u's first child, coincident with supposed leaf node **Works**

print mesh.depth(), V.depth(), u.depth()
~~~~~~~

Revision history for this message
Marie Rognes (meg-simula) wrote :

The corresponding C++ version (attached) runs as expected/correctly, indicating that this might be a Python wrapper issue...

Changed in fenics:
status: New → Confirmed
Changed in fenics:
importance: Undecided → High
Johannes Ring (johannr)
affects: fenics → dolfin
Revision history for this message
Johan Hake (johan-hake) wrote :

This not exactly a duplication of bug:1130354 but it is most probably caused by the same issue. Hierarchical information is not propagated to Python wrapped entities returned by member functions of Hierarchical<Foo>.

Hierarchical<Foo> being a base class of Foo makes thing more difficult. It might look nice in C++ implementation but adding Python specializations makes it a pain to work with. Even if the bug resides in the Python wrapper I will not spend more time at it unless we have a general discussion of how to fix generation of Python specializations of C++ objects returned from

  Foo Hierarchical<Foo>::bar();

methods, where Hierarchical<Foo> information is also propagated to the returned object.

Johan Hake (johan-hake)
Changed in dolfin:
assignee: nobody → Johan Hake (johan-hake)
status: Confirmed → Fix Committed
milestone: none → 1.2.0
Johannes Ring (johannr)
Changed in dolfin:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.