Anders Logg wrote: > I've thought some more on the problem of mesh refinement and updating > of Functions. > > The main problem seems to be the following: > > mesh.refine() > > If we want to allow this, then we need to provide some kind of > automated updating of functions and function spaces to the new mesh, > since this call will otherwise destroy all function spaces and > functions that refer to that mesh: > > V = FunctionSpace(mesh, "CG", 1) > v = Function(V) > mesh.refine() # V and v no longer make any sense > > This gives us two options. Either we disallow refinement of a mesh > without making a copy. Or we provide automated updating. I think we > should do the latter. > >
I think that I would appreciate both: (a) Automated updating if mesh.refine() and (b) Functionality provided for updating functions to a new mesh if mesh = refine(mesh) > What is needed compared to what we have now is to let a call to > Mesh::refine trigger a call to FunctionSpace::update for all function > spaces defined on the mesh, which in turn will trigger calls to > Function::update for all functions defined on the function spaces. > > We can make the update functions private. > > Comments or objections? I think I can make this work. > > I can imagine that one would like to keep a copy of a function on the old mesh if one compares solutions from different meshes. Then automated updating could be somewhat suboptimal. -- Marie > -- > Anders > > ------------------------------------------------------------------------ > > _______________________________________________ > 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