19#ifdef DEAL_II_WITH_PETSC
34# ifdef DEAL_II_HAVE_CXX20
158 const bool omit_zeroing_entries)
247 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner,
248 const bool make_ghosted)
252 Assert(partitioner->ghost_indices_initialized(),
253 ExcMessage(
"You asked to create a ghosted vector, but the "
254 "partitioner does not provide ghost indices."));
256 this->
reinit(partitioner->locally_owned_range(),
257 partitioner->ghost_indices(),
258 partitioner->get_mpi_communicator());
262 this->
reinit(partitioner->locally_owned_range(),
263 partitioner->get_mpi_communicator());
359 return num_nonzero == 0;
365 const unsigned int precision,
366 const bool scientific,
367 const bool across)
const
373 const PetscScalar *val;
386 std::ios::fmtflags
old_flags = out.flags();
389 out.precision(precision);
391 out.setf(std::ios::scientific, std::ios::floatfield);
393 out.setf(std::ios::fixed, std::ios::floatfield);
401 for (
unsigned int i = 0;
412 out <<
"[Proc" << i <<
" " <<
istart <<
"-" <<
iend - 1 <<
"]"
415 out << val[i] <<
' ';
419 out <<
"[Proc " << i <<
" " <<
istart <<
"-" <<
iend - 1
422 out << val[i] << std::endl;
bool is_ascending_and_one_to_one(const MPI_Comm communicator) const
size_type n_elements() const
void subtract_set(const IndexSet &other)
void print(std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const
virtual void clear() override
Vector & operator=(const Vector &v)
virtual void create_vector(const MPI_Comm comm, const size_type n, const size_type locally_owned_size)
void reinit(const MPI_Comm communicator, const size_type N, const size_type locally_owned_size, const bool omit_zeroing_entries=false)
VectorOperation::values last_action
IndexSet locally_owned_elements() const
MPI_Comm get_mpi_communicator() const
bool has_ghost_elements() const
size_type locally_owned_size() const
size_type size() const override
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcIO()
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertThrowMPI(error_code)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
#define AssertThrowIntegerConversion(index1, index2)
types::global_dof_index locally_owned_size
T sum(const T &t, const MPI_Comm mpi_communicator)
unsigned int n_mpi_processes(const MPI_Comm mpi_communicator)
unsigned int this_mpi_process(const MPI_Comm mpi_communicator)