20 #ifdef DEAL_II_WITH_PETSC
32 : communicator(MPI_COMM_SELF)
45 : communicator(communicator)
56 , communicator(communicator)
75 : communicator(communicator)
90 , communicator(v.communicator)
103 : communicator(communicator)
139 ierr = VecGhostUpdateBegin(
vector, INSERT_VALUES, SCATTER_FORWARD);
141 ierr = VecGhostUpdateEnd(
vector, INSERT_VALUES, SCATTER_FORWARD);
164 const bool omit_zeroing_entries)
174 MPI_Allreduce(&k, &k_global, 1, MPI_INT, MPI_LOR,
communicator);
189 const PetscErrorCode ierr = VecDestroy(&
vector);
197 if (omit_zeroing_entries ==
false)
209 if (!omit_zeroing_entries)
211 const PetscErrorCode ierr = VecSet(
vector, 0.0);
226 const PetscErrorCode ierr = VecDestroy(&
vector);
242 const PetscErrorCode ierr = VecDestroy(&
vector);
260 const PetscErrorCode ierr =
279 std::vector<size_type> ghostindices;
282 const PetscInt *ptr =
283 (ghostindices.size() > 0 ?
284 reinterpret_cast<const PetscInt *
>(ghostindices.data()) :
308 ierr = VecGhostGetLocalForm(
vector, &
l);
312 ierr = VecGetSize(
l, &lsize);
315 ierr = VecGhostRestoreLocalForm(
vector, &
l);
330 # if DEAL_II_PETSC_VERSION_LT(3, 6, 0)
343 # ifdef DEAL_II_WITH_MPI
347 return num_nonzero == 0;
349 return has_nonzero == 0;
356 const unsigned int precision,
357 const bool scientific,
358 const bool across)
const
365 PetscInt nlocal, istart, iend;
367 PetscErrorCode ierr = VecGetArray(
vector, &val);
370 ierr = VecGetLocalSize(
vector, &nlocal);
373 ierr = VecGetOwnershipRange(
vector, &istart, &iend);
377 std::ios::fmtflags old_flags = out.flags();
378 unsigned int old_precision = out.precision(precision);
380 out.precision(precision);
382 out.setf(std::ios::scientific, std::ios::floatfield);
384 out.setf(std::ios::fixed, std::ios::floatfield);
391 for (
unsigned int i = 0;
402 out <<
"[Proc" << i <<
" " << istart <<
"-" << iend - 1 <<
"]"
404 for (PetscInt i = 0; i < nlocal; ++i)
405 out << val[i] <<
' ';
409 out <<
"[Proc " << i <<
" " << istart <<
"-" << iend - 1
411 for (PetscInt i = 0; i < nlocal; ++i)
412 out << val[i] << std::endl;
418 out.flags(old_flags);
419 out.precision(old_precision);
423 ierr = VecRestoreArray(
vector, &val);
435 #endif // DEAL_II_WITH_PETSC