Function.sub(0, deepcopy=True) loses constrained_domain information

Issue #405 new
Matthias Liertzer created an issue

When extracting a function from a mixed function which lives on a function space with a constrained_domain, the information of the constrained_domain is lost. See the following example:

#!/usr/bin/env python

from dolfin import *


class PeriodicBoundary(SubDomain):
    "Subdomain for periodic boundary condition"

    def inside(self, x, on_boundary):
        return bool(near(x[0], 0))

    def map(self, x, y):
        y[0] = x[0] - 1.0

mesh = IntervalMesh(20, 0.0, 1.0)
V = FunctionSpace(mesh, "CG", 1, constrained_domain=PeriodicBoundary())
W = V * V

w = Function(W)
v = w.sub(0, deepcopy=True)

print(V.dim())
print(v.function_space().dim())

Comments (9)

  1. Matthias Liertzer reporter

    For those affected: Note, that this regression from 1.4 can be worked around with:

    v = Function(V)
    assign(v, w.sub(0))
    
  2. Log in to comment