deal.II version 9.7.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 - 2025 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
36#if defined(DEAL_II_WITH_MPI)
38# include <mpi.h>
40#endif
41
42
44
45// Forward declarations
46#ifndef DOXYGEN
47namespace LinearAlgebra
48{
52 namespace distributed
53 {
54 template <typename, typename>
55 class BlockVector;
56 }
57
58 template <typename>
59 class ReadWriteVector;
60} // namespace LinearAlgebra
61
62# ifdef DEAL_II_WITH_PETSC
63namespace PETScWrappers
64{
65 namespace MPI
66 {
67 class Vector;
68 }
69} // namespace PETScWrappers
70# endif
71
72# ifdef DEAL_II_WITH_TRILINOS
73namespace TrilinosWrappers
74{
75 namespace MPI
76 {
77 class Vector;
78 }
79} // namespace TrilinosWrappers
80# endif
81#endif
82
83namespace LinearAlgebra
84{
85 namespace distributed
86 {
91
255 template <typename Number, typename MemorySpace = MemorySpace::Host>
256 class Vector : public ::ReadVector<Number>
257 {
258 public:
260 using value_type = Number;
262 using const_pointer = const value_type *;
264 using const_iterator = const value_type *;
269
270 static_assert(
271 std::is_same_v<MemorySpace, ::MemorySpace::Host> ||
272 std::is_same_v<MemorySpace, ::MemorySpace::Default>,
273 "MemorySpace should be Host or Default");
274
275 static_assert(
276 (!std::is_same_v<MemorySpace, ::MemorySpace::Default>) ||
277 std::is_same_v<Number, float> || std::is_same_v<Number, double>,
278 "Number should be float or double for Default memory space");
279
288
296
304 Vector(Vector<Number, MemorySpace> &&in_vector); // NOLINT
305
311
328 Vector(const IndexSet &local_range,
329 const IndexSet &ghost_indices,
330 const MPI_Comm communicator);
331
335 Vector(const IndexSet &local_range, const MPI_Comm communicator);
336
344 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner);
345
350
355 void
356 reinit(const size_type size, const bool omit_zeroing_entries = false);
357
368 template <typename Number2>
369 void
371 const bool omit_zeroing_entries = false);
372
389 void
390 reinit(const IndexSet &local_range,
391 const IndexSet &ghost_indices,
392 const MPI_Comm communicator);
393
397 void
398 reinit(const IndexSet &local_range, const MPI_Comm communicator);
399
412 void
414 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner,
415 const MPI_Comm comm_sm = MPI_COMM_SELF);
416
423 void
425 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner,
426 const bool make_ghosted,
427 const MPI_Comm &comm_sm = MPI_COMM_SELF);
428
448 void
450 const types::global_dof_index ghost_size,
451 const MPI_Comm comm,
452 const MPI_Comm comm_sm = MPI_COMM_SELF);
453
466 void
468
477
508
520 template <typename Number2>
523
525
565 void
567
589 void
591
609 void
610 compress_start(const unsigned int communication_channel = 0,
612
631 void
633
651 void
653 const unsigned int communication_channel = 0) const;
654
655
663 void
665
674 void
676
688 bool
690
705 template <typename Number2>
706 void
708
719 template <typename MemorySpace2>
720 void
722 VectorOperation::values operation);
723
727 template <typename MemorySpace2>
730 VectorOperation::values operation)
731 {
732 import_elements(src, operation);
733 }
734
736
741
746 operator*=(const Number factor);
747
752 operator/=(const Number factor);
753
759
765
777 void
780 const VectorOperation::values operation,
781 const std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
782 &communication_pattern = {});
783
789 VectorOperation::values operation,
790 std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
791 communication_pattern = {})
792 {
793 import_elements(V, operation, communication_pattern);
794 }
795
799 Number
801
805 void
806 add(const Number a);
807
811 void
812 add(const Number a, const Vector<Number, MemorySpace> &V);
813
817 void
818 add(const Number a,
820 const Number b,
822
827 void
828 add(const std::vector<size_type> &indices,
829 const std::vector<Number> &values);
830
835 void
836 sadd(const Number s,
837 const Number a,
839
845 void
846 scale(const Vector<Number, MemorySpace> &scaling_factors);
847
851 void
852 equ(const Number a, const Vector<Number, MemorySpace> &V);
853
859 l1_norm() const;
860
866 l2_norm() const;
867
872 norm_sqr() const;
873
879 linfty_norm() const;
880
901 Number
902 add_and_dot(const Number a,
905
910 virtual size_type
911 size() const override;
912
926
930 void
931 print(std::ostream &out,
932 const unsigned int precision = 3,
933 const bool scientific = true,
934 const bool across = true) const;
935
939 std::size_t
942
947
954 operator=(const Number s);
955
960 template <typename OtherNumber>
961 void
962 add(const std::vector<size_type> &indices,
963 const ::Vector<OtherNumber> &values);
964
969 template <typename OtherNumber>
970 void
971 add(const size_type n_elements,
972 const size_type *indices,
973 const OtherNumber *values);
974
979 void
980 sadd(const Number s, const Vector<Number, MemorySpace> &V);
981
983
984
989
996
1001 bool
1002 in_local_range(const size_type global_index) const;
1003
1014 iterator
1016
1025 begin() const;
1026
1034 iterator
1036
1045 end() const;
1046
1056 Number
1057 operator()(const size_type global_index) const;
1058
1068 Number &
1069 operator()(const size_type global_index);
1070
1078 Number
1079 operator[](const size_type global_index) const;
1087 Number &
1088 operator[](const size_type global_index);
1089
1098 Number
1099 local_element(const size_type local_index) const;
1100
1109 Number &
1110 local_element(const size_type local_index);
1111
1118 Number *
1119 get_values() const;
1120
1138 template <typename OtherNumber>
1139 void
1140 extract_subvector_to(const std::vector<size_type> &indices,
1141 std::vector<OtherNumber> &values) const;
1142
1146 virtual void
1149 const ArrayView<Number> &elements) const override;
1150
1178 template <typename ForwardIterator, typename OutputIterator>
1179 void
1180 extract_subvector_to(ForwardIterator indices_begin,
1181 const ForwardIterator indices_end,
1182 OutputIterator values_begin) const;
1188 bool
1189 all_zero() const;
1190
1194 Number
1195 mean_value() const;
1196
1201 real_type
1202 lp_norm(const real_type p) const;
1204
1209
1213 MPI_Comm
1215
1222 const std::shared_ptr<const Utilities::MPI::Partitioner> &
1224
1234 bool
1236 const Utilities::MPI::Partitioner &part) const;
1237
1251 bool
1253 const Utilities::MPI::Partitioner &part) const;
1254
1258 void
1259 set_ghost_state(const bool ghosted) const;
1260
1265 const std::vector<ArrayView<const Number>> &
1267
1269
1276
1281 Number,
1282 Number,
1283 unsigned int,
1284 << "Called compress(VectorOperation::insert), but"
1285 << " the element received from a remote processor, value "
1286 << std::setprecision(16) << arg1
1287 << ", does not match with the value "
1288 << std::setprecision(16) << arg2
1289 << " on the owner processor " << arg3);
1290
1296 size_type,
1297 size_type,
1298 size_type,
1299 size_type,
1300 << "You tried to access element " << arg1
1301 << " of a distributed vector, but this element is not "
1302 << "stored on the current processor. Note: The range of "
1303 << "locally owned elements is [" << arg2 << ',' << arg3
1304 << "], and there are " << arg4 << " ghost elements "
1305 << "that this vector can access."
1306 << "\n\n"
1307 << "A common source for this kind of problem is that you "
1308 << "are passing a 'fully distributed' vector into a function "
1309 << "that needs read access to vector elements that correspond "
1310 << "to degrees of freedom on ghost cells (or at least to "
1311 << "'locally active' degrees of freedom that are not also "
1312 << "'locally owned'). You need to pass a vector that has these "
1313 << "elements as ghost entries.");
1314
1315 private:
1320 void
1321 add_local(const Number a, const Vector<Number, MemorySpace> &V);
1322
1327 void
1328 sadd_local(const Number s,
1329 const Number a,
1331
1335 template <typename Number2>
1336 Number
1338
1342 real_type
1344
1348 Number
1350
1354 real_type
1356
1360 real_type
1361 lp_norm_local(const real_type p) const;
1362
1366 real_type
1368
1374 Number
1375 add_and_dot_local(const Number a,
1378
1386 void
1388
1394 std::shared_ptr<const Utilities::MPI::Partitioner> partitioner;
1395
1400
1404 mutable ::MemorySpace::MemorySpaceData<Number, MemorySpace> data;
1405
1410 mutable std::shared_ptr<::parallel::internal::TBBPartitioner>
1412
1417 mutable ::MemorySpace::MemorySpaceData<Number, MemorySpace>
1419
1427 mutable bool vector_is_ghosted;
1428
1429#ifdef DEAL_II_WITH_MPI
1438 std::vector<MPI_Request> compress_requests;
1439
1444 mutable std::vector<MPI_Request> update_ghost_values_requests;
1445#endif
1446
1452 mutable std::mutex mutex;
1453
1460
1465 void
1467
1471 void
1472 resize_val(const size_type new_allocated_size,
1473 const MPI_Comm comm_sm = MPI_COMM_SELF);
1474
1475 // Make all other vector types friends.
1476 template <typename Number2, typename MemorySpace2>
1477 friend class Vector;
1478
1479 // Make BlockVector type friends.
1480 template <typename Number2, typename MemorySpace2>
1481 friend class BlockVector;
1482 };
1483
1484
1485
1486 /*-------------------- Inline functions ---------------------------------*/
1487
1488#ifndef DOXYGEN
1489
1490 template <typename Number, typename MemorySpace>
1491 inline bool
1493 {
1494 return vector_is_ghosted;
1495 }
1496
1497
1498
1499 template <typename Number, typename MemorySpace>
1502 {
1503 return partitioner->size();
1504 }
1505
1506
1507
1508 template <typename Number, typename MemorySpace>
1511 {
1512 return partitioner->locally_owned_size();
1513 }
1514
1515
1516
1517 template <typename Number, typename MemorySpace>
1518 inline bool
1520 const size_type global_index) const
1521 {
1522 return partitioner->in_local_range(global_index);
1523 }
1524
1525
1526
1527 template <typename Number, typename MemorySpace>
1528 inline IndexSet
1530 {
1531 IndexSet is(size());
1532
1533 is.add_range(partitioner->local_range().first,
1534 partitioner->local_range().second);
1535
1536 return is;
1537 }
1538
1539
1540
1541 template <typename Number, typename MemorySpace>
1544 {
1545 return data.values.data();
1546 }
1547
1548
1549
1550 template <typename Number, typename MemorySpace>
1553 {
1554 return data.values.data();
1555 }
1556
1557
1558
1559 template <typename Number, typename MemorySpace>
1562 {
1563 return data.values.data() + partitioner->locally_owned_size();
1564 }
1565
1566
1567
1568 template <typename Number, typename MemorySpace>
1571 {
1572 return data.values.data() + partitioner->locally_owned_size();
1573 }
1574
1575
1576
1577 template <typename Number, typename MemorySpace>
1578 const std::vector<ArrayView<const Number>> &
1580 {
1581 return data.values_sm;
1582 }
1583
1584
1585
1586 template <typename Number, typename MemorySpace>
1587 inline Number
1588 Vector<Number, MemorySpace>::operator()(const size_type global_index) const
1589 {
1590 Assert((std::is_same_v<MemorySpace, ::MemorySpace::Host>),
1591 ExcMessage(
1592 "This function is only implemented for the Host memory space"));
1593 Assert(
1594 partitioner->in_local_range(global_index) ||
1595 partitioner->ghost_indices().is_element(global_index),
1596 ExcAccessToNonLocalElement(global_index,
1597 partitioner->local_range().first,
1598 partitioner->local_range().second == 0 ?
1599 0 :
1600 (partitioner->local_range().second - 1),
1601 partitioner->ghost_indices().n_elements()));
1602 // do not allow reading a vector which is not in ghost mode
1603 Assert(partitioner->in_local_range(global_index) ||
1604 vector_is_ghosted == true,
1605 ExcMessage("You tried to read a ghost element of this vector, "
1606 "but it has not imported its ghost values."));
1607 return data.values[partitioner->global_to_local(global_index)];
1608 }
1609
1610
1611
1612 template <typename Number, typename MemorySpace>
1613 inline Number &
1614 Vector<Number, MemorySpace>::operator()(const size_type global_index)
1615 {
1616 Assert((std::is_same_v<MemorySpace, ::MemorySpace::Host>),
1617 ExcMessage(
1618 "This function is only implemented for the Host memory space"));
1619 Assert(
1620 partitioner->in_local_range(global_index) ||
1621 partitioner->ghost_indices().is_element(global_index),
1622 ExcAccessToNonLocalElement(global_index,
1623 partitioner->local_range().first,
1624 partitioner->local_range().second == 0 ?
1625 0 :
1626 (partitioner->local_range().second - 1),
1627 partitioner->ghost_indices().n_elements()));
1628 // we would like to prevent reading ghosts from a vector that does not
1629 // have them imported, but this is not possible because we might be in a
1630 // part of the code where the vector has enabled ghosts but is non-const
1631 // (then, the compiler picks this method according to the C++ rule book
1632 // even if a human would pick the const method when this subsequent use
1633 // is just a read)
1634 return data.values[partitioner->global_to_local(global_index)];
1635 }
1636
1637
1638
1639 template <typename Number, typename MemorySpace>
1640 inline Number
1641 Vector<Number, MemorySpace>::operator[](const size_type global_index) const
1642 {
1643 return operator()(global_index);
1644 }
1645
1646
1647
1648 template <typename Number, typename MemorySpace>
1649 inline Number &
1650 Vector<Number, MemorySpace>::operator[](const size_type global_index)
1651 {
1652 return operator()(global_index);
1653 }
1654
1655
1656
1657 template <typename Number, typename MemorySpace>
1658 inline Number
1660 const size_type local_index) const
1661 {
1662 Assert((std::is_same_v<MemorySpace, ::MemorySpace::Host>),
1663 ExcMessage(
1664 "This function is only implemented for the Host memory space"));
1665 AssertIndexRange(local_index,
1666 partitioner->locally_owned_size() +
1667 partitioner->n_ghost_indices());
1668 // do not allow reading a vector which is not in ghost mode
1669 Assert(local_index < locally_owned_size() || vector_is_ghosted == true,
1670 ExcMessage("You tried to read a ghost element of this vector, "
1671 "but it has not imported its ghost values."));
1672
1673 return data.values[local_index];
1674 }
1675
1676
1677
1678 template <typename Number, typename MemorySpace>
1679 inline Number &
1680 Vector<Number, MemorySpace>::local_element(const size_type local_index)
1681 {
1682 Assert((std::is_same_v<MemorySpace, ::MemorySpace::Host>),
1683 ExcMessage(
1684 "This function is only implemented for the Host memory space"));
1685
1686 AssertIndexRange(local_index,
1687 partitioner->locally_owned_size() +
1688 partitioner->n_ghost_indices());
1689
1690 return data.values[local_index];
1691 }
1692
1693
1694
1695 template <typename Number, typename MemorySpace>
1696 inline Number *
1698 {
1699 return data.values.data();
1700 }
1701
1702
1703
1704 template <typename Number, typename MemorySpace>
1705 template <typename OtherNumber>
1706 inline void
1708 const std::vector<size_type> &indices,
1709 std::vector<OtherNumber> &values) const
1710 {
1711 for (size_type i = 0; i < indices.size(); ++i)
1712 values[i] = operator()(indices[i]);
1713 }
1714
1715
1716
1717 template <typename Number, typename MemorySpace>
1718 template <typename ForwardIterator, typename OutputIterator>
1719 inline void
1721 ForwardIterator indices_begin,
1722 const ForwardIterator indices_end,
1723 OutputIterator values_begin) const
1724 {
1725 while (indices_begin != indices_end)
1726 {
1727 *values_begin = operator()(*indices_begin);
1728 ++indices_begin;
1729 ++values_begin;
1730 }
1731 }
1732
1733
1734
1735 template <typename Number, typename MemorySpace>
1736 template <typename OtherNumber>
1737 inline void
1739 const std::vector<size_type> &indices,
1740 const ::Vector<OtherNumber> &values)
1741 {
1742 AssertDimension(indices.size(), values.size());
1743 for (size_type i = 0; i < indices.size(); ++i)
1744 {
1745 Assert(
1746 numbers::is_finite(values[i]),
1747 ExcMessage(
1748 "The given value is not finite but either infinite or Not A Number (NaN)"));
1749 this->operator()(indices[i]) += values(i);
1750 }
1751 }
1752
1753
1754
1755 template <typename Number, typename MemorySpace>
1756 template <typename OtherNumber>
1757 inline void
1758 Vector<Number, MemorySpace>::add(const size_type n_elements,
1759 const size_type *indices,
1760 const OtherNumber *values)
1761 {
1762 for (size_type i = 0; i < n_elements; ++i, ++indices, ++values)
1763 {
1764 Assert(
1765 numbers::is_finite(*values),
1766 ExcMessage(
1767 "The given value is not finite but either infinite or Not A Number (NaN)"));
1768 this->operator()(*indices) += *values;
1769 }
1770 }
1771
1772
1773
1774 template <typename Number, typename MemorySpace>
1775 inline MPI_Comm
1777 {
1778 return partitioner->get_mpi_communicator();
1779 }
1780
1781
1782
1783 template <typename Number, typename MemorySpace>
1784 inline const std::shared_ptr<const Utilities::MPI::Partitioner> &
1786 {
1787 return partitioner;
1788 }
1789
1790
1791
1792 template <typename Number, typename MemorySpace>
1793 inline void
1794 Vector<Number, MemorySpace>::set_ghost_state(const bool ghosted) const
1795 {
1796 vector_is_ghosted = ghosted;
1797 }
1798
1799#endif
1800
1801 } // namespace distributed
1802} // namespace LinearAlgebra
1803
1804
1812template <typename Number, typename MemorySpace>
1813inline void
1819
1820
1824template <typename Number, typename MemorySpace>
1825struct is_serial_vector<LinearAlgebra::distributed::Vector<Number, MemorySpace>>
1826 : std::false_type
1827{};
1828
1829
1830
1831namespace internal
1832{
1833 namespace LinearOperatorImplementation
1834 {
1835 template <typename>
1836 class ReinitHelper;
1837
1842 template <typename Number>
1843 class ReinitHelper<LinearAlgebra::distributed::Vector<Number>>
1844 {
1845 public:
1846 // A helper type-trait that leverage SFINAE to figure out if type T has
1847 // void T::get_mpi_communicator()
1848 template <typename T>
1850 decltype(std::declval<T>().get_mpi_communicator());
1851
1852 template <typename T>
1853 static constexpr bool has_get_mpi_communicator =
1855
1856 // A helper type-trait that leverage SFINAE to figure out if type T has
1857 // void T::locally_owned_domain_indices()
1858 template <typename T>
1860 decltype(std::declval<T>().locally_owned_domain_indices());
1861
1862 template <typename T>
1863 static constexpr bool has_locally_owned_domain_indices =
1865
1866 // A helper type-trait that leverage SFINAE to figure out if type T has
1867 // void T::locally_owned_range_indices()
1868 template <typename T>
1870 decltype(std::declval<T>().locally_owned_range_indices());
1871
1872 template <typename T>
1873 static constexpr bool has_locally_owned_range_indices =
1875
1876 // A helper type-trait that leverage SFINAE to figure out if type T has
1877 // void T::initialize_dof_vector(VectorType v)
1878 template <typename T>
1880 decltype(std::declval<T>().initialize_dof_vector(
1882
1883 template <typename T>
1884 static constexpr bool has_initialize_dof_vector =
1886
1887 // Used for (Trilinos/PETSc)Wrappers::SparseMatrix
1888 template <typename MatrixType,
1889#if !defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1900
1890 std::enable_if_t<has_get_mpi_communicator<MatrixType> &&
1892#else
1893 // workaround for Intel 18
1894 std::enable_if_t<
1897 MatrixType>,
1898#endif
1899 MatrixType> * = nullptr>
1900 static void
1901 reinit_domain_vector(MatrixType &mat,
1903 bool /*omit_zeroing_entries*/)
1904 {
1905 vec.reinit(mat.locally_owned_domain_indices(),
1906 mat.get_mpi_communicator());
1907 }
1908
1909 // Used for MatrixFree and DiagonalMatrix
1910 template <typename MatrixType,
1911#if !defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1900
1912 std::enable_if_t<has_initialize_dof_vector<MatrixType>,
1913#else
1914 // workaround for Intel 18
1915 std::enable_if_t<
1917#endif
1918 MatrixType> * = nullptr>
1919 static void
1920 reinit_domain_vector(MatrixType &mat,
1922 bool omit_zeroing_entries)
1923 {
1924 mat.initialize_dof_vector(vec);
1925 if (!omit_zeroing_entries)
1926 vec = Number();
1927 }
1928
1929 // Used for (Trilinos/PETSc)Wrappers::SparseMatrix
1930 template <typename MatrixType,
1931#if !defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1900
1932 std::enable_if_t<has_get_mpi_communicator<MatrixType> &&
1933 has_locally_owned_range_indices<MatrixType>,
1934#else
1935 // workaround for Intel 18
1936 std::enable_if_t<
1938 is_supported_operation<locally_owned_range_indices_t,
1939 MatrixType>,
1940#endif
1941 MatrixType> * = nullptr>
1942 static void
1943 reinit_range_vector(MatrixType &mat,
1945 bool /*omit_zeroing_entries*/)
1946 {
1947 vec.reinit(mat.locally_owned_range_indices(),
1948 mat.get_mpi_communicator());
1949 }
1950
1951 // Used for MatrixFree and DiagonalMatrix
1952 template <typename MatrixType,
1953#if !defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1900
1954 std::enable_if_t<has_initialize_dof_vector<MatrixType>,
1955#else
1956 // workaround for Intel 18
1957 std::enable_if_t<
1959#endif
1960 MatrixType> * = nullptr>
1961 static void
1962 reinit_range_vector(MatrixType &mat,
1964 bool omit_zeroing_entries)
1965 {
1966 mat.initialize_dof_vector(vec);
1967 if (!omit_zeroing_entries)
1968 vec = Number();
1969 }
1970 };
1971
1972 } // namespace LinearOperatorImplementation
1973} /* namespace internal */
1974
1975
1977
1978#endif
Number & operator()(const size_type global_index)
void assert_no_residual_content_in_ghost_region() const
virtual void extract_subvector_to(const ArrayView< const types::global_dof_index > &indices, const ArrayView< Number > &elements) const override
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
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
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)
void scale(const Vector< Number, MemorySpace > &scaling_factors)
const_iterator begin() const
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)
types::global_dof_index size_type
Definition vector.h:144
void swap(LinearAlgebra::distributed::Vector< Number, MemorySpace > &u, LinearAlgebra::distributed::Vector< Number, MemorySpace > &v) noexcept
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:286
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:40
#define DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
Definition config.h:603
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:41
#define DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
Definition config.h:647
static ::ExceptionBase & ExcAccessToNonLocalElement(size_type arg1, size_type arg2, size_type arg3, size_type arg4)
#define DeclException0(Exception0)
#define DeclException4(Exception4, type1, type2, type3, type4, outsequence)
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)
static ::ExceptionBase & ExcMessage(std::string arg1)
constexpr bool is_supported_operation
bool is_finite(const double x)
Definition numbers.h:507
unsigned int global_dof_index
Definition types.h:94
*braid_SplitCommworld & comm