[petsc-users] passing an object to function
Jed Brown
jedbrown at mcs.anl.gov
Fri Oct 7 07:17:50 CDT 2011
On Fri, Oct 7, 2011 at 04:45, Dominik Szczerba <dominik at itis.ethz.ch> wrote:
> I need to do something with - say - a Vec in a function but obviously
> do not want to copy by value. Should the signature be foo(Vec) or
> foo(Vec&)?
>
PETSc does not use C++ internally.
> I see Vec is a pointer in itself, so Vec should suffice,
> but in many Petsc functions I see Vec& signatures,
>
No, you see some Vec* signatures, not Vec&. Vec* is used when a new Vec is
created, if the function needs to modify the pointer, or if the argument is
an array of Vecs.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111007/1d7658f7/attachment-0001.htm>
More information about the petsc-users
mailing list