← Back to team overview

dolfin team mailing list archive

Re: Vector and uBlasVector

 

Create a Vector, and then you can then access the underlying uBlasVector to perform specific operations,

  Vector x;
  uBlasVector& xx = x.vec();

Garth

Alessio Quaglino wrote:
Ok I understand the second group of errors then. But the Function.h
interface is made using the Vector and not uBlasVector, so how can I use
both the constructor dolfin::Function::Function(dolfin::Mesh&,
dolfin::Vector&, const dolfin::Form&, dolfin::uint) and not lose the
functionalities of uBlas? Thanks.

Alessio


This is a result of a (small but important) interface change in the
DOLFIN linear algebra library.
Before (until 0.7.0-1) Vector was a typedef for either a PETScMatrix or
a uBlasMatrix. As a result, the things you could do with a Vector
depended on how you had configured DOLFIN.
Now, Vector is a (very lightweight) wrapper for either a PETScMatrix or
a uBlasMatrix that only supports the functionality of the GenericVector
interface. So, no matter how you configure DOLFIN (with PETSc or uBlas),
the code will always compile.
Your problem is that you have used Vector, but have used uBlas-specific
functions that are not available in the common Vector interface.
So, you need to either just use the functions in Vector or change from
Vector to uBlasVector if you need to use functionality that is
uBlas-specific.

/Anders


Alessio Quaglino wrote:
I've cloned the latest repository of dolfin. I'm compiling my code against
it but I'm not able to solve the following errors:

ElasticityUpdatedSolver.cpp:41: error: no matching function for call to
'dolfin::Function::Function(dolfin::Mesh&, dolfin::uBlasVector&,
dolfin::Form&, int)'
../../../src/kernel/function/dolfin/Function.h:63: note: candidates
are: dolfin::Function::Function(const dolfin::Function&)
../../../src/kernel/function/dolfin/Function.h:60: note:
dolfin::Function::Function(std::string)
../../../src/kernel/function/dolfin/Function.h:57: note:
dolfin::Function::Function(dolfin::SubFunction)
../../../src/kernel/function/dolfin/Function.h:54: note:
dolfin::Function::Function(dolfin::Mesh&, dolfin::Vector&, const
dolfin::Form&, dolfin::uint)
../../../src/kernel/function/dolfin/Function.h:51: note:
dolfin::Function::Function(dolfin::Mesh&, dolfin::real)
../../../src/kernel/function/dolfin/Function.h:48: note:
dolfin::Function::Function(dolfin::Mesh&)
../../../src/kernel/function/dolfin/Function.h:45: note:
dolfin::Function::Function()

ElasticityUpdatedSolver.cpp:203: error: 'class dolfin::Vector' has no
member named 'copy'
ElasticityUpdatedSolver.cpp:204: error: 'class dolfin::Vector' has no
member named 'copy'
ElasticityUpdatedSolver.cpp:207: error: 'class dolfin::Vector' has no
member named 'axpy'
It seems that dolfin sees the class Vector as incompatible with
uBlasVector. What can I do to fix this in my code? Thanks.
Regards,
Alessio Quaglino

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




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





Follow ups

References