Skip to content

Commit 52745d4

Browse files
committed
Don't check for ghosting with a non-VECMPI Vec
PETSc doesn't even want to let us call these functions on e.g. a Kokkos vector without throwing an error, so we'll hardcode for now that other vectors just can't be ghosted.
1 parent c9892ac commit 52745d4

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

include/numerics/petsc_vector.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -665,11 +665,17 @@ PetscVector<T>::PetscVector (Vec v,
665665
if (!is_serial)
666666
#endif
667667
{
668-
ISLocalToGlobalMapping mapping;
669-
LibmeshPetscCall(VecGetLocalToGlobalMapping(_vec, &mapping));
668+
ISLocalToGlobalMapping mapping = nullptr;
669+
Vec localrep = nullptr;
670+
671+
// Non-VECMPI types won't even let us call VecGetLocalToGlobalMapping;
672+
// we'll just assume for now that no such type is ghosted
673+
if (std::strcmp(ptype, VECMPI) == 0)
674+
{
675+
LibmeshPetscCall(VecGetLocalToGlobalMapping(_vec, &mapping));
676+
LibmeshPetscCall(VecGhostGetLocalForm(_vec,&localrep));
677+
}
670678

671-
Vec localrep;
672-
LibmeshPetscCall(VecGhostGetLocalForm(_vec,&localrep));
673679
// If is a sparsely stored vector, set up our new mapping
674680
// Only checking mapping is not enough to determine if a vec is ghosted
675681
// We need to check if vec has a local representation

0 commit comments

Comments
 (0)