Thread Previous • Date Previous • Date Next • Thread Next |
Dag Lindbo wrote:
Ola Skavhaug wrote:Dag Lindbo skrev den 09/04-2008 følgende:Hello again!Why is it not possible any longer to get the Vector associated with a Function? E.g:#include <dolfin.h> using namespace dolfin; int main() { Function u; Vector& v = u.vector(); }int main() { Function u; Vector v; v = u.vector(); return 0; } Should work. A Function returns a GenericVector reference, and the Vectorreference needs to be a Vector. Then the operator= in Vector is applied in theassignment. OlaOla,Sorry if I'm this is a stupid/incorrect observation. What you propose is a a deep copy of the vector. So something likeuBlasVector& vv = *(v.instance()); vv[0] = 1000.32;has no impact on the data owned by u. uBlas only has deep copy semantics, which are invoked in dolfin::Vector::operator= (i.e. *vector = *x; )Is this really what we want? /Dag
Seems I'm also sloppy with grammar today. My previous post may sound offensive towards Ola, but I only meant to pre-excuse _myself_ in case my understanding of C++ has deserted me this evening. /Dag
error: invalid initialization of reference of type ‘dolfin::Vector&’ from expression of type ‘dolfin::GenericVector’na55:cpp > sconsc++ -o test.o -c -Wall -pipe -ansi -g -Werror -O2 -pthread -DDEBUG -DNDEBUG -DPACKAGE_VERSION="0.7.2" -DHAS_UMFPACK=1 -DHAS_GTS=1 -I/usr/local/include -I/usr/lib/python2.5/site-packages/numpy/core/include -I/usr/include/suitesparse -I/usr/include/python2.5 -I/usr/include/libxml2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include test.cpptest.cpp: In function ‘int main()’:test.cpp:8: error: invalid initialization of reference of type ‘dolfin::Vector&’ from expression of type ‘dolfin::GenericVector’cc1plus: warnings being treated as errors test.cpp:8: warning: unused variable ‘v’ scons: *** [test.o] Error 1 I hope this functionality hasn't been removed. /Dag _______________________________________________ DOLFIN-dev mailing list DOLFIN-dev@xxxxxxxxxx http://www.fenics.org/mailman/listinfo/dolfin-dev
Thread Previous • Date Previous • Date Next • Thread Next |