Reference documentation for deal.II version 9.6.0
\(\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\}}\)
Loading...
Searching...
No Matches
la_parallel_vector.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2012 - 2024 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_la_parallel_vector_h
16#define dealii_la_parallel_vector_h
17
18#include <deal.II/base/config.h>
19
28
32
33#include <iomanip>
34#include <memory>
35
37
38// Forward declarations
39#ifndef DOXYGEN
40namespace LinearAlgebra
41{
45 namespace distributed
46 {
47 template <typename>
48 class BlockVector;
49 }
50
51 template <typename>
52 class ReadWriteVector;
53} // namespace LinearAlgebra
54
55# ifdef DEAL_II_WITH_PETSC
56namespace PETScWrappers
57{
58 namespace MPI
59 {
60 class Vector;
61 }
62} // namespace PETScWrappers
63# endif
64
65# ifdef DEAL_II_WITH_TRILINOS
66namespace TrilinosWrappers
67{
68 namespace MPI
69 {
70 class Vector;
71 }
72} // namespace TrilinosWrappers
73# endif
74#endif
75
76namespace LinearAlgebra
77{
78 namespace distributed
79 {
248 template <typename Number, typename MemorySpace = MemorySpace::Host>
249 class Vector : public ::ReadVector<Number>, public Subscriptor
250 {
251 public:
253 using value_type = Number;
255 using const_pointer = const value_type *;
257 using const_iterator = const value_type *;
262
263 static_assert(
264 std::is_same_v<MemorySpace, ::MemorySpace::Host> ||
265 std::is_same_v<MemorySpace, ::MemorySpace::Default>,
266 "MemorySpace should be Host or Default");
267
276
284
292 Vector(Vector<Number, MemorySpace> &&in_vector); // NOLINT
293
299
316 Vector(const IndexSet &local_range,
317 const IndexSet &ghost_indices,
318 const MPI_Comm communicator);
319
323 Vector(const IndexSet &local_range, const MPI_Comm communicator);
324
332 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner);
333
338
343 void
344 reinit(const size_type size, const bool omit_zeroing_entries = false);
345
356 template <typename Number2>
357 void
359 const bool omit_zeroing_entries = false);
360
377 void
378 reinit(const IndexSet &local_range,
379 const IndexSet &ghost_indices,
380 const MPI_Comm communicator);
381
385 void
386 reinit(const IndexSet &local_range, const MPI_Comm communicator);
387
400 void
402 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner,
403 const MPI_Comm comm_sm = MPI_COMM_SELF);
404
411 void
413 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner,
414 const bool make_ghosted,
415 const MPI_Comm &comm_sm = MPI_COMM_SELF);
416
436 void
438 const types::global_dof_index ghost_size,
439 const MPI_Comm comm,
440 const MPI_Comm comm_sm = MPI_COMM_SELF);
441
454 void
456
465
496
508 template <typename Number2>
511
553 void
555
577 void
579
597 void
598 compress_start(const unsigned int communication_channel = 0,
600
619 void
621
639 void
641 const unsigned int communication_channel = 0) const;
642
643
651 void
653
662 void
664
676 bool
678
693 template <typename Number2>
694 void
696
707 template <typename MemorySpace2>
708 void
710 VectorOperation::values operation);
711
715 template <typename MemorySpace2>
718 VectorOperation::values operation)
719 {
720 import_elements(src, operation);
721 }
722
734 operator*=(const Number factor);
735
740 operator/=(const Number factor);
741
747
753
765 void
768 const VectorOperation::values operation,
769 const std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
770 &communication_pattern = {});
771
777 VectorOperation::values operation,
778 std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
779 communication_pattern = {})
780 {
781 import_elements(V, operation, communication_pattern);
782 }
783
787 Number
789
793 void
794 add(const Number a);
795
799 void
800 add(const Number a, const Vector<Number, MemorySpace> &V);
801
805 void
806 add(const Number a,
808 const Number b,
810
815 void
816 add(const std::vector<size_type> &indices,
817 const std::vector<Number> &values);
818
823 void
824 sadd(const Number s,
825 const Number a,
827
833 void
834 scale(const Vector<Number, MemorySpace> &scaling_factors);
835
839 void
840 equ(const Number a, const Vector<Number, MemorySpace> &V);
841
847 l1_norm() const;
848
854 l2_norm() const;
855
860 norm_sqr() const;
861
867 linfty_norm() const;
868
889 Number
890 add_and_dot(const Number a,
893
898 virtual size_type
899 size() const override;
900
914
918 void
919 print(std::ostream &out,
920 const unsigned int precision = 3,
921 const bool scientific = true,
922 const bool across = true) const;
923
927 std::size_t
942 operator=(const Number s);
943
948 template <typename OtherNumber>
949 void
950 add(const std::vector<size_type> &indices,
951 const ::Vector<OtherNumber> &values);
952
957 template <typename OtherNumber>
958 void
959 add(const size_type n_elements,
960 const size_type *indices,
961 const OtherNumber *values);
962
967 void
968 sadd(const Number s, const Vector<Number, MemorySpace> &V);
969
984
989 bool
990 in_local_range(const size_type global_index) const;
991
1002 iterator
1004
1013 begin() const;
1014
1022 iterator
1024
1033 end() const;
1034
1044 Number
1045 operator()(const size_type global_index) const;
1046
1056 Number &
1057 operator()(const size_type global_index);
1058
1066 Number
1067 operator[](const size_type global_index) const;
1075 Number &
1076 operator[](const size_type global_index);
1077
1086 Number
1087 local_element(const size_type local_index) const;
1088
1097 Number &
1098 local_element(const size_type local_index);
1099
1106 Number *
1107 get_values() const;
1108
1126 template <typename OtherNumber>
1127 void
1128 extract_subvector_to(const std::vector<size_type> &indices,
1129 std::vector<OtherNumber> &values) const;
1130
1134 virtual void
1137 ArrayView<Number> &elements) const override;
1138
1166 template <typename ForwardIterator, typename OutputIterator>
1167 void
1168 extract_subvector_to(ForwardIterator indices_begin,
1169 const ForwardIterator indices_end,
1170 OutputIterator values_begin) const;
1176 bool
1177 all_zero() const;
1178
1182 Number
1183 mean_value() const;
1184
1189 real_type
1190 lp_norm(const real_type p) const;
1201 MPI_Comm
1203
1210 const std::shared_ptr<const Utilities::MPI::Partitioner> &
1212
1222 bool
1224 const Utilities::MPI::Partitioner &part) const;
1225
1239 bool
1241 const Utilities::MPI::Partitioner &part) const;
1242
1246 void
1247 set_ghost_state(const bool ghosted) const;
1248
1253 const std::vector<ArrayView<const Number>> &
1255
1264
1269 Number,
1270 Number,
1271 unsigned int,
1272 << "Called compress(VectorOperation::insert), but"
1273 << " the element received from a remote processor, value "
1274 << std::setprecision(16) << arg1
1275 << ", does not match with the value "
1276 << std::setprecision(16) << arg2
1277 << " on the owner processor " << arg3);
1278
1284 size_type,
1285 size_type,
1286 size_type,
1287 size_type,
1288 << "You tried to access element " << arg1
1289 << " of a distributed vector, but this element is not "
1290 << "stored on the current processor. Note: The range of "
1291 << "locally owned elements is [" << arg2 << ',' << arg3
1292 << "], and there are " << arg4 << " ghost elements "
1293 << "that this vector can access."
1294 << "\n\n"
1295 << "A common source for this kind of problem is that you "
1296 << "are passing a 'fully distributed' vector into a function "
1297 << "that needs read access to vector elements that correspond "
1298 << "to degrees of freedom on ghost cells (or at least to "
1299 << "'locally active' degrees of freedom that are not also "
1300 << "'locally owned'). You need to pass a vector that has these "
1301 << "elements as ghost entries.");
1302
1303 private:
1308 void
1309 add_local(const Number a, const Vector<Number, MemorySpace> &V);
1310
1315 void
1316 sadd_local(const Number s,
1317 const Number a,
1319
1323 template <typename Number2>
1324 Number
1326
1330 real_type
1332
1336 Number
1338
1342 real_type
1344
1348 real_type
1349 lp_norm_local(const real_type p) const;
1350
1354 real_type
1356
1362 Number
1363 add_and_dot_local(const Number a,
1366
1372 std::shared_ptr<const Utilities::MPI::Partitioner> partitioner;
1373
1378
1382 mutable ::MemorySpace::MemorySpaceData<Number, MemorySpace> data;
1383
1388 mutable std::shared_ptr<::parallel::internal::TBBPartitioner>
1390
1395 mutable ::MemorySpace::MemorySpaceData<Number, MemorySpace>
1397
1405 mutable bool vector_is_ghosted;
1406
1407#ifdef DEAL_II_WITH_MPI
1416 std::vector<MPI_Request> compress_requests;
1417
1422 mutable std::vector<MPI_Request> update_ghost_values_requests;
1423#endif
1424
1430 mutable std::mutex mutex;
1431
1438
1443 void
1445
1449 void
1450 resize_val(const size_type new_allocated_size,
1451 const MPI_Comm comm_sm = MPI_COMM_SELF);
1452
1453 // Make all other vector types friends.
1454 template <typename Number2, typename MemorySpace2>
1455 friend class Vector;
1456
1457 // Make BlockVector type friends.
1458 template <typename Number2>
1459 friend class BlockVector;
1460 };
1464 /*-------------------- Inline functions ---------------------------------*/
1465
1466#ifndef DOXYGEN
1467
1468 template <typename Number, typename MemorySpace>
1469 inline bool
1471 {
1472 return vector_is_ghosted;
1473 }
1474
1475
1476
1477 template <typename Number, typename MemorySpace>
1480 {
1481 return partitioner->size();
1482 }
1483
1484
1485
1486 template <typename Number, typename MemorySpace>
1489 {
1490 return partitioner->locally_owned_size();
1491 }
1492
1493
1494
1495 template <typename Number, typename MemorySpace>
1496 inline bool
1498 const size_type global_index) const
1499 {
1500 return partitioner->in_local_range(global_index);
1501 }
1502
1503
1504
1505 template <typename Number, typename MemorySpace>
1506 inline IndexSet
1508 {
1509 IndexSet is(size());
1510
1511 is.add_range(partitioner->local_range().first,
1512 partitioner->local_range().second);
1513
1514 return is;
1515 }
1516
1517
1518
1519 template <typename Number, typename MemorySpace>
1522 {
1523 return data.values.data();
1524 }
1525
1526
1527
1528 template <typename Number, typename MemorySpace>
1531 {
1532 return data.values.data();
1533 }
1534
1535
1536
1537 template <typename Number, typename MemorySpace>
1540 {
1541 return data.values.data() + partitioner->locally_owned_size();
1542 }
1543
1544
1545
1546 template <typename Number, typename MemorySpace>
1549 {
1550 return data.values.data() + partitioner->locally_owned_size();
1551 }
1552
1553
1554
1555 template <typename Number, typename MemorySpace>
1556 const std::vector<ArrayView<const Number>> &
1558 {
1559 return data.values_sm;
1560 }
1561
1562
1563
1564 template <typename Number, typename MemorySpace>
1565 inline Number
1566 Vector<Number, MemorySpace>::operator()(const size_type global_index) const
1567 {
1568 Assert((std::is_same_v<MemorySpace, ::MemorySpace::Host>),
1569 ExcMessage(
1570 "This function is only implemented for the Host memory space"));
1571 Assert(
1572 partitioner->in_local_range(global_index) ||
1573 partitioner->ghost_indices().is_element(global_index),
1574 ExcAccessToNonLocalElement(global_index,
1575 partitioner->local_range().first,
1576 partitioner->local_range().second == 0 ?
1577 0 :
1578 (partitioner->local_range().second - 1),
1579 partitioner->ghost_indices().n_elements()));
1580 // do not allow reading a vector which is not in ghost mode
1581 Assert(partitioner->in_local_range(global_index) ||
1582 vector_is_ghosted == true,
1583 ExcMessage("You tried to read a ghost element of this vector, "
1584 "but it has not imported its ghost values."));
1585 return data.values[partitioner->global_to_local(global_index)];
1586 }
1587
1588
1589
1590 template <typename Number, typename MemorySpace>
1591 inline Number &
1592 Vector<Number, MemorySpace>::operator()(const size_type global_index)
1593 {
1594 Assert((std::is_same_v<MemorySpace, ::MemorySpace::Host>),
1595 ExcMessage(
1596 "This function is only implemented for the Host memory space"));
1597 Assert(
1598 partitioner->in_local_range(global_index) ||
1599 partitioner->ghost_indices().is_element(global_index),
1600 ExcAccessToNonLocalElement(global_index,
1601 partitioner->local_range().first,
1602 partitioner->local_range().second == 0 ?
1603 0 :
1604 (partitioner->local_range().second - 1),
1605 partitioner->ghost_indices().n_elements()));
1606 // we would like to prevent reading ghosts from a vector that does not
1607 // have them imported, but this is not possible because we might be in a
1608 // part of the code where the vector has enabled ghosts but is non-const
1609 // (then, the compiler picks this method according to the C++ rule book
1610 // even if a human would pick the const method when this subsequent use
1611 // is just a read)
1612 return data.values[partitioner->global_to_local(global_index)];
1613 }
1614
1615
1616
1617 template <typename Number, typename MemorySpace>
1618 inline Number
1619 Vector<Number, MemorySpace>::operator[](const size_type global_index) const
1620 {
1621 return operator()(global_index);
1622 }
1623
1624
1625
1626 template <typename Number, typename MemorySpace>
1627 inline Number &
1628 Vector<Number, MemorySpace>::operator[](const size_type global_index)
1629 {
1630 return operator()(global_index);
1631 }
1632
1633
1634
1635 template <typename Number, typename MemorySpace>
1636 inline Number
1638 const size_type local_index) const
1639 {
1640 Assert((std::is_same_v<MemorySpace, ::MemorySpace::Host>),
1641 ExcMessage(
1642 "This function is only implemented for the Host memory space"));
1643 AssertIndexRange(local_index,
1644 partitioner->locally_owned_size() +
1645 partitioner->n_ghost_indices());
1646 // do not allow reading a vector which is not in ghost mode
1647 Assert(local_index < locally_owned_size() || vector_is_ghosted == true,
1648 ExcMessage("You tried to read a ghost element of this vector, "
1649 "but it has not imported its ghost values."));
1650
1651 return data.values[local_index];
1652 }
1653
1654
1655
1656 template <typename Number, typename MemorySpace>
1657 inline Number &
1658 Vector<Number, MemorySpace>::local_element(const size_type local_index)
1659 {
1660 Assert((std::is_same_v<MemorySpace, ::MemorySpace::Host>),
1661 ExcMessage(
1662 "This function is only implemented for the Host memory space"));
1663
1664 AssertIndexRange(local_index,
1665 partitioner->locally_owned_size() +
1666 partitioner->n_ghost_indices());
1667
1668 return data.values[local_index];
1669 }
1670
1671
1672
1673 template <typename Number, typename MemorySpace>
1674 inline Number *
1676 {
1677 return data.values.data();
1678 }
1679
1680
1681
1682 template <typename Number, typename MemorySpace>
1683 template <typename OtherNumber>
1684 inline void
1686 const std::vector<size_type> &indices,
1687 std::vector<OtherNumber> &values) const
1688 {
1689 for (size_type i = 0; i < indices.size(); ++i)
1690 values[i] = operator()(indices[i]);
1691 }
1692
1693
1694
1695 template <typename Number, typename MemorySpace>
1696 template <typename ForwardIterator, typename OutputIterator>
1697 inline void
1699 ForwardIterator indices_begin,
1700 const ForwardIterator indices_end,
1701 OutputIterator values_begin) const
1702 {
1703 while (indices_begin != indices_end)
1704 {
1705 *values_begin = operator()(*indices_begin);
1706 ++indices_begin;
1707 ++values_begin;
1708 }
1709 }
1710
1711
1712
1713 template <typename Number, typename MemorySpace>
1714 template <typename OtherNumber>
1715 inline void
1717 const std::vector<size_type> &indices,
1718 const ::Vector<OtherNumber> &values)
1719 {
1720 AssertDimension(indices.size(), values.size());
1721 for (size_type i = 0; i < indices.size(); ++i)
1722 {
1723 Assert(
1724 numbers::is_finite(values[i]),
1725 ExcMessage(
1726 "The given value is not finite but either infinite or Not A Number (NaN)"));
1727 this->operator()(indices[i]) += values(i);
1728 }
1729 }
1730
1731
1732
1733 template <typename Number, typename MemorySpace>
1734 template <typename OtherNumber>
1735 inline void
1736 Vector<Number, MemorySpace>::add(const size_type n_elements,
1737 const size_type *indices,
1738 const OtherNumber *values)
1739 {
1740 for (size_type i = 0; i < n_elements; ++i, ++indices, ++values)
1741 {
1742 Assert(
1743 numbers::is_finite(*values),
1744 ExcMessage(
1745 "The given value is not finite but either infinite or Not A Number (NaN)"));
1746 this->operator()(*indices) += *values;
1747 }
1748 }
1749
1750
1751
1752 template <typename Number, typename MemorySpace>
1753 inline MPI_Comm
1755 {
1756 return partitioner->get_mpi_communicator();
1757 }
1758
1759
1760
1761 template <typename Number, typename MemorySpace>
1762 inline const std::shared_ptr<const Utilities::MPI::Partitioner> &
1764 {
1765 return partitioner;
1766 }
1767
1768
1769
1770 template <typename Number, typename MemorySpace>
1771 inline void
1772 Vector<Number, MemorySpace>::set_ghost_state(const bool ghosted) const
1773 {
1774 vector_is_ghosted = ghosted;
1775 }
1776
1777#endif
1778
1779 } // namespace distributed
1780} // namespace LinearAlgebra
1781
1782
1790template <typename Number, typename MemorySpace>
1791inline void
1797
1798
1802template <typename Number, typename MemorySpace>
1803struct is_serial_vector<LinearAlgebra::distributed::Vector<Number, MemorySpace>>
1804 : std::false_type
1805{};
1806
1807
1808
1809namespace internal
1810{
1811 namespace LinearOperatorImplementation
1812 {
1813 template <typename>
1814 class ReinitHelper;
1815
1820 template <typename Number>
1821 class ReinitHelper<LinearAlgebra::distributed::Vector<Number>>
1822 {
1823 public:
1824 // A helper type-trait that leverage SFINAE to figure out if type T has
1825 // void T::get_mpi_communicator()
1826 template <typename T>
1828 decltype(std::declval<T>().get_mpi_communicator());
1829
1830 template <typename T>
1831 static constexpr bool has_get_mpi_communicator =
1833
1834 // A helper type-trait that leverage SFINAE to figure out if type T has
1835 // void T::locally_owned_domain_indices()
1836 template <typename T>
1838 decltype(std::declval<T>().locally_owned_domain_indices());
1839
1840 template <typename T>
1841 static constexpr bool has_locally_owned_domain_indices =
1843
1844 // A helper type-trait that leverage SFINAE to figure out if type T has
1845 // void T::locally_owned_range_indices()
1846 template <typename T>
1848 decltype(std::declval<T>().locally_owned_range_indices());
1849
1850 template <typename T>
1851 static constexpr bool has_locally_owned_range_indices =
1853
1854 // A helper type-trait that leverage SFINAE to figure out if type T has
1855 // void T::initialize_dof_vector(VectorType v)
1856 template <typename T>
1858 decltype(std::declval<T>().initialize_dof_vector(
1860
1861 template <typename T>
1862 static constexpr bool has_initialize_dof_vector =
1864
1865 // Used for (Trilinos/PETSc)Wrappers::SparseMatrix
1866 template <typename MatrixType,
1867#if !defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1900
1868 std::enable_if_t<has_get_mpi_communicator<MatrixType> &&
1869 has_locally_owned_domain_indices<MatrixType>,
1870#else
1871 // workaround for Intel 18
1872 std::enable_if_t<
1875 MatrixType>,
1876#endif
1877 MatrixType> * = nullptr>
1878 static void
1879 reinit_domain_vector(MatrixType &mat,
1881 bool /*omit_zeroing_entries*/)
1882 {
1883 vec.reinit(mat.locally_owned_domain_indices(),
1884 mat.get_mpi_communicator());
1885 }
1886
1887 // Used for MatrixFree and DiagonalMatrix
1888 template <typename MatrixType,
1889#if !defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1900
1890 std::enable_if_t<has_initialize_dof_vector<MatrixType>,
1891#else
1892 // workaround for Intel 18
1893 std::enable_if_t<
1895#endif
1896 MatrixType> * = nullptr>
1897 static void
1898 reinit_domain_vector(MatrixType &mat,
1900 bool omit_zeroing_entries)
1901 {
1902 mat.initialize_dof_vector(vec);
1903 if (!omit_zeroing_entries)
1904 vec = Number();
1905 }
1906
1907 // Used for (Trilinos/PETSc)Wrappers::SparseMatrix
1908 template <typename MatrixType,
1909#if !defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1900
1910 std::enable_if_t<has_get_mpi_communicator<MatrixType> &&
1911 has_locally_owned_range_indices<MatrixType>,
1912#else
1913 // workaround for Intel 18
1914 std::enable_if_t<
1916 is_supported_operation<locally_owned_range_indices_t,
1917 MatrixType>,
1918#endif
1919 MatrixType> * = nullptr>
1920 static void
1921 reinit_range_vector(MatrixType &mat,
1923 bool /*omit_zeroing_entries*/)
1924 {
1925 vec.reinit(mat.locally_owned_range_indices(),
1926 mat.get_mpi_communicator());
1927 }
1928
1929 // Used for MatrixFree and DiagonalMatrix
1930 template <typename MatrixType,
1931#if !defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1900
1932 std::enable_if_t<has_initialize_dof_vector<MatrixType>,
1933#else
1934 // workaround for Intel 18
1935 std::enable_if_t<
1937#endif
1938 MatrixType> * = nullptr>
1939 static void
1940 reinit_range_vector(MatrixType &mat,
1942 bool omit_zeroing_entries)
1943 {
1944 mat.initialize_dof_vector(vec);
1945 if (!omit_zeroing_entries)
1946 vec = Number();
1947 }
1948 };
1949
1950 } // namespace LinearOperatorImplementation
1951} /* namespace internal */
1952
1953
1955
1956#endif
Number & operator()(const size_type global_index)
bool partitioners_are_compatible(const Utilities::MPI::Partitioner &part) const
void sadd(const Number s, const Number a, const Vector< Number, MemorySpace > &V)
Number local_element(const size_type local_index) const
void reinit(const IndexSet &local_range, const MPI_Comm communicator)
Number add_and_dot_local(const Number a, const Vector< Number, MemorySpace > &V, const Vector< Number, MemorySpace > &W)
void compress_finish(VectorOperation::values operation)
mutable ::MemorySpace::MemorySpaceData< Number, MemorySpace > import_data
mutable ::MemorySpace::MemorySpaceData< Number, MemorySpace > data
void equ(const Number a, const Vector< Number, MemorySpace > &V)
Vector< Number, MemorySpace > & operator=(Vector< Number, MemorySpace > &&in_vector)
void sadd_local(const Number s, const Number a, const Vector< Number, MemorySpace > &V)
typename numbers::NumberTraits< Number >::real_type real_type
const_iterator end() const
Vector(const IndexSet &local_range, const MPI_Comm communicator)
Vector(const size_type size)
Vector(Vector< Number, MemorySpace > &&in_vector)
size_type locally_owned_size() const
void reinit(const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner, const MPI_Comm comm_sm=MPI_COMM_SELF)
std::shared_ptr< const Utilities::MPI::Partitioner > partitioner
void add(const size_type n_elements, const size_type *indices, const OtherNumber *values)
void sadd(const Number s, const Vector< Number, MemorySpace > &V)
Vector< Number, MemorySpace > & operator=(const Vector< Number, MemorySpace > &in_vector)
void reinit(const IndexSet &local_range, const IndexSet &ghost_indices, const MPI_Comm communicator)
void swap(Vector< Number, MemorySpace > &v) noexcept
Number operator[](const size_type global_index) const
Vector(const Vector< Number, MemorySpace > &in_vector)
void add(const Number a, const Vector< Number, MemorySpace > &V)
void set_ghost_state(const bool ghosted) const
void add(const std::vector< size_type > &indices, const std::vector< Number > &values)
::IndexSet locally_owned_elements() const
virtual void extract_subvector_to(const ArrayView< const types::global_dof_index > &indices, ArrayView< Number > &elements) const override
void compress(VectorOperation::values operation)
Vector(const IndexSet &local_range, const IndexSet &ghost_indices, const MPI_Comm communicator)
Vector< Number, MemorySpace > & operator*=(const Number factor)
Vector< Number, MemorySpace > & operator+=(const Vector< Number, MemorySpace > &V)
void add(const std::vector< size_type > &indices, const ::Vector< OtherNumber > &values)
void import_elements(const Vector< Number, MemorySpace2 > &src, VectorOperation::values operation)
Number & operator[](const size_type global_index)
void add(const Number a, const Vector< Number, MemorySpace > &V, const Number b, const Vector< Number, MemorySpace > &W)
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
const std::shared_ptr< const Utilities::MPI::Partitioner > & get_partitioner() const
virtual size_type size() const override
std::shared_ptr<::parallel::internal::TBBPartitioner > thread_loop_partitioner
Number add_and_dot(const Number a, const Vector< Number, MemorySpace > &V, const Vector< Number, MemorySpace > &W)
std::size_t memory_consumption() const
const std::vector< ArrayView< const Number > > & shared_vector_data() const
void update_ghost_values_start(const unsigned int communication_channel=0) const
void import_elements(const LinearAlgebra::ReadWriteVector< Number > &V, const VectorOperation::values operation, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern={})
void copy_locally_owned_data_from(const Vector< Number2, MemorySpace > &src)
Vector< Number, MemorySpace > & operator=(const Vector< Number2, MemorySpace > &in_vector)
Vector< Number, MemorySpace > & operator=(const Number s)
Number operator()(const size_type global_index) const
real_type lp_norm_local(const real_type p) const
Vector< Number, MemorySpace > & operator-=(const Vector< Number, MemorySpace > &V)
void print(std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const
void reinit(const size_type size, const bool omit_zeroing_entries=false)
void extract_subvector_to(const std::vector< size_type > &indices, std::vector< OtherNumber > &values) const
void compress_start(const unsigned int communication_channel=0, VectorOperation::values operation=VectorOperation::add)
std::vector< MPI_Request > update_ghost_values_requests
void scale(const Vector< Number, MemorySpace > &scaling_factors)
const_iterator begin() const
std::vector< MPI_Request > compress_requests
void add_local(const Number a, const Vector< Number, MemorySpace > &V)
Number operator*(const Vector< Number, MemorySpace > &V) const
bool in_local_range(const size_type global_index) const
Vector< Number, MemorySpace > & operator/=(const Number factor)
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
Number & local_element(const size_type local_index)
void reinit(const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner, const bool make_ghosted, const MPI_Comm &comm_sm=MPI_COMM_SELF)
void resize_val(const size_type new_allocated_size, const MPI_Comm comm_sm=MPI_COMM_SELF)
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)
Vector(const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner)
const value_type * const_iterator
Definition vector.h:142
void swap(LinearAlgebra::distributed::Vector< Number, MemorySpace > &u, LinearAlgebra::distributed::Vector< Number, MemorySpace > &v) noexcept
value_type * iterator
Definition vector.h:141
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)
decltype(std::declval< T >().initialize_dof_vector( std::declval< LinearAlgebra::distributed::Vector< Number > & >())) initialize_dof_vector_t
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:207
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:503
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:504
Point< 2 > second
Definition grid_out.cc:4624
static ::ExceptionBase & ExcAccessToNonLocalElement(size_type arg1, size_type arg2, size_type arg3, size_type arg4)
#define DeclException0(Exception0)
Definition exceptions.h:471
#define DeclException4(Exception4, type1, type2, type3, type4, outsequence)
Definition exceptions.h:585
static ::ExceptionBase & ExcVectorTypeNotCompatible()
static ::ExceptionBase & ExcNonMatchingElements(Number arg1, Number arg2, unsigned int arg3)
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
#define DeclException3(Exception3, type1, type2, type3, outsequence)
Definition exceptions.h:562
static ::ExceptionBase & ExcMessage(std::string arg1)
constexpr bool is_supported_operation
bool is_finite(const double x)
Definition numbers.h:538
unsigned int global_dof_index
Definition types.h:81
*braid_SplitCommworld & comm