deal.II version GIT relicensing-1989-gd7a2c90e4e 2024-10-14 01:50:00+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\}}\)
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>,
251 {
252 public:
254 using value_type = Number;
256 using const_pointer = const value_type *;
258 using const_iterator = const value_type *;
263
264 static_assert(
265 std::is_same_v<MemorySpace, ::MemorySpace::Host> ||
266 std::is_same_v<MemorySpace, ::MemorySpace::Default>,
267 "MemorySpace should be Host or Default");
268
277
285
293 Vector(Vector<Number, MemorySpace> &&in_vector); // NOLINT
294
300
317 Vector(const IndexSet &local_range,
318 const IndexSet &ghost_indices,
319 const MPI_Comm communicator);
320
324 Vector(const IndexSet &local_range, const MPI_Comm communicator);
325
333 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner);
334
339
344 void
345 reinit(const size_type size, const bool omit_zeroing_entries = false);
346
357 template <typename Number2>
358 void
360 const bool omit_zeroing_entries = false);
361
378 void
379 reinit(const IndexSet &local_range,
380 const IndexSet &ghost_indices,
381 const MPI_Comm communicator);
382
386 void
387 reinit(const IndexSet &local_range, const MPI_Comm communicator);
388
401 void
403 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner,
404 const MPI_Comm comm_sm = MPI_COMM_SELF);
405
412 void
414 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner,
415 const bool make_ghosted,
416 const MPI_Comm &comm_sm = MPI_COMM_SELF);
417
437 void
439 const types::global_dof_index ghost_size,
440 const MPI_Comm comm,
441 const MPI_Comm comm_sm = MPI_COMM_SELF);
442
455 void
457
466
497
509 template <typename Number2>
512
554 void
556
578 void
580
598 void
599 compress_start(const unsigned int communication_channel = 0,
601
620 void
622
640 void
642 const unsigned int communication_channel = 0) const;
643
644
652 void
654
663 void
665
677 bool
679
694 template <typename Number2>
695 void
697
708 template <typename MemorySpace2>
709 void
711 VectorOperation::values operation);
712
716 template <typename MemorySpace2>
719 VectorOperation::values operation)
720 {
721 import_elements(src, operation);
722 }
723
735 operator*=(const Number factor);
736
741 operator/=(const Number factor);
742
748
754
766 void
769 const VectorOperation::values operation,
770 const std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
771 &communication_pattern = {});
772
778 VectorOperation::values operation,
779 std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
780 communication_pattern = {})
781 {
782 import_elements(V, operation, communication_pattern);
783 }
784
788 Number
790
794 void
795 add(const Number a);
796
800 void
801 add(const Number a, const Vector<Number, MemorySpace> &V);
802
806 void
807 add(const Number a,
809 const Number b,
811
816 void
817 add(const std::vector<size_type> &indices,
818 const std::vector<Number> &values);
819
824 void
825 sadd(const Number s,
826 const Number a,
828
834 void
835 scale(const Vector<Number, MemorySpace> &scaling_factors);
836
840 void
841 equ(const Number a, const Vector<Number, MemorySpace> &V);
842
848 l1_norm() const;
849
855 l2_norm() const;
856
861 norm_sqr() const;
862
868 linfty_norm() const;
869
890 Number
891 add_and_dot(const Number a,
894
899 virtual size_type
900 size() const override;
901
915
919 void
920 print(std::ostream &out,
921 const unsigned int precision = 3,
922 const bool scientific = true,
923 const bool across = true) const;
924
928 std::size_t
943 operator=(const Number s);
944
949 template <typename OtherNumber>
950 void
951 add(const std::vector<size_type> &indices,
952 const ::Vector<OtherNumber> &values);
953
958 template <typename OtherNumber>
959 void
960 add(const size_type n_elements,
961 const size_type *indices,
962 const OtherNumber *values);
963
968 void
969 sadd(const Number s, const Vector<Number, MemorySpace> &V);
970
985
990 bool
991 in_local_range(const size_type global_index) const;
992
1003 iterator
1005
1014 begin() const;
1015
1023 iterator
1025
1034 end() const;
1035
1045 Number
1046 operator()(const size_type global_index) const;
1047
1057 Number &
1058 operator()(const size_type global_index);
1059
1067 Number
1068 operator[](const size_type global_index) const;
1076 Number &
1077 operator[](const size_type global_index);
1078
1087 Number
1088 local_element(const size_type local_index) const;
1089
1098 Number &
1099 local_element(const size_type local_index);
1100
1107 Number *
1108 get_values() const;
1109
1127 template <typename OtherNumber>
1128 void
1129 extract_subvector_to(const std::vector<size_type> &indices,
1130 std::vector<OtherNumber> &values) const;
1131
1135 virtual void
1138 ArrayView<Number> &elements) const override;
1139
1167 template <typename ForwardIterator, typename OutputIterator>
1168 void
1169 extract_subvector_to(ForwardIterator indices_begin,
1170 const ForwardIterator indices_end,
1171 OutputIterator values_begin) const;
1177 bool
1178 all_zero() const;
1179
1183 Number
1184 mean_value() const;
1185
1190 real_type
1191 lp_norm(const real_type p) const;
1202 MPI_Comm
1204
1211 const std::shared_ptr<const Utilities::MPI::Partitioner> &
1213
1223 bool
1225 const Utilities::MPI::Partitioner &part) const;
1226
1240 bool
1242 const Utilities::MPI::Partitioner &part) const;
1243
1247 void
1248 set_ghost_state(const bool ghosted) const;
1249
1254 const std::vector<ArrayView<const Number>> &
1256
1265
1270 Number,
1271 Number,
1272 unsigned int,
1273 << "Called compress(VectorOperation::insert), but"
1274 << " the element received from a remote processor, value "
1275 << std::setprecision(16) << arg1
1276 << ", does not match with the value "
1277 << std::setprecision(16) << arg2
1278 << " on the owner processor " << arg3);
1279
1285 size_type,
1286 size_type,
1287 size_type,
1288 size_type,
1289 << "You tried to access element " << arg1
1290 << " of a distributed vector, but this element is not "
1291 << "stored on the current processor. Note: The range of "
1292 << "locally owned elements is [" << arg2 << ',' << arg3
1293 << "], and there are " << arg4 << " ghost elements "
1294 << "that this vector can access."
1295 << "\n\n"
1296 << "A common source for this kind of problem is that you "
1297 << "are passing a 'fully distributed' vector into a function "
1298 << "that needs read access to vector elements that correspond "
1299 << "to degrees of freedom on ghost cells (or at least to "
1300 << "'locally active' degrees of freedom that are not also "
1301 << "'locally owned'). You need to pass a vector that has these "
1302 << "elements as ghost entries.");
1303
1304 private:
1309 void
1310 add_local(const Number a, const Vector<Number, MemorySpace> &V);
1311
1316 void
1317 sadd_local(const Number s,
1318 const Number a,
1320
1324 template <typename Number2>
1325 Number
1327
1331 real_type
1333
1337 Number
1339
1343 real_type
1345
1349 real_type
1350 lp_norm_local(const real_type p) const;
1351
1355 real_type
1357
1363 Number
1364 add_and_dot_local(const Number a,
1367
1373 std::shared_ptr<const Utilities::MPI::Partitioner> partitioner;
1374
1379
1383 mutable ::MemorySpace::MemorySpaceData<Number, MemorySpace> data;
1384
1389 mutable std::shared_ptr<::parallel::internal::TBBPartitioner>
1391
1396 mutable ::MemorySpace::MemorySpaceData<Number, MemorySpace>
1398
1406 mutable bool vector_is_ghosted;
1407
1408#ifdef DEAL_II_WITH_MPI
1417 std::vector<MPI_Request> compress_requests;
1418
1423 mutable std::vector<MPI_Request> update_ghost_values_requests;
1424#endif
1425
1431 mutable std::mutex mutex;
1432
1439
1444 void
1446
1450 void
1451 resize_val(const size_type new_allocated_size,
1452 const MPI_Comm comm_sm = MPI_COMM_SELF);
1453
1454 // Make all other vector types friends.
1455 template <typename Number2, typename MemorySpace2>
1456 friend class Vector;
1457
1458 // Make BlockVector type friends.
1459 template <typename Number2>
1460 friend class BlockVector;
1461 };
1465 /*-------------------- Inline functions ---------------------------------*/
1466
1467#ifndef DOXYGEN
1468
1469 template <typename Number, typename MemorySpace>
1470 inline bool
1472 {
1473 return vector_is_ghosted;
1474 }
1475
1476
1477
1478 template <typename Number, typename MemorySpace>
1481 {
1482 return partitioner->size();
1483 }
1484
1485
1486
1487 template <typename Number, typename MemorySpace>
1490 {
1491 return partitioner->locally_owned_size();
1492 }
1493
1494
1495
1496 template <typename Number, typename MemorySpace>
1497 inline bool
1499 const size_type global_index) const
1500 {
1501 return partitioner->in_local_range(global_index);
1502 }
1503
1504
1505
1506 template <typename Number, typename MemorySpace>
1507 inline IndexSet
1509 {
1510 IndexSet is(size());
1511
1512 is.add_range(partitioner->local_range().first,
1513 partitioner->local_range().second);
1514
1515 return is;
1516 }
1517
1518
1519
1520 template <typename Number, typename MemorySpace>
1523 {
1524 return data.values.data();
1525 }
1526
1527
1528
1529 template <typename Number, typename MemorySpace>
1532 {
1533 return data.values.data();
1534 }
1535
1536
1537
1538 template <typename Number, typename MemorySpace>
1541 {
1542 return data.values.data() + partitioner->locally_owned_size();
1543 }
1544
1545
1546
1547 template <typename Number, typename MemorySpace>
1550 {
1551 return data.values.data() + partitioner->locally_owned_size();
1552 }
1553
1554
1555
1556 template <typename Number, typename MemorySpace>
1557 const std::vector<ArrayView<const Number>> &
1559 {
1560 return data.values_sm;
1561 }
1562
1563
1564
1565 template <typename Number, typename MemorySpace>
1566 inline Number
1567 Vector<Number, MemorySpace>::operator()(const size_type global_index) const
1568 {
1569 Assert((std::is_same_v<MemorySpace, ::MemorySpace::Host>),
1570 ExcMessage(
1571 "This function is only implemented for the Host memory space"));
1572 Assert(
1573 partitioner->in_local_range(global_index) ||
1574 partitioner->ghost_indices().is_element(global_index),
1575 ExcAccessToNonLocalElement(global_index,
1576 partitioner->local_range().first,
1577 partitioner->local_range().second == 0 ?
1578 0 :
1579 (partitioner->local_range().second - 1),
1580 partitioner->ghost_indices().n_elements()));
1581 // do not allow reading a vector which is not in ghost mode
1582 Assert(partitioner->in_local_range(global_index) ||
1583 vector_is_ghosted == true,
1584 ExcMessage("You tried to read a ghost element of this vector, "
1585 "but it has not imported its ghost values."));
1586 return data.values[partitioner->global_to_local(global_index)];
1587 }
1588
1589
1590
1591 template <typename Number, typename MemorySpace>
1592 inline Number &
1593 Vector<Number, MemorySpace>::operator()(const size_type global_index)
1594 {
1595 Assert((std::is_same_v<MemorySpace, ::MemorySpace::Host>),
1596 ExcMessage(
1597 "This function is only implemented for the Host memory space"));
1598 Assert(
1599 partitioner->in_local_range(global_index) ||
1600 partitioner->ghost_indices().is_element(global_index),
1601 ExcAccessToNonLocalElement(global_index,
1602 partitioner->local_range().first,
1603 partitioner->local_range().second == 0 ?
1604 0 :
1605 (partitioner->local_range().second - 1),
1606 partitioner->ghost_indices().n_elements()));
1607 // we would like to prevent reading ghosts from a vector that does not
1608 // have them imported, but this is not possible because we might be in a
1609 // part of the code where the vector has enabled ghosts but is non-const
1610 // (then, the compiler picks this method according to the C++ rule book
1611 // even if a human would pick the const method when this subsequent use
1612 // is just a read)
1613 return data.values[partitioner->global_to_local(global_index)];
1614 }
1615
1616
1617
1618 template <typename Number, typename MemorySpace>
1619 inline Number
1620 Vector<Number, MemorySpace>::operator[](const size_type global_index) const
1621 {
1622 return operator()(global_index);
1623 }
1624
1625
1626
1627 template <typename Number, typename MemorySpace>
1628 inline Number &
1629 Vector<Number, MemorySpace>::operator[](const size_type global_index)
1630 {
1631 return operator()(global_index);
1632 }
1633
1634
1635
1636 template <typename Number, typename MemorySpace>
1637 inline Number
1639 const size_type local_index) const
1640 {
1641 Assert((std::is_same_v<MemorySpace, ::MemorySpace::Host>),
1642 ExcMessage(
1643 "This function is only implemented for the Host memory space"));
1644 AssertIndexRange(local_index,
1645 partitioner->locally_owned_size() +
1646 partitioner->n_ghost_indices());
1647 // do not allow reading a vector which is not in ghost mode
1648 Assert(local_index < locally_owned_size() || vector_is_ghosted == true,
1649 ExcMessage("You tried to read a ghost element of this vector, "
1650 "but it has not imported its ghost values."));
1651
1652 return data.values[local_index];
1653 }
1654
1655
1656
1657 template <typename Number, typename MemorySpace>
1658 inline Number &
1659 Vector<Number, MemorySpace>::local_element(const size_type local_index)
1660 {
1661 Assert((std::is_same_v<MemorySpace, ::MemorySpace::Host>),
1662 ExcMessage(
1663 "This function is only implemented for the Host memory space"));
1664
1665 AssertIndexRange(local_index,
1666 partitioner->locally_owned_size() +
1667 partitioner->n_ghost_indices());
1668
1669 return data.values[local_index];
1670 }
1671
1672
1673
1674 template <typename Number, typename MemorySpace>
1675 inline Number *
1677 {
1678 return data.values.data();
1679 }
1680
1681
1682
1683 template <typename Number, typename MemorySpace>
1684 template <typename OtherNumber>
1685 inline void
1687 const std::vector<size_type> &indices,
1688 std::vector<OtherNumber> &values) const
1689 {
1690 for (size_type i = 0; i < indices.size(); ++i)
1691 values[i] = operator()(indices[i]);
1692 }
1693
1694
1695
1696 template <typename Number, typename MemorySpace>
1697 template <typename ForwardIterator, typename OutputIterator>
1698 inline void
1700 ForwardIterator indices_begin,
1701 const ForwardIterator indices_end,
1702 OutputIterator values_begin) const
1703 {
1704 while (indices_begin != indices_end)
1705 {
1706 *values_begin = operator()(*indices_begin);
1707 ++indices_begin;
1708 ++values_begin;
1709 }
1710 }
1711
1712
1713
1714 template <typename Number, typename MemorySpace>
1715 template <typename OtherNumber>
1716 inline void
1718 const std::vector<size_type> &indices,
1719 const ::Vector<OtherNumber> &values)
1720 {
1721 AssertDimension(indices.size(), values.size());
1722 for (size_type i = 0; i < indices.size(); ++i)
1723 {
1724 Assert(
1725 numbers::is_finite(values[i]),
1726 ExcMessage(
1727 "The given value is not finite but either infinite or Not A Number (NaN)"));
1728 this->operator()(indices[i]) += values(i);
1729 }
1730 }
1731
1732
1733
1734 template <typename Number, typename MemorySpace>
1735 template <typename OtherNumber>
1736 inline void
1737 Vector<Number, MemorySpace>::add(const size_type n_elements,
1738 const size_type *indices,
1739 const OtherNumber *values)
1740 {
1741 for (size_type i = 0; i < n_elements; ++i, ++indices, ++values)
1742 {
1743 Assert(
1744 numbers::is_finite(*values),
1745 ExcMessage(
1746 "The given value is not finite but either infinite or Not A Number (NaN)"));
1747 this->operator()(*indices) += *values;
1748 }
1749 }
1750
1751
1752
1753 template <typename Number, typename MemorySpace>
1754 inline MPI_Comm
1756 {
1757 return partitioner->get_mpi_communicator();
1758 }
1759
1760
1761
1762 template <typename Number, typename MemorySpace>
1763 inline const std::shared_ptr<const Utilities::MPI::Partitioner> &
1765 {
1766 return partitioner;
1767 }
1768
1769
1770
1771 template <typename Number, typename MemorySpace>
1772 inline void
1773 Vector<Number, MemorySpace>::set_ghost_state(const bool ghosted) const
1774 {
1775 vector_is_ghosted = ghosted;
1776 }
1777
1778#endif
1779
1780 } // namespace distributed
1781} // namespace LinearAlgebra
1782
1783
1791template <typename Number, typename MemorySpace>
1792inline void
1798
1799
1803template <typename Number, typename MemorySpace>
1804struct is_serial_vector<LinearAlgebra::distributed::Vector<Number, MemorySpace>>
1805 : std::false_type
1806{};
1807
1808
1809
1810namespace internal
1811{
1812 namespace LinearOperatorImplementation
1813 {
1814 template <typename>
1815 class ReinitHelper;
1816
1821 template <typename Number>
1822 class ReinitHelper<LinearAlgebra::distributed::Vector<Number>>
1823 {
1824 public:
1825 // A helper type-trait that leverage SFINAE to figure out if type T has
1826 // void T::get_mpi_communicator()
1827 template <typename T>
1829 decltype(std::declval<T>().get_mpi_communicator());
1830
1831 template <typename T>
1832 static constexpr bool has_get_mpi_communicator =
1833 is_supported_operation<get_mpi_communicator_t, T>;
1834
1835 // A helper type-trait that leverage SFINAE to figure out if type T has
1836 // void T::locally_owned_domain_indices()
1837 template <typename T>
1839 decltype(std::declval<T>().locally_owned_domain_indices());
1840
1841 template <typename T>
1842 static constexpr bool has_locally_owned_domain_indices =
1843 is_supported_operation<locally_owned_domain_indices_t, T>;
1844
1845 // A helper type-trait that leverage SFINAE to figure out if type T has
1846 // void T::locally_owned_range_indices()
1847 template <typename T>
1849 decltype(std::declval<T>().locally_owned_range_indices());
1850
1851 template <typename T>
1852 static constexpr bool has_locally_owned_range_indices =
1853 is_supported_operation<locally_owned_range_indices_t, T>;
1854
1855 // A helper type-trait that leverage SFINAE to figure out if type T has
1856 // void T::initialize_dof_vector(VectorType v)
1857 template <typename T>
1859 decltype(std::declval<T>().initialize_dof_vector(
1861
1862 template <typename T>
1863 static constexpr bool has_initialize_dof_vector =
1864 is_supported_operation<initialize_dof_vector_t, T>;
1865
1866 // Used for (Trilinos/PETSc)Wrappers::SparseMatrix
1867 template <typename MatrixType,
1868#if !defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1900
1869 std::enable_if_t<has_get_mpi_communicator<MatrixType> &&
1870 has_locally_owned_domain_indices<MatrixType>,
1871#else
1872 // workaround for Intel 18
1873 std::enable_if_t<
1874 is_supported_operation<get_mpi_communicator_t, MatrixType> &&
1876 MatrixType>,
1877#endif
1878 MatrixType> * = nullptr>
1879 static void
1880 reinit_domain_vector(MatrixType &mat,
1882 bool /*omit_zeroing_entries*/)
1883 {
1884 vec.reinit(mat.locally_owned_domain_indices(),
1885 mat.get_mpi_communicator());
1886 }
1887
1888 // Used for MatrixFree and DiagonalMatrix
1889 template <typename MatrixType,
1890#if !defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1900
1891 std::enable_if_t<has_initialize_dof_vector<MatrixType>,
1892#else
1893 // workaround for Intel 18
1894 std::enable_if_t<
1895 is_supported_operation<initialize_dof_vector_t, MatrixType>,
1896#endif
1897 MatrixType> * = nullptr>
1898 static void
1899 reinit_domain_vector(MatrixType &mat,
1901 bool omit_zeroing_entries)
1902 {
1903 mat.initialize_dof_vector(vec);
1904 if (!omit_zeroing_entries)
1905 vec = Number();
1906 }
1907
1908 // Used for (Trilinos/PETSc)Wrappers::SparseMatrix
1909 template <typename MatrixType,
1910#if !defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1900
1911 std::enable_if_t<has_get_mpi_communicator<MatrixType> &&
1912 has_locally_owned_range_indices<MatrixType>,
1913#else
1914 // workaround for Intel 18
1915 std::enable_if_t<
1916 is_supported_operation<get_mpi_communicator_t, MatrixType> &&
1917 is_supported_operation<locally_owned_range_indices_t,
1918 MatrixType>,
1919#endif
1920 MatrixType> * = nullptr>
1921 static void
1922 reinit_range_vector(MatrixType &mat,
1924 bool /*omit_zeroing_entries*/)
1925 {
1926 vec.reinit(mat.locally_owned_range_indices(),
1927 mat.get_mpi_communicator());
1928 }
1929
1930 // Used for MatrixFree and DiagonalMatrix
1931 template <typename MatrixType,
1932#if !defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1900
1933 std::enable_if_t<has_initialize_dof_vector<MatrixType>,
1934#else
1935 // workaround for Intel 18
1936 std::enable_if_t<
1937 is_supported_operation<initialize_dof_vector_t, MatrixType>,
1938#endif
1939 MatrixType> * = nullptr>
1940 static void
1941 reinit_range_vector(MatrixType &mat,
1943 bool omit_zeroing_entries)
1944 {
1945 mat.initialize_dof_vector(vec);
1946 if (!omit_zeroing_entries)
1947 vec = Number();
1948 }
1949 };
1950
1951 } // namespace LinearOperatorImplementation
1952} /* namespace internal */
1953
1954
1956
1957#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
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:205
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:498
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:499
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:466
#define DeclException4(Exception4, type1, type2, type3, type4, outsequence)
Definition exceptions.h:580
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:557
static ::ExceptionBase & ExcMessage(std::string arg1)
constexpr bool is_supported_operation
bool is_finite(const double x)
Definition numbers.h:533
unsigned int global_dof_index
Definition types.h:81
*braid_SplitCommworld & comm