16#ifndef dealii_vector_h
17#define dealii_vector_h
32#include <boost/serialization/split_member.hpp>
35#include <initializer_list>
44# ifdef DEAL_II_WITH_PETSC
51# ifdef DEAL_II_WITH_TRILINOS
61template <
typename number>
107template <
typename Number>
115 "The Vector class does not support auto-differentiable numbers.");
175 template <
typename OtherNumber>
193 template <
typename OtherNumber>
194 explicit Vector(
const std::initializer_list<OtherNumber> &v);
196#ifdef DEAL_II_WITH_PETSC
211#ifdef DEAL_II_WITH_TRILINOS
244 template <
typename InputIterator>
333 template <
typename Number2>
389 template <
typename Number2>
399#ifdef DEAL_II_WITH_PETSC
416#ifdef DEAL_II_WITH_TRILINOS
441 template <
typename Number2>
450 template <
typename Number2>
475 template <
typename Number2>
654 template <
typename OtherNumber>
657 std::vector<OtherNumber> &
values)
const;
686 template <
typename ForwardIterator,
typename OutputIterator>
689 const ForwardIterator indices_end,
690 OutputIterator values_begin)
const;
719 template <
typename OtherNumber>
721 add(
const std::vector<size_type> & indices,
722 const std::vector<OtherNumber> &
values);
728 template <
typename OtherNumber>
737 template <
typename OtherNumber>
741 const OtherNumber *
values);
818 template <
typename Number2>
833 template <
typename Number2>
858 const unsigned int precision = 3,
859 const bool scientific =
true,
860 const bool across =
true)
const;
889 template <
class Archive>
891 save(Archive &ar,
const unsigned int version)
const;
898 template <
class Archive>
900 load(Archive &ar,
const unsigned int version);
908 template <
class Archive>
910 serialize(Archive &archive,
const unsigned int version);
914 BOOST_SERIALIZATION_SPLIT_MEMBER()
1023 const bool omit_zeroing_entries,
1024 const bool reset_partitioner);
1030 mutable std::shared_ptr<parallel::internal::TBBPartitioner>
1034 template <
typename Number2>
1053template <
typename Number>
1064template <
typename Number>
1065template <
typename OtherNumber>
1072template <
typename Number>
1073template <
typename InputIterator>
1084template <
typename Number>
1095template <
typename Number>
1104template <
typename Number>
1113template <
typename Number>
1122template <
typename Number>
1131template <
typename Number>
1140template <
typename Number>
1149template <
typename Number>
1158template <
typename Number>
1167template <
typename Number>
1176template <
typename Number>
1186template <
typename Number>
1196template <
typename Number>
1205template <
typename Number>
1214template <
typename Number>
1215template <
typename OtherNumber>
1218 std::vector<OtherNumber> &
values)
const
1220 for (
size_type i = 0; i < indices.size(); ++i)
1221 values[i] =
operator()(indices[i]);
1226template <
typename Number>
1227template <
typename ForwardIterator,
typename OutputIterator>
1230 const ForwardIterator indices_end,
1231 OutputIterator values_begin)
const
1233 while (indices_begin != indices_end)
1243template <
typename Number>
1256template <
typename Number>
1257template <
typename OtherNumber>
1260 const std::vector<OtherNumber> &
values)
1269template <
typename Number>
1270template <
typename OtherNumber>
1282template <
typename Number>
1283template <
typename OtherNumber>
1287 const OtherNumber *
values)
1289 for (
size_type i = 0; i < n_indices; ++i)
1295 "The given value is not finite but either infinite or Not A Number (NaN)"));
1297 this->values[indices[i]] +=
values[i];
1303template <
typename Number>
1304template <
typename Number2>
1308 return !(*
this == v);
1313template <
typename Number>
1318template <
typename Number>
1325template <
typename Number>
1335template <
typename Number>
1345template <
typename Number>
1346template <
class Archive>
1357template <
typename Number>
1358template <
class Archive>
1383template <
typename Number>
1398template <
typename number>
1399inline std::ostream &
1407 out << v(v.
size() - 1);
1422template <
typename Number>
void swap(AlignedVector< T > &vec)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcIO()
static ::ExceptionBase & ExcZero()
static ::ExceptionBase & ExcEmptyObject()
#define Assert(cond, exc)
#define AssertIsFinite(number)
#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)
Vector< Number > & operator=(const PETScWrappers::VectorBase &v)
typename numbers::NumberTraits< Number >::real_type real_type
Number & operator[](const size_type i)
void extract_subvector_to(ForwardIterator indices_begin, const ForwardIterator indices_end, OutputIterator values_begin) const
bool operator!=(const Vector< Number2 > &v) const
const value_type * const_pointer
void scale(const Vector< Number2 > &scaling_factors)
bool has_ghost_elements() const
void add(const std::vector< size_type > &indices, const std::vector< OtherNumber > &values)
void add(const Number a, const Vector< Number > &V, const Number b, const Vector< Number > &W)
Vector(const TrilinosWrappers::MPI::Vector &v)
Number & operator()(const size_type i)
Vector< Number > & operator=(const TrilinosWrappers::MPI::Vector &v)
bool in_local_range(const size_type global_index) const
Vector< Number > & operator=(const Number s)
Number operator*(const Vector< Number2 > &V) const
const_pointer data() const
void do_reinit(const size_type new_size, const bool omit_zeroing_entries, const bool reset_partitioner)
Vector< Number > & operator=(const BlockVector< Number > &v)
void sadd(const Number s, const Number a, const Vector< Number > &V)
Vector(const size_type n)
Vector< Number > & operator=(Vector< Number > &&v) noexcept=default
const value_type * const_iterator
void block_write(std::ostream &out) const
Number mean_value() const
Number add_and_dot(const Number a, const Vector< Number > &V, const Vector< Number > &W)
void load(Archive &ar, const unsigned int version)
const value_type & const_reference
void reinit(const Vector< Number2 > &V, const bool omit_zeroing_entries=false)
void print(std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const
Vector(const Vector< Number > &v)
std::shared_ptr< parallel::internal::TBBPartitioner > thread_loop_partitioner
void block_read(std::istream &in)
types::global_dof_index size_type
Number operator[](const size_type i) const
Vector< Number > & operator*=(const Number factor)
void equ(const Number a, const Vector< Number > &u)
void serialize(Archive &archive, const unsigned int version)
Vector(const PETScWrappers::VectorBase &v)
real_type lp_norm(const real_type p) const
const_iterator begin() const
void sadd(const Number s, const Vector< Number > &V)
void swap(Vector< Number > &u, Vector< Number > &v)
bool operator==(const Vector< Number2 > &v) const
std::ostream & operator<<(std::ostream &out, const Vector< number > &v)
void compress(::VectorOperation::values operation=::VectorOperation::unknown) const
real_type l2_norm() const
virtual void swap(Vector< Number > &v)
void grow_or_shrink(const size_type N)
virtual ~Vector() override=default
Vector(const Vector< OtherNumber > &v)
void save(Archive &ar, const unsigned int version) const
real_type linfty_norm() const
Vector< Number > & operator=(const Vector< Number > &v)
Vector< Number > & operator+=(const Vector< Number > &V)
void scale(const Vector< Number > &scaling_factors)
void maybe_reset_thread_partitioner()
IndexSet locally_owned_elements() const
real_type norm_sqr() const
void add(const Number a, const Vector< Number > &V)
AlignedVector< Number > values
void equ(const Number a, const Vector< Number2 > &u)
Vector< Number > & operator=(const Vector< Number2 > &v)
void apply_givens_rotation(const std::array< Number, 3 > &csr, const size_type i, const size_type k)
const_iterator end() const
Vector(Vector< Number > &&v) noexcept=default
virtual void reinit(const size_type N, const bool omit_zeroing_entries=false)
void add(const size_type n_elements, const size_type *indices, const OtherNumber *values)
size_type locally_owned_size() const
Number operator()(const size_type i) const
bool is_non_negative() const
Vector< Number > & operator-=(const Vector< Number > &V)
void extract_subvector_to(const std::vector< size_type > &indices, std::vector< OtherNumber > &values) const
void update_ghost_values() const
std::size_t memory_consumption() const
real_type l1_norm() const
void add(const std::vector< size_type > &indices, const Vector< OtherNumber > &values)
Vector(const InputIterator first, const InputIterator last)
Vector(const std::initializer_list< OtherNumber > &v)
Vector< Number > & operator/=(const Number factor)
bool is_finite(const double x)
unsigned int global_dof_index