---
 include/numerics/petsc_vector.h |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/include/numerics/petsc_vector.h b/include/numerics/petsc_vector.h
index fcce800..3d77dbb 100644
--- a/include/numerics/petsc_vector.h
+++ b/include/numerics/petsc_vector.h
@@ -675,7 +675,13 @@ PetscVector<T>::PetscVector (Vec v)
 
   if((strcmp(type,VECSHARED) == 0) || (strcmp(type,VECMPI) == 0))
   {
+#if PETSC_VERSION_RELEASE && PETSC_VERSION_LESS_THAN(3,1,1)
     ISLocalToGlobalMapping mapping = _vec->mapping;
+#else
+    ISLocalToGlobalMapping mapping;
+    ierr = VecGetLocalToGlobalMapping(_vec, &mapping);
+    CHKERRABORT(libMesh::COMM_WORLD,ierr);
+#endif
 
     // If is a sparsely stored vector, set up our new mapping
     if (mapping)
@@ -683,8 +689,15 @@ PetscVector<T>::PetscVector (Vec v)
       const unsigned int local_size = static_cast<unsigned int>(petsc_local_size);
       const unsigned int ghost_begin = static_cast<unsigned int>(petsc_local_size);
       const unsigned int ghost_end = static_cast<unsigned int>(mapping->n);
+#if PETSC_VERSION_RELEASE && PETSC_VERSION_LESS_THAN(3,1,1)
+      const int *indices = mapping->indices;
+#else
+      const int *indices = mapping->indices;
+      ierr = ISLocalToGlobalMappingGetIndices(mapping,&indices);
+      CHKERRABORT(libMesh::COMM_WORLD,ierr);
+#endif
       for(unsigned int i=ghost_begin; i<ghost_end; i++)
-        _global_to_local_map[mapping->indices[i]] = i-local_size;
+        _global_to_local_map[indices[i]] = i-local_size;
       this->_type = GHOSTED;
     }
     else
------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Libmesh-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to