On Thu, Oct 09, 2008 at 12:08:28PM +0100, Nuno David Lopes wrote: > Hi again: > I'm trying to update my codes to the new GenericVector/Function interface. > So what is the simplest way to relate Vector and GenericVector? > (Probably just my ignorance relating with pointers and C++ coding) > In the old days one could do things like: > ----------------------------------------------- > MyBilinearForm a; > MyLilinearForm L; > Matrix A; > assemble(A,a,mesh); > Vector x,b; > assemble(b,L,mesh); > Function u(mesh,x,a); > solver.solve(A,x,b); > b=x; > ---------------------------------------------- > > Now one should have > ----------------------------------------------- > MyBilinearForm a; > MyLilinearForm L; > Matrix A; > assemble(A,a,mesh); > Vector b; > assemble(b,L,mesh); > Function u(mesh,a); > GenericVector& x=u.vector(); > solver.solve(A,x,b);
Yes, or just solver.solve(A, u.vector(), b); > b=x; //does it work??????? > ---------------------------------------------- It should work if b and x are of the same type (using the same backend). > does the last line work? > What is the simplest way to assign the values of a funtion/genericvector to a > vector? > Is this part of the ongoing function interface redesign? Things will get better when the new Function and FunctionSpace classes are finished, but assignment of vectors is independent and should work already. -- Anders
signature.asc
Description: Digital signature
_______________________________________________ DOLFIN-dev mailing list [email protected] http://www.fenics.org/mailman/listinfo/dolfin-dev
