DOLFIN's NonlinearProblem
interface passes around vectors instead of functions, so to fill these vectors with meaningful values, one might have to convert them to functions first. No problem:
def F(self, b, x):
xfun = Function(self.W)
xfun.vector()[:] = x
# do something with xfun, get bfun
b = bfun.vector()
(Are there ways to do this without copying?)
I'm dealing with a block problem now, and it goes like
def F(self, b, x):
xfun = Function(self.WP)
xfun.vector()[:] = x
x0, x1 = xfun.split()
# do something with x0, x1, get b0, b1
How to appropriately assign b0.vector()
, b1.vector()
to b
?