Anders Logg wrote: > On Sun, Nov 02, 2008 at 05:52:21PM +0000, Garth N. Wells wrote: >> Do we want to insist that Dirichlet bc functions that do not appear >> inside a form are constructed with a FunctionSpace? DirichletBC is >> supplied with a FunctionSpace, so if the bc Function does not have a >> FunctionSpace, we could attach one automatically. >> >> Garth >> _______________________________________________ >> DOLFIN-dev mailing list >> [email protected] >> http://www.fenics.org/mailman/listinfo/dolfin-dev > > I think this is already handled. Look in the Poisson demo. It uses a > Constant to set the BC and it does not have a FunctionSpace attached > to it. The DirichletBC class now uses its own FunctionSpace rather > than the one that the Function has (if any). There is a check (in > DirichletBC::check()) that checks that the FunctionSpace for the > Function is the same as the one in the DirichletBC. >
It works for Constant, but not for Functions. I was getting an error when Function::interpolate is called. Function::interpolate leads to eval being called, in which case there is a test for the FunctionSpace which fails. Constant provides its own eval and therefore doesn't have a problem. For now, I've added a test in DirichletBC for the FunctionSpace. What we can add is an attach function if there is no FunctionSpace associated. Garth > Note that Function::in(V) returns true if the Function does not have a > FunctionSpace (which allows Functions with no specified space to be > used for setting DirichletBC). > > -- > Anders > > > ------------------------------------------------------------------------ > > _______________________________________________ > DOLFIN-dev mailing list > [email protected] > http://www.fenics.org/mailman/listinfo/dolfin-dev _______________________________________________ DOLFIN-dev mailing list [email protected] http://www.fenics.org/mailman/listinfo/dolfin-dev
