Reference documentation for deal.II version GIT b206511199 2023-01-31 13:40: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\}}\)
la_parallel_vector.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2011 - 2022 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_la_parallel_vector_h
17 #define dealii_la_parallel_vector_h
18 
19 #include <deal.II/base/config.h>
20 
24 #include <deal.II/base/mpi_stub.h>
25 #include <deal.II/base/numbers.h>
26 #include <deal.II/base/parallel.h>
29 
33 
34 #include <iomanip>
35 #include <memory>
36 
38 
39 // Forward declarations
40 #ifndef DOXYGEN
41 namespace LinearAlgebra
42 {
46  namespace distributed
47  {
48  template <typename>
49  class BlockVector;
50  }
51 
52  template <typename>
53  class ReadWriteVector;
54 } // namespace LinearAlgebra
55 
56 # ifdef DEAL_II_WITH_PETSC
57 namespace PETScWrappers
58 {
59  namespace MPI
60  {
61  class Vector;
62  }
63 } // namespace PETScWrappers
64 # endif
65 
66 # ifdef DEAL_II_WITH_TRILINOS
67 namespace TrilinosWrappers
68 {
69  namespace MPI
70  {
71  class Vector;
72  }
73 } // namespace TrilinosWrappers
74 # endif
75 #endif
76 
77 namespace LinearAlgebra
78 {
79  namespace distributed
80  {
250  template <typename Number, typename MemorySpace = MemorySpace::Host>
252  public Subscriptor
253  {
254  public:
256  using value_type = Number;
257  using pointer = value_type *;
258  using const_pointer = const value_type *;
259  using iterator = value_type *;
260  using const_iterator = const value_type *;
262  using const_reference = const value_type &;
265 
266  static_assert(
267  std::is_same<MemorySpace, ::MemorySpace::Host>::value ||
268  std::is_same<MemorySpace, ::MemorySpace::CUDA>::value,
269  "MemorySpace should be Host or CUDA");
270 
279 
287 
295  Vector(Vector<Number, MemorySpace> &&in_vector); // NOLINT
296 
302 
319  Vector(const IndexSet &local_range,
320  const IndexSet &ghost_indices,
321  const MPI_Comm &communicator);
322 
326  Vector(const IndexSet &local_range, const MPI_Comm &communicator);
327 
335  const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner);
336 
340  virtual ~Vector() override;
341 
346  void
347  reinit(const size_type size, const bool omit_zeroing_entries = false);
348 
359  template <typename Number2>
360  void
362  const bool omit_zeroing_entries = false);
363 
380  void
381  reinit(const IndexSet &local_range,
382  const IndexSet &ghost_indices,
383  const MPI_Comm &communicator);
384 
388  void
389  reinit(const IndexSet &local_range, const MPI_Comm &communicator);
390 
403  void
405  const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner,
406  const MPI_Comm &comm_sm = MPI_COMM_SELF);
407 
427  void
429  const types::global_dof_index ghost_size,
430  const MPI_Comm & comm,
431  const MPI_Comm & comm_sm = MPI_COMM_SELF);
432 
445  void
447 
461 
473  template <typename Number2>
476 
518  virtual void
519  compress(::VectorOperation::values operation) override;
520 
542  void
544 
562  void
564  const unsigned int communication_channel = 0,
566 
585  void
587 
605  void
607  const unsigned int communication_channel = 0) const;
608 
609 
617  void
619 
630  DEAL_II_DEPRECATED void
632 
641  void
643 
655  bool
657 
672  template <typename Number2>
673  void
675 
686  template <typename MemorySpace2>
687  void
688  import(const Vector<Number, MemorySpace2> &src,
689  VectorOperation::values operation);
690 
702  virtual void
704  const bool omit_zeroing_entries = false) override;
705 
710  operator*=(const Number factor) override;
711 
716  operator/=(const Number factor) override;
717 
723 
729 
741  virtual void
743  VectorOperation::values operation,
744  std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
745  communication_pattern = {}) override;
746 
750  virtual Number
751  operator*(const VectorSpaceVector<Number> &V) const override;
752 
756  virtual void
757  add(const Number a) override;
758 
762  virtual void
763  add(const Number a, const VectorSpaceVector<Number> &V) override;
764 
768  virtual void
769  add(const Number a,
771  const Number b,
772  const VectorSpaceVector<Number> &W) override;
773 
778  virtual void
779  add(const std::vector<size_type> &indices,
780  const std::vector<Number> & values);
781 
786  virtual void
787  sadd(const Number s,
788  const Number a,
789  const VectorSpaceVector<Number> &V) override;
790 
796  virtual void
797  scale(const VectorSpaceVector<Number> &scaling_factors) override;
798 
802  virtual void
803  equ(const Number a, const VectorSpaceVector<Number> &V) override;
804 
809  virtual real_type
810  l1_norm() const override;
811 
816  virtual real_type
817  l2_norm() const override;
818 
822  real_type
823  norm_sqr() const;
824 
829  virtual real_type
830  linfty_norm() const override;
831 
852  virtual Number
853  add_and_dot(const Number a,
855  const VectorSpaceVector<Number> &W) override;
856 
861  virtual size_type
862  size() const override;
863 
875  virtual ::IndexSet
876  locally_owned_elements() const override;
877 
881  virtual void
882  print(std::ostream & out,
883  const unsigned int precision = 3,
884  const bool scientific = true,
885  const bool across = true) const override;
886 
890  virtual std::size_t
891  memory_consumption() const override;
905  operator=(const Number s) override;
906 
911  template <typename OtherNumber>
912  void
913  add(const std::vector<size_type> & indices,
914  const ::Vector<OtherNumber> &values);
915 
920  template <typename OtherNumber>
921  void
922  add(const size_type n_elements,
923  const size_type * indices,
924  const OtherNumber *values);
925 
930  void
931  sadd(const Number s, const Vector<Number, MemorySpace> &V);
932 
948  size_type
949  local_size() const;
950 
955  size_type
957 
962  bool
964 
975  iterator
976  begin();
977 
986  begin() const;
987 
995  iterator
996  end();
997 
1006  end() const;
1007 
1017  Number
1019 
1029  Number &
1031 
1039  Number
1048  Number &
1050 
1059  Number
1060  local_element(const size_type local_index) const;
1061 
1070  Number &
1071  local_element(const size_type local_index);
1072 
1079  Number *
1080  get_values() const;
1081 
1099  template <typename OtherNumber>
1100  void
1101  extract_subvector_to(const std::vector<size_type> &indices,
1102  std::vector<OtherNumber> & values) const;
1103 
1131  template <typename ForwardIterator, typename OutputIterator>
1132  void
1133  extract_subvector_to(ForwardIterator indices_begin,
1134  const ForwardIterator indices_end,
1135  OutputIterator values_begin) const;
1141  virtual bool
1142  all_zero() const override;
1143 
1147  virtual Number
1148  mean_value() const override;
1149 
1154  real_type
1155  lp_norm(const real_type p) const;
1167  const MPI_Comm &
1169 
1176  const std::shared_ptr<const Utilities::MPI::Partitioner> &
1178 
1188  bool
1190  const Utilities::MPI::Partitioner &part) const;
1191 
1205  bool
1207  const Utilities::MPI::Partitioner &part) const;
1208 
1212  void
1213  set_ghost_state(const bool ghosted) const;
1214 
1219  const std::vector<ArrayView<const Number>> &
1221 
1230 
1237 
1242  Number,
1243  Number,
1244  unsigned int,
1245  << "Called compress(VectorOperation::insert), but"
1246  << " the element received from a remote processor, value "
1247  << std::setprecision(16) << arg1
1248  << ", does not match with the value "
1249  << std::setprecision(16) << arg2
1250  << " on the owner processor " << arg3);
1251 
1257  size_type,
1258  size_type,
1259  size_type,
1260  size_type,
1261  << "You tried to access element " << arg1
1262  << " of a distributed vector, but this element is not "
1263  << "stored on the current processor. Note: The range of "
1264  << "locally owned elements is [" << arg2 << ',' << arg3
1265  << "], and there are " << arg4 << " ghost elements "
1266  << "that this vector can access."
1267  << "\n\n"
1268  << "A common source for this kind of problem is that you "
1269  << "are passing a 'fully distributed' vector into a function "
1270  << "that needs read access to vector elements that correspond "
1271  << "to degrees of freedom on ghost cells (or at least to "
1272  << "'locally active' degrees of freedom that are not also "
1273  << "'locally owned'). You need to pass a vector that has these "
1274  << "elements as ghost entries.");
1275 
1276  private:
1281  void
1282  add_local(const Number a, const VectorSpaceVector<Number> &V);
1283 
1288  void
1289  sadd_local(const Number s,
1290  const Number a,
1291  const VectorSpaceVector<Number> &V);
1292 
1296  template <typename Number2>
1297  Number
1299 
1303  real_type
1305 
1309  Number
1311 
1315  real_type
1316  l1_norm_local() const;
1317 
1321  real_type
1322  lp_norm_local(const real_type p) const;
1323 
1327  real_type
1329 
1335  Number
1336  add_and_dot_local(const Number a,
1338  const Vector<Number, MemorySpace> &W);
1339 
1345  std::shared_ptr<const Utilities::MPI::Partitioner> partitioner;
1346 
1351 
1355  mutable ::MemorySpace::MemorySpaceData<Number, MemorySpace> data;
1356 
1361  mutable std::shared_ptr<::parallel::internal::TBBPartitioner>
1363 
1368  mutable ::MemorySpace::MemorySpaceData<Number, MemorySpace>
1370 
1378  mutable bool vector_is_ghosted;
1379 
1380 #ifdef DEAL_II_WITH_MPI
1389  std::vector<MPI_Request> compress_requests;
1390 
1395  mutable std::vector<MPI_Request> update_ghost_values_requests;
1396 #endif
1397 
1403  mutable std::mutex mutex;
1404 
1410  MPI_Comm comm_sm;
1411 
1416  void
1418 
1422  void
1423  resize_val(const size_type new_allocated_size,
1424  const MPI_Comm &comm_sm = MPI_COMM_SELF);
1425 
1426  // Make all other vector types friends.
1427  template <typename Number2, typename MemorySpace2>
1428  friend class Vector;
1429 
1430  // Make BlockVector type friends.
1431  template <typename Number2>
1432  friend class BlockVector;
1433  };
1437  /*-------------------- Inline functions ---------------------------------*/
1438 
1439 #ifndef DOXYGEN
1440 
1441  template <typename Number, typename MemorySpace>
1442  inline bool
1444  {
1445  return vector_is_ghosted;
1446  }
1447 
1448 
1449 
1450  template <typename Number, typename MemorySpace>
1453  {
1454  return partitioner->size();
1455  }
1456 
1457 
1458 
1459  template <typename Number, typename MemorySpace>
1462  {
1463  return locally_owned_size();
1464  }
1465 
1466 
1467 
1468  template <typename Number, typename MemorySpace>
1471  {
1472  return partitioner->locally_owned_size();
1473  }
1474 
1475 
1476 
1477  template <typename Number, typename MemorySpace>
1478  inline bool
1480  const size_type global_index) const
1481  {
1482  return partitioner->in_local_range(global_index);
1483  }
1484 
1485 
1486 
1487  template <typename Number, typename MemorySpace>
1488  inline IndexSet
1490  {
1491  IndexSet is(size());
1492 
1493  is.add_range(partitioner->local_range().first,
1494  partitioner->local_range().second);
1495 
1496  return is;
1497  }
1498 
1499 
1500 
1501  template <typename Number, typename MemorySpace>
1504  {
1505  return data.values.data();
1506  }
1507 
1508 
1509 
1510  template <typename Number, typename MemorySpace>
1513  {
1514  return data.values.data();
1515  }
1516 
1517 
1518 
1519  template <typename Number, typename MemorySpace>
1522  {
1523  return data.values.data() + partitioner->locally_owned_size();
1524  }
1525 
1526 
1527 
1528  template <typename Number, typename MemorySpace>
1531  {
1532  return data.values.data() + partitioner->locally_owned_size();
1533  }
1534 
1535 
1536 
1537  template <typename Number, typename MemorySpace>
1538  const std::vector<ArrayView<const Number>> &
1540  {
1541  return data.values_sm;
1542  }
1543 
1544 
1545 
1546  template <typename Number, typename MemorySpace>
1547  inline Number
1549  {
1550  Assert((std::is_same<MemorySpace, ::MemorySpace::Host>::value),
1551  ExcMessage(
1552  "This function is only implemented for the Host memory space"));
1553  Assert(
1554  partitioner->in_local_range(global_index) ||
1555  partitioner->ghost_indices().is_element(global_index),
1556  ExcAccessToNonLocalElement(global_index,
1557  partitioner->local_range().first,
1558  partitioner->local_range().second == 0 ?
1559  0 :
1560  (partitioner->local_range().second - 1),
1561  partitioner->ghost_indices().n_elements()));
1562  // do not allow reading a vector which is not in ghost mode
1563  Assert(partitioner->in_local_range(global_index) ||
1564  vector_is_ghosted == true,
1565  ExcMessage("You tried to read a ghost element of this vector, "
1566  "but it has not imported its ghost values."));
1567  return data.values[partitioner->global_to_local(global_index)];
1568  }
1569 
1570 
1571 
1572  template <typename Number, typename MemorySpace>
1573  inline Number &
1575  {
1576  Assert((std::is_same<MemorySpace, ::MemorySpace::Host>::value),
1577  ExcMessage(
1578  "This function is only implemented for the Host memory space"));
1579  Assert(
1580  partitioner->in_local_range(global_index) ||
1581  partitioner->ghost_indices().is_element(global_index),
1582  ExcAccessToNonLocalElement(global_index,
1583  partitioner->local_range().first,
1584  partitioner->local_range().second == 0 ?
1585  0 :
1586  (partitioner->local_range().second - 1),
1587  partitioner->ghost_indices().n_elements()));
1588  // we would like to prevent reading ghosts from a vector that does not
1589  // have them imported, but this is not possible because we might be in a
1590  // part of the code where the vector has enabled ghosts but is non-const
1591  // (then, the compiler picks this method according to the C++ rule book
1592  // even if a human would pick the const method when this subsequent use
1593  // is just a read)
1594  return data.values[partitioner->global_to_local(global_index)];
1595  }
1596 
1597 
1598 
1599  template <typename Number, typename MemorySpace>
1600  inline Number
1602  {
1603  return operator()(global_index);
1604  }
1605 
1606 
1607 
1608  template <typename Number, typename MemorySpace>
1609  inline Number &
1611  {
1612  return operator()(global_index);
1613  }
1614 
1615 
1616 
1617  template <typename Number, typename MemorySpace>
1618  inline Number
1620  const size_type local_index) const
1621  {
1622  Assert((std::is_same<MemorySpace, ::MemorySpace::Host>::value),
1623  ExcMessage(
1624  "This function is only implemented for the Host memory space"));
1625  AssertIndexRange(local_index,
1626  partitioner->locally_owned_size() +
1627  partitioner->n_ghost_indices());
1628  // do not allow reading a vector which is not in ghost mode
1629  Assert(local_index < locally_owned_size() || vector_is_ghosted == true,
1630  ExcMessage("You tried to read a ghost element of this vector, "
1631  "but it has not imported its ghost values."));
1632 
1633  return data.values[local_index];
1634  }
1635 
1636 
1637 
1638  template <typename Number, typename MemorySpace>
1639  inline Number &
1641  {
1642  Assert((std::is_same<MemorySpace, ::MemorySpace::Host>::value),
1643  ExcMessage(
1644  "This function is only implemented for the Host memory space"));
1645 
1646  AssertIndexRange(local_index,
1647  partitioner->locally_owned_size() +
1648  partitioner->n_ghost_indices());
1649 
1650  return data.values[local_index];
1651  }
1652 
1653 
1654 
1655  template <typename Number, typename MemorySpace>
1656  inline Number *
1658  {
1659  return data.values.data();
1660  }
1661 
1662 
1663 
1664  template <typename Number, typename MemorySpace>
1665  template <typename OtherNumber>
1666  inline void
1668  const std::vector<size_type> &indices,
1669  std::vector<OtherNumber> & values) const
1670  {
1671  for (size_type i = 0; i < indices.size(); ++i)
1672  values[i] = operator()(indices[i]);
1673  }
1674 
1675 
1676 
1677  template <typename Number, typename MemorySpace>
1678  template <typename ForwardIterator, typename OutputIterator>
1679  inline void
1681  ForwardIterator indices_begin,
1682  const ForwardIterator indices_end,
1683  OutputIterator values_begin) const
1684  {
1685  while (indices_begin != indices_end)
1686  {
1687  *values_begin = operator()(*indices_begin);
1688  indices_begin++;
1689  values_begin++;
1690  }
1691  }
1692 
1693 
1694 
1695  template <typename Number, typename MemorySpace>
1696  template <typename OtherNumber>
1697  inline void
1699  const std::vector<size_type> & indices,
1700  const ::Vector<OtherNumber> &values)
1701  {
1702  AssertDimension(indices.size(), values.size());
1703  for (size_type i = 0; i < indices.size(); ++i)
1704  {
1705  Assert(
1707  ExcMessage(
1708  "The given value is not finite but either infinite or Not A Number (NaN)"));
1709  this->operator()(indices[i]) += values(i);
1710  }
1711  }
1712 
1713 
1714 
1715  template <typename Number, typename MemorySpace>
1716  template <typename OtherNumber>
1717  inline void
1719  const size_type * indices,
1720  const OtherNumber *values)
1721  {
1722  for (size_type i = 0; i < n_elements; ++i, ++indices, ++values)
1723  {
1724  Assert(
1726  ExcMessage(
1727  "The given value is not finite but either infinite or Not A Number (NaN)"));
1728  this->operator()(*indices) += *values;
1729  }
1730  }
1731 
1732 
1733 
1734  template <typename Number, typename MemorySpace>
1735  inline const MPI_Comm &
1737  {
1738  return partitioner->get_mpi_communicator();
1739  }
1740 
1741 
1742 
1743  template <typename Number, typename MemorySpace>
1744  inline const std::shared_ptr<const Utilities::MPI::Partitioner> &
1746  {
1747  return partitioner;
1748  }
1749 
1750 
1751 
1752  template <typename Number, typename MemorySpace>
1753  inline void
1754  Vector<Number, MemorySpace>::set_ghost_state(const bool ghosted) const
1755  {
1756  vector_is_ghosted = ghosted;
1757  }
1758 
1759 #endif
1760 
1761  } // namespace distributed
1762 } // namespace LinearAlgebra
1763 
1764 
1772 template <typename Number, typename MemorySpace>
1773 inline void
1776 {
1777  u.swap(v);
1778 }
1779 
1780 
1784 template <typename Number, typename MemorySpace>
1786  : std::false_type
1787 {};
1788 
1789 
1790 
1791 namespace internal
1792 {
1793  namespace LinearOperatorImplementation
1794  {
1795  template <typename>
1796  class ReinitHelper;
1797 
1802  template <typename Number>
1804  {
1805  public:
1806  // A helper type-trait that leverage SFINAE to figure out if type T has
1807  // void T::get_mpi_communicator()
1808  template <typename T>
1810  decltype(std::declval<T>().get_mpi_communicator());
1811 
1812  template <typename T>
1813  static constexpr bool has_get_mpi_communicator =
1814  is_supported_operation<get_mpi_communicator_t, T>;
1815 
1816  // A helper type-trait that leverage SFINAE to figure out if type T has
1817  // void T::locally_owned_domain_indices()
1818  template <typename T>
1820  decltype(std::declval<T>().locally_owned_domain_indices());
1821 
1822  template <typename T>
1823  static constexpr bool has_locally_owned_domain_indices =
1824  is_supported_operation<locally_owned_domain_indices_t, T>;
1825 
1826  // A helper type-trait that leverage SFINAE to figure out if type T has
1827  // void T::locally_owned_range_indices()
1828  template <typename T>
1830  decltype(std::declval<T>().locally_owned_range_indices());
1831 
1832  template <typename T>
1833  static constexpr bool has_locally_owned_range_indices =
1834  is_supported_operation<locally_owned_range_indices_t, T>;
1835 
1836  // A helper type-trait that leverage SFINAE to figure out if type T has
1837  // void T::initialize_dof_vector(VectorType v)
1838  template <typename T>
1840  decltype(std::declval<T>().initialize_dof_vector(
1841  std::declval<LinearAlgebra::distributed::Vector<Number> &>()));
1842 
1843  template <typename T>
1844  static constexpr bool has_initialize_dof_vector =
1845  is_supported_operation<initialize_dof_vector_t, T>;
1846 
1847  // Used for (Trilinos/PETSc)Wrappers::SparseMatrix
1848  template <typename MatrixType,
1849 #if !defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1900
1850  std::enable_if_t<has_get_mpi_communicator<MatrixType> &&
1851  has_locally_owned_domain_indices<MatrixType>,
1852 #else
1853  // workaround for Intel 18
1854  std::enable_if_t<
1855  is_supported_operation<get_mpi_communicator_t, MatrixType> &&
1857  MatrixType>,
1858 #endif
1859  MatrixType> * = nullptr>
1860  static void
1861  reinit_domain_vector(MatrixType & mat,
1863  bool /*omit_zeroing_entries*/)
1864  {
1865  vec.reinit(mat.locally_owned_domain_indices(),
1866  mat.get_mpi_communicator());
1867  }
1868 
1869  // Used for MatrixFree and DiagonalMatrix
1870  template <typename MatrixType,
1871 #if !defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1900
1872  std::enable_if_t<has_initialize_dof_vector<MatrixType>,
1873 #else
1874  // workaround for Intel 18
1875  std::enable_if_t<
1876  is_supported_operation<initialize_dof_vector_t, MatrixType>,
1877 #endif
1878  MatrixType> * = nullptr>
1879  static void
1880  reinit_domain_vector(MatrixType & mat,
1882  bool omit_zeroing_entries)
1883  {
1884  mat.initialize_dof_vector(vec);
1885  if (!omit_zeroing_entries)
1886  vec = Number();
1887  }
1888 
1889  // Used for (Trilinos/PETSc)Wrappers::SparseMatrix
1890  template <typename MatrixType,
1891 #if !defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1900
1892  std::enable_if_t<has_get_mpi_communicator<MatrixType> &&
1893  has_locally_owned_range_indices<MatrixType>,
1894 #else
1895  // workaround for Intel 18
1896  std::enable_if_t<
1897  is_supported_operation<get_mpi_communicator_t, MatrixType> &&
1898  is_supported_operation<locally_owned_range_indices_t,
1899  MatrixType>,
1900 #endif
1901  MatrixType> * = nullptr>
1902  static void
1903  reinit_range_vector(MatrixType & mat,
1905  bool /*omit_zeroing_entries*/)
1906  {
1907  vec.reinit(mat.locally_owned_range_indices(),
1908  mat.get_mpi_communicator());
1909  }
1910 
1911  // Used for MatrixFree and DiagonalMatrix
1912  template <typename MatrixType,
1913 #if !defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1900
1914  std::enable_if_t<has_initialize_dof_vector<MatrixType>,
1915 #else
1916  // workaround for Intel 18
1917  std::enable_if_t<
1918  is_supported_operation<initialize_dof_vector_t, MatrixType>,
1919 #endif
1920  MatrixType> * = nullptr>
1921  static void
1922  reinit_range_vector(MatrixType & mat,
1924  bool omit_zeroing_entries)
1925  {
1926  mat.initialize_dof_vector(vec);
1927  if (!omit_zeroing_entries)
1928  vec = Number();
1929  }
1930  };
1931 
1932  } // namespace LinearOperatorImplementation
1933 } /* namespace internal */
1934 
1935 
1937 
1938 #endif
value_type operator()(const size_type i) const
std::size_t locally_owned_size() const
types::global_dof_index size_type
Definition: la_vector.h:82
virtual real_type l1_norm() const override
void resize_val(const size_type new_allocated_size, const MPI_Comm &comm_sm=MPI_COMM_SELF)
bool partitioners_are_compatible(const Utilities::MPI::Partitioner &part) const
virtual Vector< Number, MemorySpace > & operator-=(const VectorSpaceVector< Number > &V) override
virtual Vector< Number, MemorySpace > & operator/=(const Number factor) override
void reinit(const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner, const MPI_Comm &comm_sm=MPI_COMM_SELF)
Number & operator[](const size_type global_index)
Number local_element(const size_type local_index) const
Number add_and_dot_local(const Number a, const Vector< Number, MemorySpace > &V, const Vector< Number, MemorySpace > &W)
virtual void add(const Number a, const VectorSpaceVector< Number > &V, const Number b, const VectorSpaceVector< Number > &W) override
mutable ::MemorySpace::MemorySpaceData< Number, MemorySpace > import_data
void swap(Vector< Number, MemorySpace > &v)
virtual real_type linfty_norm() const override
mutable ::MemorySpace::MemorySpaceData< Number, MemorySpace > data
Vector(const IndexSet &local_range, const IndexSet &ghost_indices, const MPI_Comm &communicator)
typename numbers::NumberTraits< Number >::real_type real_type
const_iterator end() const
Number & local_element(const size_type local_index)
Vector(const size_type size)
Vector(Vector< Number, MemorySpace > &&in_vector)
size_type locally_owned_size() const
virtual Vector< Number, MemorySpace > & operator+=(const VectorSpaceVector< Number > &V) override
std::shared_ptr< const Utilities::MPI::Partitioner > partitioner
void add(const size_type n_elements, const size_type *indices, const OtherNumber *values)
virtual void equ(const Number a, const VectorSpaceVector< Number > &V) override
void sadd(const Number s, const Vector< Number, MemorySpace > &V)
Vector(const IndexSet &local_range, const MPI_Comm &communicator)
virtual std::size_t memory_consumption() const override
const std::shared_ptr< const Utilities::MPI::Partitioner > & get_partitioner() const
Number & operator()(const size_type global_index)
Number operator[](const size_type global_index) const
virtual bool all_zero() const override
Vector(const Vector< Number, MemorySpace > &in_vector)
virtual Number mean_value() const override
void set_ghost_state(const bool ghosted) const
void reinit(const IndexSet &local_range, const IndexSet &ghost_indices, const MPI_Comm &communicator)
void add(const std::vector< size_type > &indices, const ::Vector< OtherNumber > &values)
virtual void reinit(const VectorSpaceVector< Number > &V, const bool omit_zeroing_entries=false) override
virtual Number operator*(const VectorSpaceVector< Number > &V) const override
virtual Vector< Number, MemorySpace > & operator=(const Number s) override
virtual void add(const std::vector< size_type > &indices, const std::vector< Number > &values)
virtual void compress(::VectorOperation::values operation) override
void reinit(const Vector< Number2, MemorySpace > &in_vector, const bool omit_zeroing_entries=false)
real_type lp_norm(const real_type p) const
bool partitioners_are_globally_compatible(const Utilities::MPI::Partitioner &part) const
virtual size_type size() const override
const MPI_Comm & get_mpi_communicator() const
void add_local(const Number a, const VectorSpaceVector< Number > &V)
std::shared_ptr<::parallel::internal::TBBPartitioner > thread_loop_partitioner
virtual void sadd(const Number s, const Number a, const VectorSpaceVector< Number > &V) override
void compress_start(const unsigned int communication_channel=0, ::VectorOperation::values operation=VectorOperation::add)
virtual void scale(const VectorSpaceVector< Number > &scaling_factors) override
virtual void print(std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const override
void update_ghost_values_start(const unsigned int communication_channel=0) const
void copy_locally_owned_data_from(const Vector< Number2, MemorySpace > &src)
virtual void add(const Number a, const VectorSpaceVector< Number > &V) override
Vector< Number, MemorySpace > & operator=(const Vector< Number, MemorySpace > &in_vector)
virtual void add(const Number a) override
Number operator()(const size_type global_index) const
real_type lp_norm_local(const real_type p) const
void reinit(const types::global_dof_index local_size, const types::global_dof_index ghost_size, const MPI_Comm &comm, const MPI_Comm &comm_sm=MPI_COMM_SELF)
void sadd_local(const Number s, const Number a, const VectorSpaceVector< Number > &V)
void reinit(const IndexSet &local_range, const MPI_Comm &communicator)
void reinit(const size_type size, const bool omit_zeroing_entries=false)
const std::vector< ArrayView< const Number > > & shared_vector_data() const
Vector< Number, MemorySpace > & operator=(const Vector< Number2, MemorySpace > &in_vector)
void extract_subvector_to(const std::vector< size_type > &indices, std::vector< OtherNumber > &values) const
virtual Vector< Number, MemorySpace > & operator*=(const Number factor) override
void compress_finish(::VectorOperation::values operation)
std::vector< MPI_Request > update_ghost_values_requests
const_iterator begin() const
std::vector< MPI_Request > compress_requests
bool in_local_range(const size_type global_index) const
void extract_subvector_to(ForwardIterator indices_begin, const ForwardIterator indices_end, OutputIterator values_begin) const
Number inner_product_local(const Vector< Number2, MemorySpace > &V) const
virtual Number add_and_dot(const Number a, const VectorSpaceVector< Number > &V, const VectorSpaceVector< Number > &W) override
virtual real_type l2_norm() const override
Vector(const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner)
virtual ::IndexSet locally_owned_elements() const override
Definition: vector.h:109
void swap(LinearAlgebra::distributed::Vector< Number, MemorySpace > &u, LinearAlgebra::distributed::Vector< Number, MemorySpace > &v)
const value_type * const_iterator
Definition: vector.h:132
types::global_dof_index size_type
Definition: vector.h:135
value_type * iterator
Definition: vector.h:131
decltype(std::declval< T >().initialize_dof_vector(std::declval< LinearAlgebra::distributed::Vector< Number > & >())) initialize_dof_vector_t
static void reinit_range_vector(MatrixType &mat, LinearAlgebra::distributed::Vector< Number > &vec, bool)
static void reinit_range_vector(MatrixType &mat, LinearAlgebra::distributed::Vector< Number > &vec, bool omit_zeroing_entries)
static void reinit_domain_vector(MatrixType &mat, LinearAlgebra::distributed::Vector< Number > &vec, bool omit_zeroing_entries)
static void reinit_domain_vector(MatrixType &mat, LinearAlgebra::distributed::Vector< Number > &vec, bool)
#define DEAL_II_DEPRECATED
Definition: config.h:162
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:461
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:462
#define DeclException0(Exception0)
Definition: exceptions.h:464
#define DeclException4(Exception4, type1, type2, type3, type4, outsequence)
Definition: exceptions.h:578
static ::ExceptionBase & ExcVectorTypeNotCompatible()
static ::ExceptionBase & ExcNonMatchingElements(Number arg1, Number arg2, unsigned int arg3)
static ::ExceptionBase & ExcAccessToNonLocalElement(size_type arg1, size_type arg2, size_type arg3, size_type arg4)
#define Assert(cond, exc)
Definition: exceptions.h:1509
static ::ExceptionBase & ExcNotAllowedForCuda()
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:1703
#define AssertIndexRange(index, range)
Definition: exceptions.h:1768
#define DeclException3(Exception3, type1, type2, type3, outsequence)
Definition: exceptions.h:555
static ::ExceptionBase & ExcMessage(std::string arg1)
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)
TrilinosWrappers::types::int_type global_index(const Epetra_BlockMap &map, const ::types::global_dof_index i)
constexpr bool is_supported_operation
bool is_finite(const double x)
Definition: numbers.h:553
unsigned int global_dof_index
Definition: types.h:81
const MPI_Comm & comm