Reference documentation for deal.II version GIT 574c7c8486 2023-09-22 10:20:02+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
petsc_vector_base.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2004 - 2023 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_petsc_vector_base_h
17 #define dealii_petsc_vector_base_h
18 
19 
20 #include <deal.II/base/config.h>
21 
22 #ifdef DEAL_II_WITH_PETSC
23 
24 # include <deal.II/base/index_set.h>
26 
27 # include <deal.II/lac/exceptions.h>
28 # include <deal.II/lac/vector.h>
30 
31 # include <petscvec.h>
32 
33 # include <utility>
34 # include <vector>
35 
37 
38 // forward declaration
39 # ifndef DOXYGEN
40 template <typename number>
41 class Vector;
42 
43 namespace PETScWrappers
44 {
45  class VectorBase;
46 }
47 # endif
48 
55 namespace PETScWrappers
56 {
66  namespace internal
67  {
80  class VectorReference
81  {
82  public:
87 
88  private:
93  VectorReference(const VectorBase &vector, const size_type index);
94 
95  public:
96  /*
97  * Copy constructor.
98  */
99  VectorReference(const VectorReference &vector) = default;
100 
112  const VectorReference &
113  operator=(const VectorReference &r) const;
114 
120  VectorReference &
121  operator=(const VectorReference &r);
122 
126  const VectorReference &
127  operator=(const PetscScalar &s) const;
128 
132  const VectorReference &
133  operator+=(const PetscScalar &s) const;
134 
138  const VectorReference &
139  operator-=(const PetscScalar &s) const;
140 
144  const VectorReference &
145  operator*=(const PetscScalar &s) const;
146 
150  const VectorReference &
151  operator/=(const PetscScalar &s) const;
152 
156  PetscReal
157  real() const;
158 
165  PetscReal
166  imag() const;
167 
172  operator PetscScalar() const;
177  ExcAccessToNonlocalElement,
178  int,
179  int,
180  int,
181  << "You tried to access element " << arg1
182  << " of a distributed vector, but only elements in range [" << arg2
183  << ',' << arg3 << "] are stored locally and can be accessed."
184  << "\n\n"
185  << "A common source for this kind of problem is that you "
186  << "are passing a 'fully distributed' vector into a function "
187  << "that needs read access to vector elements that correspond "
188  << "to degrees of freedom on ghost cells (or at least to "
189  << "'locally active' degrees of freedom that are not also "
190  << "'locally owned'). You need to pass a vector that has these "
191  << "elements as ghost entries.");
195  DeclException2(ExcWrongMode,
196  int,
197  int,
198  << "You tried to do a "
199  << (arg1 == 1 ? "'set'" : (arg1 == 2 ? "'add'" : "???"))
200  << " operation but the vector is currently in "
201  << (arg2 == 1 ? "'set'" : (arg2 == 2 ? "'add'" : "???"))
202  << " mode. You first have to call 'compress()'.");
203 
204  private:
208  const VectorBase &vector;
209 
213  const size_type index;
214 
215  // Make the vector class a friend, so that it can create objects of the
216  // present type.
217  friend class ::PETScWrappers::VectorBase;
218  };
219  } // namespace internal
250  class VectorBase : public ReadVector<PetscScalar>, public Subscriptor
251  {
252  public:
258  using value_type = PetscScalar;
259  using real_type = PetscReal;
263 
268  VectorBase();
269 
274  VectorBase(const VectorBase &v);
275 
280  explicit VectorBase(const Vec &v);
281 
285  virtual ~VectorBase() override;
286 
291  virtual void
292  clear();
293 
304  void
305  compress(const VectorOperation::values operation);
306 
310  VectorBase &
311  operator=(const VectorBase &);
312 
326  VectorBase &
327  operator=(const PetscScalar s);
328 
335  void
336  reinit(Vec v);
337 
343  bool
344  operator==(const VectorBase &v) const;
345 
351  bool
352  operator!=(const VectorBase &v) const;
353 
357  size_type
358  size() const override;
359 
368  size_type
369  locally_owned_size() const;
370 
379  std::pair<size_type, size_type>
380  local_range() const;
381 
386  bool
387  in_local_range(const size_type index) const;
388 
402  IndexSet
404 
411  bool
413 
417  const IndexSet &
418  ghost_elements() const;
419 
423  void
425 
429  reference
430  operator()(const size_type index);
431 
435  PetscScalar
436  operator()(const size_type index) const;
437 
443  reference
444  operator[](const size_type index);
445 
451  PetscScalar
452  operator[](const size_type index) const;
453 
460  void
461  set(const std::vector<size_type> &indices,
462  const std::vector<PetscScalar> &values);
463 
479  void
480  extract_subvector_to(const std::vector<size_type> &indices,
481  std::vector<PetscScalar> &values) const;
482 
486  virtual void
489  ArrayView<PetscScalar> &elements) const override;
490 
518  template <typename ForwardIterator, typename OutputIterator>
519  void
520  extract_subvector_to(const ForwardIterator indices_begin,
521  const ForwardIterator indices_end,
522  OutputIterator values_begin) const;
523 
528  void
529  add(const std::vector<size_type> &indices,
530  const std::vector<PetscScalar> &values);
531 
536  void
537  add(const std::vector<size_type> &indices,
538  const ::Vector<PetscScalar> &values);
539 
545  void
546  add(const size_type n_elements,
547  const size_type *indices,
548  const PetscScalar *values);
549 
556  PetscScalar
557  operator*(const VectorBase &vec) const;
558 
562  real_type
563  norm_sqr() const;
564 
568  PetscScalar
569  mean_value() const;
570 
578  real_type
579  l1_norm() const;
580 
585  real_type
586  l2_norm() const;
587 
592  real_type
593  lp_norm(const real_type p) const;
594 
599  real_type
600  linfty_norm() const;
601 
621  PetscScalar
622  add_and_dot(const PetscScalar a, const VectorBase &V, const VectorBase &W);
623 
629  bool
630  all_zero() const;
631 
635  VectorBase &
636  operator*=(const PetscScalar factor);
637 
641  VectorBase &
642  operator/=(const PetscScalar factor);
643 
647  VectorBase &
648  operator+=(const VectorBase &V);
649 
653  VectorBase &
654  operator-=(const VectorBase &V);
655 
660  void
661  add(const PetscScalar s);
662 
666  void
667  add(const PetscScalar a, const VectorBase &V);
668 
672  void
673  add(const PetscScalar a,
674  const VectorBase &V,
675  const PetscScalar b,
676  const VectorBase &W);
677 
681  void
682  sadd(const PetscScalar s, const VectorBase &V);
683 
687  void
688  sadd(const PetscScalar s, const PetscScalar a, const VectorBase &V);
689 
695  void
696  scale(const VectorBase &scaling_factors);
697 
701  void
702  equ(const PetscScalar a, const VectorBase &V);
703 
711  void
712  write_ascii(const PetscViewerFormat format = PETSC_VIEWER_DEFAULT);
713 
721  void
722  print(std::ostream &out,
723  const unsigned int precision = 3,
724  const bool scientific = true,
725  const bool across = true) const;
726 
739  void
740  swap(VectorBase &v);
741 
749  operator const Vec &() const;
750 
756  Vec &
757  petsc_vector();
758 
762  std::size_t
763  memory_consumption() const;
764 
768  MPI_Comm
770 
771  protected:
776  Vec vector;
777 
783  bool ghosted;
784 
791 
798 
799  // Make the reference class a friend.
801 
807  void
808  do_set_add_operation(const size_type n_elements,
809  const size_type *indices,
810  const PetscScalar *values,
811  const bool add_values);
812 
816  void
818  };
819 
820 
821 
822  // ------------------- inline and template functions --------------
823 
831  inline void
833  {
834  u.swap(v);
835  }
836 
837 # ifndef DOXYGEN
838  namespace internal
839  {
840  inline VectorReference::VectorReference(const VectorBase &vector,
841  const size_type index)
842  : vector(vector)
843  , index(index)
844  {}
845 
846 
847  inline const VectorReference &
848  VectorReference::operator=(const VectorReference &r) const
849  {
850  // as explained in the class
851  // documentation, this is not the copy
852  // operator. so simply pass on to the
853  // "correct" assignment operator
854  *this = static_cast<PetscScalar>(r);
855 
856  return *this;
857  }
858 
859 
860 
861  inline VectorReference &
862  VectorReference::operator=(const VectorReference &r)
863  {
864  // as explained in the class
865  // documentation, this is not the copy
866  // operator. so simply pass on to the
867  // "correct" assignment operator
868  *this = static_cast<PetscScalar>(r);
869 
870  return *this;
871  }
872 
873 
874 
875  inline const VectorReference &
876  VectorReference::operator=(const PetscScalar &value) const
877  {
878  Assert((vector.last_action == VectorOperation::insert) ||
879  (vector.last_action == VectorOperation::unknown),
880  ExcWrongMode(VectorOperation::insert, vector.last_action));
881 
882  Assert(!vector.has_ghost_elements(), ExcGhostsPresent());
883 
884  const PetscInt petsc_i = index;
885 
886  const PetscErrorCode ierr =
887  VecSetValues(vector, 1, &petsc_i, &value, INSERT_VALUES);
888  AssertThrow(ierr == 0, ExcPETScError(ierr));
889 
890  vector.last_action = VectorOperation::insert;
891 
892  return *this;
893  }
894 
895 
896 
897  inline const VectorReference &
898  VectorReference::operator+=(const PetscScalar &value) const
899  {
900  Assert((vector.last_action == VectorOperation::add) ||
901  (vector.last_action == VectorOperation::unknown),
902  ExcWrongMode(VectorOperation::add, vector.last_action));
903 
904  Assert(!vector.has_ghost_elements(), ExcGhostsPresent());
905 
906  vector.last_action = VectorOperation::add;
907 
908  // we have to do above actions in any
909  // case to be consistent with the MPI
910  // communication model (see the
911  // comments in the documentation of
912  // PETScWrappers::MPI::Vector), but we
913  // can save some work if the addend is
914  // zero
915  if (value == PetscScalar())
916  return *this;
917 
918  // use the PETSc function to add something
919  const PetscInt petsc_i = index;
920  const PetscErrorCode ierr =
921  VecSetValues(vector, 1, &petsc_i, &value, ADD_VALUES);
922  AssertThrow(ierr == 0, ExcPETScError(ierr));
923 
924 
925  return *this;
926  }
927 
928 
929 
930  inline const VectorReference &
931  VectorReference::operator-=(const PetscScalar &value) const
932  {
933  Assert((vector.last_action == VectorOperation::add) ||
934  (vector.last_action == VectorOperation::unknown),
935  ExcWrongMode(VectorOperation::add, vector.last_action));
936 
937  Assert(!vector.has_ghost_elements(), ExcGhostsPresent());
938 
939  vector.last_action = VectorOperation::add;
940 
941  // we have to do above actions in any
942  // case to be consistent with the MPI
943  // communication model (see the
944  // comments in the documentation of
945  // PETScWrappers::MPI::Vector), but we
946  // can save some work if the addend is
947  // zero
948  if (value == PetscScalar())
949  return *this;
950 
951  // use the PETSc function to
952  // add something
953  const PetscInt petsc_i = index;
954  const PetscScalar subtractand = -value;
955  const PetscErrorCode ierr =
956  VecSetValues(vector, 1, &petsc_i, &subtractand, ADD_VALUES);
957  AssertThrow(ierr == 0, ExcPETScError(ierr));
958 
959  return *this;
960  }
961 
962 
963 
964  inline const VectorReference &
965  VectorReference::operator*=(const PetscScalar &value) const
966  {
967  Assert((vector.last_action == VectorOperation::insert) ||
968  (vector.last_action == VectorOperation::unknown),
969  ExcWrongMode(VectorOperation::insert, vector.last_action));
970 
971  Assert(!vector.has_ghost_elements(), ExcGhostsPresent());
972 
973  vector.last_action = VectorOperation::insert;
974 
975  // we have to do above actions in any
976  // case to be consistent with the MPI
977  // communication model (see the
978  // comments in the documentation of
979  // PETScWrappers::MPI::Vector), but we
980  // can save some work if the factor is
981  // one
982  if (value == 1.)
983  return *this;
984 
985  const PetscInt petsc_i = index;
986  const PetscScalar new_value = static_cast<PetscScalar>(*this) * value;
987 
988  const PetscErrorCode ierr =
989  VecSetValues(vector, 1, &petsc_i, &new_value, INSERT_VALUES);
990  AssertThrow(ierr == 0, ExcPETScError(ierr));
991 
992  return *this;
993  }
994 
995 
996 
997  inline const VectorReference &
998  VectorReference::operator/=(const PetscScalar &value) const
999  {
1000  Assert((vector.last_action == VectorOperation::insert) ||
1001  (vector.last_action == VectorOperation::unknown),
1002  ExcWrongMode(VectorOperation::insert, vector.last_action));
1003 
1004  Assert(!vector.has_ghost_elements(), ExcGhostsPresent());
1005 
1006  vector.last_action = VectorOperation::insert;
1007 
1008  // we have to do above actions in any
1009  // case to be consistent with the MPI
1010  // communication model (see the
1011  // comments in the documentation of
1012  // PETScWrappers::MPI::Vector), but we
1013  // can save some work if the factor is
1014  // one
1015  if (value == 1.)
1016  return *this;
1017 
1018  const PetscInt petsc_i = index;
1019  const PetscScalar new_value = static_cast<PetscScalar>(*this) / value;
1020 
1021  const PetscErrorCode ierr =
1022  VecSetValues(vector, 1, &petsc_i, &new_value, INSERT_VALUES);
1023  AssertThrow(ierr == 0, ExcPETScError(ierr));
1024 
1025  return *this;
1026  }
1027 
1028 
1029 
1030  inline PetscReal
1031  VectorReference::real() const
1032  {
1033 # ifndef PETSC_USE_COMPLEX
1034  return static_cast<PetscScalar>(*this);
1035 # else
1036  return PetscRealPart(static_cast<PetscScalar>(*this));
1037 # endif
1038  }
1039 
1040 
1041 
1042  inline PetscReal
1043  VectorReference::imag() const
1044  {
1045 # ifndef PETSC_USE_COMPLEX
1046  return PetscReal(0);
1047 # else
1048  return PetscImaginaryPart(static_cast<PetscScalar>(*this));
1049 # endif
1050  }
1051 
1052  } // namespace internal
1053 
1054  inline bool
1055  VectorBase::in_local_range(const size_type index) const
1056  {
1057  PetscInt begin, end;
1058  const PetscErrorCode ierr =
1059  VecGetOwnershipRange(static_cast<const Vec &>(vector), &begin, &end);
1060  AssertThrow(ierr == 0, ExcPETScError(ierr));
1061 
1062  return ((index >= static_cast<size_type>(begin)) &&
1063  (index < static_cast<size_type>(end)));
1064  }
1065 
1066 
1067  inline IndexSet
1068  VectorBase::locally_owned_elements() const
1069  {
1070  IndexSet is(size());
1071 
1072  // PETSc only allows for contiguous local ranges, so this is simple
1073  const std::pair<size_type, size_type> x = local_range();
1074  is.add_range(x.first, x.second);
1075  return is;
1076  }
1077 
1078 
1079 
1080  inline bool
1081  VectorBase::has_ghost_elements() const
1082  {
1083  return ghosted;
1084  }
1085 
1086 
1087  inline const IndexSet &
1088  VectorBase::ghost_elements() const
1089  {
1090  return ghost_indices;
1091  }
1092 
1093 
1094  inline void
1095  VectorBase::update_ghost_values() const
1096  {
1097  if (ghosted)
1098  {
1099  PetscErrorCode ierr;
1100 
1101  ierr = VecGhostUpdateBegin(vector, INSERT_VALUES, SCATTER_FORWARD);
1102  AssertThrow(ierr == 0, ExcPETScError(ierr));
1103  ierr = VecGhostUpdateEnd(vector, INSERT_VALUES, SCATTER_FORWARD);
1104  AssertThrow(ierr == 0, ExcPETScError(ierr));
1105  }
1106  }
1107 
1108 
1109 
1110  inline internal::VectorReference
1111  VectorBase::operator()(const size_type index)
1112  {
1113  return internal::VectorReference(*this, index);
1114  }
1115 
1116 
1117 
1118  inline PetscScalar
1119  VectorBase::operator()(const size_type index) const
1120  {
1121  return static_cast<PetscScalar>(internal::VectorReference(*this, index));
1122  }
1123 
1124 
1125 
1126  inline internal::VectorReference
1127  VectorBase::operator[](const size_type index)
1128  {
1129  return operator()(index);
1130  }
1131 
1132 
1133 
1134  inline PetscScalar
1135  VectorBase::operator[](const size_type index) const
1136  {
1137  return operator()(index);
1138  }
1139 
1140  inline MPI_Comm
1141  VectorBase::get_mpi_communicator() const
1142  {
1143  return PetscObjectComm(reinterpret_cast<PetscObject>(vector));
1144  }
1145 
1146  inline void
1147  VectorBase::extract_subvector_to(const std::vector<size_type> &indices,
1148  std::vector<PetscScalar> &values) const
1149  {
1150  Assert(indices.size() <= values.size(),
1151  ExcDimensionMismatch(indices.size(), values.size()));
1152  extract_subvector_to(indices.begin(), indices.end(), values.begin());
1153  }
1154 
1155  inline void
1156  VectorBase::extract_subvector_to(
1158  ArrayView<PetscScalar> &elements) const
1159  {
1160  AssertDimension(indices.size(), elements.size());
1161  extract_subvector_to(indices.begin(), indices.end(), elements.begin());
1162  }
1163 
1164 
1165  template <typename ForwardIterator, typename OutputIterator>
1166  inline void
1167  VectorBase::extract_subvector_to(const ForwardIterator indices_begin,
1168  const ForwardIterator indices_end,
1169  OutputIterator values_begin) const
1170  {
1171  const PetscInt n_idx = static_cast<PetscInt>(indices_end - indices_begin);
1172  if (n_idx == 0)
1173  return;
1174 
1175  // if we are dealing
1176  // with a parallel vector
1177  if (ghosted)
1178  {
1179  // there is the possibility
1180  // that the vector has
1181  // ghost elements. in that
1182  // case, we first need to
1183  // figure out which
1184  // elements we own locally,
1185  // then get a pointer to
1186  // the elements that are
1187  // stored here (both the
1188  // ones we own as well as
1189  // the ghost elements). in
1190  // this array, the locally
1191  // owned elements come
1192  // first followed by the
1193  // ghost elements whose
1194  // position we can get from
1195  // an index set
1196  PetscInt begin, end;
1197  PetscErrorCode ierr = VecGetOwnershipRange(vector, &begin, &end);
1198  AssertThrow(ierr == 0, ExcPETScError(ierr));
1199 
1200  Vec locally_stored_elements = nullptr;
1201  ierr = VecGhostGetLocalForm(vector, &locally_stored_elements);
1202  AssertThrow(ierr == 0, ExcPETScError(ierr));
1203 
1204  PetscInt lsize;
1205  ierr = VecGetSize(locally_stored_elements, &lsize);
1206  AssertThrow(ierr == 0, ExcPETScError(ierr));
1207 
1208  const PetscScalar *ptr;
1209  ierr = VecGetArrayRead(locally_stored_elements, &ptr);
1210  AssertThrow(ierr == 0, ExcPETScError(ierr));
1211 
1212  for (PetscInt i = 0; i < n_idx; ++i)
1213  {
1214  const unsigned int index = *(indices_begin + i);
1215  if (index >= static_cast<unsigned int>(begin) &&
1216  index < static_cast<unsigned int>(end))
1217  {
1218  // local entry
1219  *(values_begin + i) = *(ptr + index - begin);
1220  }
1221  else
1222  {
1223  // ghost entry
1224  const unsigned int ghostidx =
1225  ghost_indices.index_within_set(index);
1226 
1227  AssertIndexRange(ghostidx + end - begin, lsize);
1228  *(values_begin + i) = *(ptr + ghostidx + end - begin);
1229  }
1230  }
1231 
1232  ierr = VecRestoreArrayRead(locally_stored_elements, &ptr);
1233  AssertThrow(ierr == 0, ExcPETScError(ierr));
1234 
1235  ierr = VecGhostRestoreLocalForm(vector, &locally_stored_elements);
1236  AssertThrow(ierr == 0, ExcPETScError(ierr));
1237  }
1238  // if the vector is local or the
1239  // caller, then simply access the
1240  // element we are interested in
1241  else
1242  {
1243  PetscInt begin, end;
1244  PetscErrorCode ierr = VecGetOwnershipRange(vector, &begin, &end);
1245  AssertThrow(ierr == 0, ExcPETScError(ierr));
1246 
1247  const PetscScalar *ptr;
1248  ierr = VecGetArrayRead(vector, &ptr);
1249  AssertThrow(ierr == 0, ExcPETScError(ierr));
1250 
1251  for (PetscInt i = 0; i < n_idx; ++i)
1252  {
1253  const unsigned int index = *(indices_begin + i);
1254 
1255  Assert(index >= static_cast<unsigned int>(begin) &&
1256  index < static_cast<unsigned int>(end),
1257  ExcMessage("You are accessing elements of a vector without "
1258  "ghost elements that are not actually owned by "
1259  "this vector. A typical case where this may "
1260  "happen is if you are passing a non-ghosted "
1261  "(completely distributed) vector to a function "
1262  "that expects a vector that stores ghost "
1263  "elements for all locally relevant or locally "
1264  "active vector entries."));
1265 
1266  *(values_begin + i) = *(ptr + index - begin);
1267  }
1268 
1269  ierr = VecRestoreArrayRead(vector, &ptr);
1270  AssertThrow(ierr == 0, ExcPETScError(ierr));
1271  }
1272  }
1273 
1274 # endif // DOXYGEN
1275 } // namespace PETScWrappers
1276 
1278 
1279 #endif // DEAL_II_WITH_PETSC
1280 
1281 #endif
iterator begin() const
Definition: array_view.h:591
iterator end() const
Definition: array_view.h:600
std::size_t size() const
Definition: array_view.h:573
real_type lp_norm(const real_type p) const
VectorBase & operator+=(const VectorBase &V)
const IndexSet & ghost_elements() const
PetscScalar mean_value() const
VectorOperation::values last_action
PetscScalar operator*(const VectorBase &vec) const
bool operator==(const VectorBase &v) const
VectorBase & operator*=(const PetscScalar factor)
VectorBase & operator-=(const VectorBase &V)
bool operator!=(const VectorBase &v) const
IndexSet locally_owned_elements() const
bool in_local_range(const size_type index) const
std::size_t memory_consumption() const
internal::VectorReference reference
VectorBase & operator/=(const PetscScalar factor)
friend class internal::VectorReference
PetscScalar operator[](const size_type index) const
MPI_Comm get_mpi_communicator() const
void scale(const VectorBase &scaling_factors)
void extract_subvector_to(const std::vector< size_type > &indices, std::vector< PetscScalar > &values) const
void update_ghost_values() const
std::pair< size_type, size_type > local_range() const
void sadd(const PetscScalar s, const VectorBase &V)
void compress(const VectorOperation::values operation)
void set(const std::vector< size_type > &indices, const std::vector< PetscScalar > &values)
void print(std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const
PetscScalar add_and_dot(const PetscScalar a, const VectorBase &V, const VectorBase &W)
virtual ~VectorBase() override
reference operator()(const size_type index)
const internal::VectorReference const_reference
void add(const std::vector< size_type > &indices, const std::vector< PetscScalar > &values)
void write_ascii(const PetscViewerFormat format=PETSC_VIEWER_DEFAULT)
bool has_ghost_elements() const
reference operator[](const size_type index)
virtual void extract_subvector_to(const ArrayView< const types::global_dof_index > &indices, ArrayView< PetscScalar > &elements) const override
size_type locally_owned_size() const
void equ(const PetscScalar a, const VectorBase &V)
void do_set_add_operation(const size_type n_elements, const size_type *indices, const PetscScalar *values, const bool add_values)
VectorBase & operator=(const VectorBase &)
types::global_dof_index size_type
size_type size() const override
void swap(VectorBase &u, VectorBase &v)
PetscScalar operator()(const size_type index) const
void extract_subvector_to(const ForwardIterator indices_begin, const ForwardIterator indices_end, OutputIterator values_begin) const
Definition: vector.h:110
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:477
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:478
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
#define Assert(cond, exc)
Definition: exceptions.h:1616
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:535
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:1789
#define AssertIndexRange(index, range)
Definition: exceptions.h:1857
#define DeclException3(Exception3, type1, type2, type3, outsequence)
Definition: exceptions.h:558
static ::ExceptionBase & ExcGhostsPresent()
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
Definition: exceptions.h:1705
static const char V
types::global_dof_index size_type
Definition: cuda_kernels.h:45
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
VectorType::value_type * begin(VectorType &V)
VectorType::value_type * end(VectorType &V)
unsigned int global_dof_index
Definition: types.h:82