Anders Logg wrote: > On Wed, Sep 30, 2009 at 06:27:32PM +0100, Garth N. Wells wrote: >> >> Anders Logg wrote: >>> On Wed, Sep 30, 2009 at 05:25:01PM +0100, Garth N. Wells wrote: >>>> DOLFIN wrote: >>>>> One or more new changesets pushed to the primary dolfin repository. >>>>> A short summary of the last three changesets is included below. >>>>> >>>>> changeset: 7190:f53c5b481d28 >>>>> tag: tip >>>>> user: "Garth N. Wells <gn...@cam.ac.uk>" >>>>> date: Wed Sep 30 17:07:18 2009 +0100 >>>>> files: dolfin/fem/Form.cpp dolfin/fem/Form.h dolfin/fem/UFC.cpp >>>>> dolfin/function/SpecialFunctions.cpp dolfin/function/SpecialFunctions.h >>>>> description: >>>>> Prepare for probable removal of Function::Functon(). >>>>> >>>>> Make appropriate class in SpecialFunctions subclasses of Expression. >>>>> >>>> DOLFIN can be compiled now without the constructor Function::Function(), >>>> but the demos can't. Need to think about how functions can be best >>>> initialised in the generated code. >>> Either we specify it at the time of construction: >>> >>> Function u(V); >>> problem.solve(u); >>> >> I've already done something along these lines VariationalProblem. > > You mean this? > > // Set function space if missing > if (!u.has_function_space()) > { > assert(a._function_spaces.size() == 2); > u._function_space = a._function_spaces[1]; > } >
Something along this lines. It's nice to able to do: Function u0; MyForm::BilinearForm a(V, V0); a.u0 = u0; but I appreciate that his makes things complicated. Garth > I think we should avoid stuff like this. It would be very nice if we > new that a Function always has a FunctionSpace and a always has a > Vector. > >>> or we let problem hold the function and return it by reference: >>> >>> Function&u = problem.solve(); >>> >>> I'll start with the first option since it's less magic. >>> >> The issue is with functions that we attach to forms - I guess we just >> need to define them all with a function space (can be tedious when there >> are a lot). > > We could build something like this into the CoefficientSet class and > let that class handle the initialization of the Functions with the > correct spaces if we want. > > -- > Anders > > >> Garth >> >>>> Garth >>>> >>>>> changeset: 7189:3782f3222642 >>>>> user: "Garth N. Wells <gn...@cam.ac.uk>" >>>>> date: Wed Sep 30 16:52:58 2009 +0100 >>>>> files: demo/pde/poisson/cpp/main.cpp dolfin/fem/Assembler.cpp >>>>> dolfin/fem/Form.cpp dolfin/fem/Form.h dolfin/fem/SystemAssembler.cpp >>>>> dolfin/fem/VariationalProblem.cpp dolfin/function/SpecialFunctions.h >>>>> description: >>>>> Return shared_ptr to FunctionSpaces from Form rather than references. >>>>> >>>>> This makes it possible to initialise Functions without fear that the >>>>> function space will go out of scope. See VariationalProblem. >>>>> >>>>> >>>>> changeset: 7188:437ee8b12a41 >>>>> user: "Garth N. Wells <gn...@cam.ac.uk>" >>>>> date: Wed Sep 30 16:04:46 2009 +0100 >>>>> files: demo/pde/poisson/cpp/main.cpp dolfin/function/Function.cpp >>>>> dolfin/function/Function.h >>>>> description: >>>>> Remove some code. >>>>> >>>>> ---------------------------------------------------------------------- >>>>> For more details, visit http://www.fenics.org/hg/dolfin >>>>> _______________________________________________ >>>>> DOLFIN-dev mailing list >>>>> DOLFIN-dev@fenics.org >>>>> http://www.fenics.org/mailman/listinfo/dolfin-dev >>>> _______________________________________________ >>>> DOLFIN-dev mailing list >>>> DOLFIN-dev@fenics.org >>>> http://www.fenics.org/mailman/listinfo/dolfin-dev >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> _______________________________________________ >>>> DOLFIN-dev mailing list >>>> DOLFIN-dev@fenics.org >>>> http://www.fenics.org/mailman/listinfo/dolfin-dev >> _______________________________________________ >> DOLFIN-dev mailing list >> DOLFIN-dev@fenics.org >> http://www.fenics.org/mailman/listinfo/dolfin-dev >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> DOLFIN-dev mailing list >> DOLFIN-dev@fenics.org >> http://www.fenics.org/mailman/listinfo/dolfin-dev _______________________________________________ DOLFIN-dev mailing list DOLFIN-dev@fenics.org http://www.fenics.org/mailman/listinfo/dolfin-dev