Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent definition of copy! for PETScVector ? #50

Closed
fverdugo opened this issue Nov 10, 2021 · 2 comments
Closed

Inconsistent definition of copy! for PETScVector ? #50

fverdugo opened this issue Nov 10, 2021 · 2 comments

Comments

@fverdugo
Copy link
Member

I have the feeling that the definition of these two functions:

function Base.copy!(vec::AbstractVector,petscvec::PETScVector)

function Base.copy!(petscvec::PETScVector,vec::AbstractVector)

is inconsistent with the Julia definition of copy!:

help?> copy!
search: copy! copyto! circcopy! unsafe_copyto! copy copysign deepcopy

  copy!(dst, src) -> dst

  In-place copy of src into dst, discarding any pre-existing elements in dst.
  If dst and src are of the same type, dst == src should hold after the call.
  If dst and src are multidimensional arrays, they must have equal axes. See
  also copyto!.

In particular, with the sentence "if dst and src are multidimensional arrays, they must have equal axes. " As far as I can tell this means that length(dst) == length(src) should be true. And I think that this is not true in the functions linked above. In other words, both vectors need to be understood either as global vectors, or as local ones.

@amartinhuertas Do you remember why you needed to change these functions?

@amartinhuertas
Copy link
Member

@amartinhuertas Do you remember why you needed to change these functions?

I did not change them, I added them. They are new. I added them along with their two counterparts in PartitionedArrays.jl for the PVector,PETScVector combinations, and vice-versa.

These are needed in order to copy from PETSc vectors to the vectors that were used to assemble the system, either PVector or plain Julia Vectors.

Does all this answer your question?

@amartinhuertas
Copy link
Member

Solved in PR #53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants