← Back to team overview

dolfin team mailing list archive

Re: Vector type casting

 

mpic++ -o dolfin/mesh/MeshOrdering.os -c -Wall -pipe -ansi -DDEBUG -g -Werror -DNDEBUG -O2 -DHAS_MPI=1 -DMPICH_IGNORE_CXX_SEEK -DPACKAGE_VERSION=\"0.7.2\" -DHAS_PETSC=1 -DHAS_SLEPC=1 -DHAS_SCOTCH=1 -DHAS_UMFPACK=1 -DHAS_GTS=1 -fPIC -I. -I/usr/include/libxml2 -I/usr/lib/petsc/bmake/linux-gnu-c-opt -I/usr/lib/petsc/include -I/usr/lib/openmpi/include -I/usr/lib/openmpi/lib -Idolfin -I/usr/local -I/usr/local/include -I/usr/lib/petsc/bmake/linux-gnu-c-opt -I/usr/lib/petsc/include -I/usr/lib/openmpi/include -I/usr/lib/openmpi/lib -Idolfin -I/usr/include/suitesparse -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include dolfin/mesh/MeshOrdering.cpp dolfin/la/PETScVector.cpp: In member function ‘virtual const dolfin::PETScVector& dolfin::PETScVector::operator=(const dolfin::GenericVector&)’: dolfin/la/PETScVector.cpp:238: error: invalid initialization of reference of type ‘const dolfin::GenericVector&’ from expression of type ‘_p_Vec*’ dolfin/la/PETScVector.h:201: error: in passing argument 1 of ‘const dolfin::PETScVector& dolfin::as_const_PETScVector(const dolfin::GenericVector&)’ dolfin/la/PETScVector.cpp: In member function ‘virtual dolfin::real dolfin::PETScVector::inner(const dolfin::GenericVector&) const’: dolfin/la/PETScVector.cpp:313: error: invalid initialization of reference of type ‘dolfin::GenericVector&’ from expression of type ‘const dolfin::GenericVector’ dolfin/la/PETScVector.h:198: error: in passing argument 1 of ‘dolfin::PETScVector& dolfin::as_PETScVector(dolfin::GenericVector&)’ dolfin/la/PETScVector.cpp: In member function ‘virtual void dolfin::PETScVector::axpy(dolfin::real, const dolfin::GenericVector&)’: dolfin/la/PETScVector.cpp:326: error: invalid initialization of reference of type ‘dolfin::GenericVector&’ from expression of type ‘const dolfin::GenericVector’ dolfin/la/PETScVector.h:198: error: in passing argument 1 of ‘dolfin::PETScVector& dolfin::as_PETScVector(dolfin::GenericVector&)’
scons: *** [dolfin/la/PETScVector.os] Error 1

ilmar

Martin Sandve Alnæs wrote:
I think I'm done, but I'm not able to run the tests even on an
unmodified dolfin...
There's something fishy with the system I'm on now.

If you can pull from
  hg pull ssh://yourname@xxxxxxxxxx//home/martinal/hg/dolfin
run the tests and push if it works, that would be great.

I have to run now, so I'll have to finish this later if there's anything wrong.

--
Martin


2008/4/11, Ilmar Wilbers <ilmarw@xxxxxxxxx>:
OK, let me know when you are done.

 ilmar


Edit: sending to list


 Martin Sandve Alnæs wrote:
 > Wait... I got into a merge...
 >
 > 2008/4/11, Martin Sandve Alnæs <martinal@xxxxxxxxx>:
 >
 >> Can someone with a petsc installation pull from
 >>     hg pull ssh://yourname@xxxxxxxxxx//home/martinal/hg/dolfin
 >>  and check that it compiles, that the tests run, and then push it?
 >>  I've done changes to uBlasVector and PETScVector but don't have petsc here...
 >>
 >>
 >>  I've implemented type casting with only references in the user
 >>  interface, which works like this:
 >>
 >>  void foo(GenericVector & gv)
 >>  {
 >>   uBlasVector & v = as_uBlasVector(gv);
 >>   ublas_vector & w = v.vec();
 >>
 >>   // or:
 >>
 >>   ublas_vector & u = as_ublas_vector(gv);
 >>   ...
 >>  }
 >>
 >>  The as_* functions assumes that the input is of the correct underlying
 >>  type and triggers a dolfin error on failure. There's also an is_*
 >>  function:
 >>
 >>   if(is_uBlasVector(gv))
 >>     trigger_ublas_solver_for_example(gv);
 >>
 >>  I've implemented similar functions for PETScVector, but I didn't have
 >>  petsc installed here so I haven't tried to compile them.
 >>
 >>  Selecting good names for these are tricky, since we're dealing with
 >>  names like uBlasVector, ublas_vector, PETScVector, and (PETSc) Vec,
 >>  consistency is futile... Suggestions for better names?
 >>
 >>  --
 >>
 >> Martin
 >>
 >>
 >
 >
 >

_______________________________________________
 DOLFIN-dev mailing list
 DOLFIN-dev@xxxxxxxxxx
 http://www.fenics.org/mailman/listinfo/dolfin-dev



Follow ups

References