On 02/19/2013 09:46 PM, Simon Funke wrote:
> Public bug reported:
>
> It seems like there the children/parent information is not always correctly set when the adapt() function is called on FunctionSpaces or Functions.
> The following code demontrates the problem:
>
> -----------------------------------------------------------------------------------------------------------------
> from dolfin import *
>
> m0 = UnitIntervalMesh(2)
> adapt(adapt(m0))
> m1 = m0.child()
> m2 = m1.child()
>
> V = FunctionSpace(m0, "CG", 1)
> f = Function(V)
>
> adapt(adapt(f, m1), m2)
>
> assert(f.depth() == 3) # Passes
>
> assert(f.child().has_child() == True) # Fails
> assert(f.child().depth() == 3) # Fails, gives depth == 1
> f.child().child() # TypeError: expected a FunctionSpace or a Function as argument 1
> -----------------------------------------------------------------------------------------------------------------
>
> The same problem occurs if one adapts a FunctionSpace twice and tries to call .child().child() on it.
> Similarly the parent information seems to he faulty, as .parent().parent() on the leaf node also produces this error.
>
> ** Affects: dolfin
> Importance: Undecided
> Status: New
>
The Python wrapped versions of child/parent/aso returns a shallow copy
of the original Function. In this copy the Hierarchical information is lost.
Try the following patch. (My dolfin is again broken with new PASTIX
requirements...)
Johan
=== modified file 'dolfin/ common/ Hierarchical. h' common/ Hierarchical. h 2012-12-04 20:34:24 +0000 common/ Hierarchical. h 2013-02-20 10:46:11 +0000 www.gnu. org/licenses/>.
--- dolfin/
+++ dolfin/
@@ -16,7 +16,7 @@
// along with DOLFIN. If not, see <http://
//
// First added: 2011-01-30
-// Last changed: 2012-11-29
+// Last changed: 2013-02-20
#ifndef __HIERARCHICAL_H
#define __HIERARCHICAL_H
@@ -44,7 +44,8 @@
public:
/// Constructor _to_no_ delete_ pointer( self)) {} _to_no_ delete_ pointer( self)), self._parent) , _child(self._child) {}
- Hierarchical(T& self) : _self(reference
+ Hierarchical(T& self) : _self(reference
+ _parent(
/// Destructor cal() {}
~Hierarchi
On 02/19/2013 09:46 PM, Simon Funke wrote: ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- - f.child( ).has_child( ) == True) # Fails f.child( ).depth( ) == 3) # Fails, gives depth == 1 ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- -
> Public bug reported:
>
> It seems like there the children/parent information is not always correctly set when the adapt() function is called on FunctionSpaces or Functions.
> The following code demontrates the problem:
>
> -------
> from dolfin import *
>
> m0 = UnitIntervalMesh(2)
> adapt(adapt(m0))
> m1 = m0.child()
> m2 = m1.child()
>
> V = FunctionSpace(m0, "CG", 1)
> f = Function(V)
>
> adapt(adapt(f, m1), m2)
>
> assert(f.depth() == 3) # Passes
>
> assert(
> assert(
> f.child().child() # TypeError: expected a FunctionSpace or a Function as argument 1
> -------
>
> The same problem occurs if one adapts a FunctionSpace twice and tries to call .child().child() on it.
> Similarly the parent information seems to he faulty, as .parent().parent() on the leaf node also produces this error.
>
> ** Affects: dolfin
> Importance: Undecided
> Status: New
>