← Back to team overview

dolfin team mailing list archive

[Question #149415]: Conversion between Swig Object and dolfin.cpp.PETScVector

 

New question #149415 on DOLFIN:
https://answers.launchpad.net/dolfin/+question/149415

Hello,

I'm trying to define a Function in "mult" inside a class.
However, the solver calling this mult handles the argument args[0] which I'd like to use for defining my Function:

Function(self.V, args[0])
*** TypeError: in method 'new_Function', argument 1 of type 'dolfin::Function const &'

When defining a PETScVector first it works:

testPETSc = PETScVector(self.V.dim())
<dolfin.cpp.PETScVector; proxy of <Swig Object of type 'boost::shared_ptr< dolfin::PETScVector > *' at 0x3937300> >
Function(self.V, testPETSc)
Coefficient(FiniteElement('Discontinuous Lagrange', Cell('triangle', 1, Space(2)), 0), 13)

The type of args[0] is:

self = <PETScKrylovMatrix of size 8608 x 8608>
args = (<Swig Object of type 'dolfin::PETScVector *' at 0x3909f30>, <Swig Object of type 'dolfin::PETScVector *' at 0x39371e0>)

So, I'd like to convert the args[0] to a PETScVector and then create the Function. Is this possible?

Thanks,
Patricia

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.