@@ -806,6 +806,8 @@ void PetscMatrix<T>::_get_submatrix(SparseMatrix<T> & submatrix,
806806 const_cast < PetscMatrix < T > * > (this )-> close ();
807807 }
808808
809+ semiparallel_only ();
810+
809811 // Make sure the SparseMatrix passed in is really a PetscMatrix
810812 PetscMatrix < T > * petsc_submatrix = cast_ptr < PetscMatrix < T > * > (& submatrix );
811813
@@ -1217,31 +1219,23 @@ void PetscMatrix<T>::get_row (numeric_index_type i_in,
12171219template < typename T >
12181220PetscMatrix < T > & PetscMatrix < T > ::operator = (const PetscMatrix < T > & v )
12191221{
1222+ semiparallel_only ();
1223+
12201224 if (this -> _mat )
12211225 {
12221226 PetscBool assembled ;
12231227 LibmeshPetscCall (MatAssembled (this -> _mat , & assembled ));
1224- bool same_nonzero_pattern = false;
1225-
1226- if (assembled )
1227- {
1228- MatInfo our_info , v_info ;
1228+ #ifndef NDEBUG
1229+ const bool cxx_assembled = (assembled == PETSC_TRUE ) ? true : false;
1230+ libmesh_assert (this -> _communicator .verify (cxx_assembled ));
1231+ #endif
12291232
1230- LibmeshPetscCall (MatGetInfo (this -> _mat , MAT_GLOBAL_SUM , & our_info ));
1231- LibmeshPetscCall (MatGetInfo (v ._mat , MAT_GLOBAL_SUM , & v_info ));
1232- if (our_info .nz_allocated == v_info .nz_allocated )
1233- same_nonzero_pattern = true;
1234- }
1235- else
1233+ if (!assembled )
12361234 // MatCopy does not work with an unassembled matrix. We could use MatDuplicate but then we
12371235 // would have to destroy the matrix we manage and others might be relying on that data. So
12381236 // we just assemble here regardless of the preceding level of matrix fill
12391237 this -> close ();
1240-
1241- if (same_nonzero_pattern )
1242- LibmeshPetscCall (MatCopy (v ._mat , this -> _mat , SAME_NONZERO_PATTERN ));
1243- else
1244- LibmeshPetscCall (MatCopy (v ._mat , this -> _mat , DIFFERENT_NONZERO_PATTERN ));
1238+ LibmeshPetscCall (MatCopy (v ._mat , this -> _mat , DIFFERENT_NONZERO_PATTERN ));
12451239 }
12461240 else
12471241 LibmeshPetscCall (MatDuplicate (v ._mat , MAT_COPY_VALUES , & this -> _mat ));
0 commit comments