def MixedToMixedFunctionCopyComponentToSameLocation(V): u = Function(V) assign(u.sub(0), project(Constant(1.), V.sub(0).collapse())) assign(u.sub(1), project(Constant(2.), V.sub(1).collapse())) return u
def MixedToMixedFunctionCopySubComponentToDifferentLocation(V): u = Function(V) assign(u.sub(0), project(Constant((1., 2.)), V.sub(0).collapse())) assign(u.sub(1), project(Constant((3., 4.)), V.sub(1).collapse())) return u
def MixedFunctionRestrictionToSubElementSolveAmbiguityWithComponents(V): up = Function(V) assign(up.sub(0).sub(0), project(Constant(1.), V.sub(0).sub(0).collapse())) assign(up.sub(0).sub(1), project(Constant(3.), V.sub(0).sub(1).collapse())) assign(up.sub(1), project(Constant(2.), V.sub(1).collapse())) return up
def VectorFunction(V): u = Function(V) u.vector()[:] = 1. return u
def MixedFunctionExtensionFromSubElementSolveAmbiguityWithComponents(V): s = Function(V) s.vector()[:] = 1. return s
def MixedFunctionRestrictionAmbiguous(V): up = Function(V) assign(up.sub(0), project(Constant((1., 1.)), V.sub(0).collapse())) assign(up.sub(1), project(Constant(2.), V.sub(1).collapse())) return up
def ScalarFunction(V): u = Function(V) u.vector()[:] = 1. return u
def MixedFunctionExtensionFromSubElementAmbiguous(V): s = Function(V) s.vector()[:] = 1. return s
def MixedFunctionExtensionNonAmbiguousVectorElement(V): s = Function(V) s.vector()[:] = 1. return s
def MixedFunctionExtensionAmbiguous(V): s = Function(V) s.vector()[:] = 1. return s
def MixedFunctionExtensionAutomatic(V): s = Function(V) s.vector()[:] = 1. return s