deal.II version GIT relicensing-6809-ge913b9bb34 2026-09-25 17:20:01+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: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2012 - 2026 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13#ifndef dealii_la_parallel_vector_h
14#define dealii_la_parallel_vector_h
15
16#include <deal.II/base/config.h>
17
25
29
30#include <iomanip>
31#include <memory>
32
33#if defined(DEAL_II_WITH_MPI)
35# include <mpi.h>
37#endif
38
39
41
42// Forward declarations
43#ifndef DOXYGEN
44namespace LinearAlgebra
45{
49 namespace distributed
50 {
51 template <typename, typename>
52 class BlockVector;
53 }
54
55 template <typename>
56 class ReadWriteVector;
57} // namespace LinearAlgebra
58
59# ifdef DEAL_II_WITH_PETSC
60namespace PETScWrappers
61{
62 namespace MPI
63 {
64 class Vector;
65 }
66} // namespace PETScWrappers
67# endif
68#endif
69
70namespace LinearAlgebra
71{
72 namespace distributed
73 {
242 template <typename Number, typename MemorySpace = MemorySpace::Host>
243 class Vector : public ::ReadVector<Number>
244 {
245 public:
247 using value_type = Number;
249 using const_pointer = const value_type *;
251 using const_iterator = const value_type *;
256
257 static_assert(
258 std::is_same_v<MemorySpace, ::MemorySpace::Host> ||
259 std::is_same_v<MemorySpace, ::MemorySpace::Default>,
260 "MemorySpace should be Host or Default");
261
262 static_assert(
263 (!std::is_same_v<MemorySpace, ::MemorySpace::Default>) ||
264 std::is_same_v<Number, float> || std::is_same_v<Number, double>,
265 "Number should be float or double for Default memory space");
266
275
283
291 Vector(Vector<Number, MemorySpace> &&in_vector); // NOLINT
292
298
316 const IndexSet &ghost_indices,
317 const MPI_Comm communicator);
318
322 Vector(const IndexSet &local_range, const MPI_Comm communicator);
323
331 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner);
332
337
342 void
343 reinit(const size_type size, const bool omit_zeroing_entries = false);
344
355 template <typename Number2>
356 void
358 const bool omit_zeroing_entries = false);
359
376 void
378 const IndexSet &ghost_indices,
379 const MPI_Comm communicator);
380
384 void
385 reinit(const IndexSet &local_range, const MPI_Comm communicator);
386
399 void
401 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner,
402 const MPI_Comm comm_sm = MPI_COMM_SELF);
403
410 void
412 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner,
413 const bool make_ghosted,
414 const MPI_Comm &comm_sm = MPI_COMM_SELF);
415
435 void
437 const types::global_dof_index ghost_size,
438 const MPI_Comm comm,
439 const MPI_Comm comm_sm = MPI_COMM_SELF);
440
453 void
455
464
495
507 template <typename Number2>
510
552 void
554
576 void
578
595 void
596 compress_start(const unsigned int communication_channel = 0,
598
617 void
619
636 void
638 const unsigned int communication_channel = 0) const;
639
640
648 void
650
659 void
661
673 bool
675
690 template <typename Number2>
691 void
693
704 template <typename MemorySpace2>
705 void
707 VectorOperation::values operation);
708
720 operator*=(const Number factor);
721
726 operator/=(const Number factor);
727
733
739
751 void
754 const VectorOperation::values operation,
755 const std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
756 &communication_pattern = {});
757
761 Number
763
767 void
768 add(const Number a);
769
773 void
774 add(const Number a, const Vector<Number, MemorySpace> &V);
775
779 void
780 add(const Number a,
782 const Number b,
784
789 void
790 add(const std::vector<size_type> &indices,
791 const std::vector<Number> &values);
792
797 void
798 sadd(const Number s,
799 const Number a,
801
807 void
808 scale(const Vector<Number, MemorySpace> &scaling_factors);
809
813 void
814 equ(const Number a, const Vector<Number, MemorySpace> &V);
815
821 l1_norm() const;
822
828 l2_norm() const;
829
834 norm_sqr() const;
835
841 linfty_norm() const;
842
863 Number
864 add_and_dot(const Number a,
867
872 virtual size_type
873 size() const override;
874
888
896 void
897 print(std::ostream &out,
898 const unsigned int precision = 3,
899 const bool scientific = true,
900 const bool across = true) const;
901
905 std::size_t
920 operator=(const Number s);
921
926 template <typename OtherNumber>
927 void
928 add(const std::vector<size_type> &indices,
929 const ::Vector<OtherNumber> &values);
930
935 template <typename OtherNumber>
936 void
937 add(const size_type n_elements,
938 const size_type *indices,
939 const OtherNumber *values);
940
945 void
946 sadd(const Number s, const Vector<Number, MemorySpace> &V);
947
962
967 bool
968 in_local_range(const size_type global_index) const;
969
982
991 begin() const;
992
1000 iterator
1002
1011 end() const;
1012
1022 Number
1023 operator()(const size_type global_index) const;
1024
1034 Number &
1035 operator()(const size_type global_index);
1036
1044 Number
1045 operator[](const size_type global_index) const;
1053 Number &
1054 operator[](const size_type global_index);
1055
1064 Number
1065 local_element(const size_type local_index) const;
1066
1075 Number &
1076 local_element(const size_type local_index);
1077
1084 Number *
1085 get_values() const;
1086
1104 template <typename OtherNumber>
1105 void
1106 extract_subvector_to(const std::vector<size_type> &indices,
1107 std::vector<OtherNumber> &values) const;
1108
1112 virtual void
1115 const ArrayView<Number> &elements) const override;
1116
1144 template <typename ForwardIterator, typename OutputIterator>
1145 void
1146 extract_subvector_to(ForwardIterator indices_begin,
1147 const ForwardIterator indices_end,
1148 OutputIterator values_begin) const;
1154 bool
1155 all_zero() const;
1156
1160 Number
1161 mean_value() const;
1162
1167 real_type
1168 lp_norm(const real_type p) const;
1179 MPI_Comm
1181
1188 const std::shared_ptr<const Utilities::MPI::Partitioner> &
1190
1200 bool
1202 const Utilities::MPI::Partitioner &part) const;
1203
1217 bool
1219 const Utilities::MPI::Partitioner &part) const;
1220
1224 void
1225 set_ghost_state(const bool ghosted) const;
1226
1231 const std::vector<ArrayView<const Number>> &
1233
1242
1247 Number,
1248 Number,
1249 unsigned int,
1250 << "Called compress(VectorOperation::insert), but"
1251 << " the element received from a remote processor, value "
1252 << std::setprecision(16) << arg1
1253 << ", does not match with the value "
1254 << std::setprecision(16) << arg2
1255 << " on the owner processor " << arg3);
1256
1262 size_type,
1263 size_type,
1264 size_type,
1265 size_type,
1266 << "You tried to access element " << arg1
1267 << " of a distributed vector, but this element is not "
1268 << "stored on the current processor. Note: The range of "
1269 << "locally owned elements is [" << arg2 << ',' << arg3
1270 << "], and there are " << arg4 << " ghost elements "
1271 << "that this vector can access."
1272 << "\n\n"
1273 << "A common source for this kind of problem is that you "
1274 << "are passing a 'fully distributed' vector into a function "
1275 << "that needs read access to vector elements that correspond "
1276 << "to degrees of freedom on ghost cells (or at least to "
1277 << "'locally active' degrees of freedom that are not also "
1278 << "'locally owned'). You need to pass a vector that has these "
1279 << "elements as ghost entries.");
1280
1281 private:
1286 void
1287 add_local(const Number a, const Vector<Number, MemorySpace> &V);
1288
1293 void
1294 sadd_local(const Number s,
1295 const Number a,
1297
1301 template <typename Number2>
1302 Number
1304
1308 real_type
1310
1314 Number
1316
1320 real_type
1322
1326 real_type
1327 lp_norm_local(const real_type p) const;
1328
1332 real_type
1334
1338 bool
1340
1346 Number
1347 add_and_dot_local(const Number a,
1350
1358 void
1360
1366 std::shared_ptr<const Utilities::MPI::Partitioner> partitioner;
1367
1372
1376 mutable ::MemorySpace::MemorySpaceData<Number, MemorySpace> data;
1377
1382 mutable std::shared_ptr<::parallel::internal::TBBPartitioner>
1384
1389 mutable ::MemorySpace::MemorySpaceData<Number, MemorySpace>
1391
1399 mutable bool vector_is_ghosted;
1400
1401#ifdef DEAL_II_WITH_MPI
1410 std::vector<MPI_Request> compress_requests;
1411
1416 mutable std::vector<MPI_Request> update_ghost_values_requests;
1417#endif
1418
1424 mutable std::mutex mutex;
1425
1432
1437 void
1439
1443 void
1444 resize_val(const size_type new_allocated_size,
1445 const MPI_Comm comm_sm = MPI_COMM_SELF);
1446
1447 // Make all other vector types friends.
1448 template <typename Number2, typename MemorySpace2>
1449 friend class Vector;
1450
1451 // Make BlockVector type friends.
1452 template <typename Number2, typename MemorySpace2>
1453 friend class BlockVector;
1454 };
1458 /*-------------------- Inline functions ---------------------------------*/
1459
1460#ifndef DOXYGEN
1461
1462 template <typename Number, typename MemorySpace>
1463 inline bool
1465 {
1466 return vector_is_ghosted;
1467 }
1468
1469
1470
1471 template <typename Number, typename MemorySpace>
1474 {
1475 return partitioner->size();
1476 }
1477
1478
1479
1480 template <typename Number, typename MemorySpace>
1483 {
1484 return partitioner->locally_owned_size();
1485 }
1486
1487
1488
1489 template <typename Number, typename MemorySpace>
1490 inline bool
1492 const size_type global_index) const
1493 {
1494 return partitioner->in_local_range(global_index);
1495 }
1496
1497
1498
1499 template <typename Number, typename MemorySpace>
1500 inline IndexSet
1502 {
1503 IndexSet is(size());
1504
1505 is.add_range(partitioner->local_range().first,
1506 partitioner->local_range().second);
1507
1508 return is;
1509 }
1510
1511
1512
1513 template <typename Number, typename MemorySpace>
1516 {
1517 return data.values.data();
1518 }
1519
1520
1521
1522 template <typename Number, typename MemorySpace>
1525 {
1526 return data.values.data();
1527 }
1528
1529
1530
1531 template <typename Number, typename MemorySpace>
1534 {
1535 return data.values.data() + partitioner->locally_owned_size();
1536 }
1537
1538
1539
1540 template <typename Number, typename MemorySpace>
1543 {
1544 return data.values.data() + partitioner->locally_owned_size();
1545 }
1546
1547
1548
1549 template <typename Number, typename MemorySpace>
1550 const std::vector<ArrayView<const Number>> &
1552 {
1553 return data.values_sm;
1554 }
1555
1556
1557
1558 template <typename Number, typename MemorySpace>
1559 inline Number
1560 Vector<Number, MemorySpace>::operator()(const size_type global_index) const
1561 {
1562 Assert((std::is_same_v<MemorySpace, ::MemorySpace::Host>),
1563 ExcMessage(
1564 "This function is only implemented for the Host memory space"));
1565 Assert(
1566 partitioner->in_local_range(global_index) ||
1567 partitioner->ghost_indices().is_element(global_index),
1568 ExcAccessToNonLocalElement(global_index,
1569 partitioner->local_range().first,
1570 partitioner->local_range().second == 0 ?
1571 0 :
1572 (partitioner->local_range().second - 1),
1573 partitioner->ghost_indices().n_elements()));
1574 // do not allow reading a vector which is not in ghost mode
1575 Assert(partitioner->in_local_range(global_index) ||
1576 vector_is_ghosted == true,
1577 ExcMessage("You tried to read a ghost element of this vector, "
1578 "but it has not imported its ghost values."));
1579 return data.values[partitioner->global_to_local(global_index)];
1580 }
1581
1582
1583
1584 template <typename Number, typename MemorySpace>
1585 inline Number &
1586 Vector<Number, MemorySpace>::operator()(const size_type global_index)
1587 {
1588 Assert((std::is_same_v<MemorySpace, ::MemorySpace::Host>),
1589 ExcMessage(
1590 "This function is only implemented for the Host memory space"));
1591 Assert(
1592 partitioner->in_local_range(global_index) ||
1593 partitioner->ghost_indices().is_element(global_index),
1594 ExcAccessToNonLocalElement(global_index,
1595 partitioner->local_range().first,
1596 partitioner->local_range().second == 0 ?
1597 0 :
1598 (partitioner->local_range().second - 1),
1599 partitioner->ghost_indices().n_elements()));
1600 // we would like to prevent reading ghosts from a vector that does not
1601 // have them imported, but this is not possible because we might be in a
1602 // part of the code where the vector has enabled ghosts but is non-const
1603 // (then, the compiler picks this method according to the C++ rule book
1604 // even if a human would pick the const method when this subsequent use
1605 // is just a read)
1606 return data.values[partitioner->global_to_local(global_index)];
1607 }
1608
1609
1610
1611 template <typename Number, typename MemorySpace>
1612 inline Number
1613 Vector<Number, MemorySpace>::operator[](const size_type global_index) const
1614 {
1615 return operator()(global_index);
1616 }
1617
1618
1619
1620 template <typename Number, typename MemorySpace>
1621 inline Number &
1622 Vector<Number, MemorySpace>::operator[](const size_type global_index)
1623 {
1624 return operator()(global_index);
1625 }
1626
1627
1628
1629 template <typename Number, typename MemorySpace>
1630 inline Number
1632 const size_type local_index) const
1633 {
1634 Assert((std::is_same_v<MemorySpace, ::MemorySpace::Host>),
1635 ExcMessage(
1636 "This function is only implemented for the Host memory space"));
1637 AssertIndexRange(local_index,
1638 partitioner->locally_owned_size() +
1639 partitioner->n_ghost_indices());
1640 // do not allow reading a vector which is not in ghost mode
1641 Assert(local_index < locally_owned_size() || vector_is_ghosted == true,
1642 ExcMessage("You tried to read a ghost element of this vector, "
1643 "but it has not imported its ghost values."));
1644
1645 return data.values[local_index];
1646 }
1647
1648
1649
1650 template <typename Number, typename MemorySpace>
1651 inline Number &
1652 Vector<Number, MemorySpace>::local_element(const size_type local_index)
1653 {
1654 Assert((std::is_same_v<MemorySpace, ::MemorySpace::Host>),
1655 ExcMessage(
1656 "This function is only implemented for the Host memory space"));
1657
1658 AssertIndexRange(local_index,
1659 partitioner->locally_owned_size() +
1660 partitioner->n_ghost_indices());
1661
1662 return data.values[local_index];
1663 }
1664
1665
1666
1667 template <typename Number, typename MemorySpace>
1668 inline Number *
1670 {
1671 return data.values.data();
1672 }
1673
1674
1675
1676 template <typename Number, typename MemorySpace>
1677 template <typename OtherNumber>
1678 inline void
1680 const std::vector<size_type> &indices,
1681 std::vector<OtherNumber> &values) const
1682 {
1683 for (size_type i = 0; i < indices.size(); ++i)
1684 values[i] = operator()(indices[i]);
1685 }
1686
1687
1688
1689 template <typename Number, typename MemorySpace>
1690 template <typename ForwardIterator, typename OutputIterator>
1691 inline void
1693 ForwardIterator indices_begin,
1694 const ForwardIterator indices_end,
1695 OutputIterator values_begin) const
1696 {
1697 while (indices_begin != indices_end)
1698 {
1699 *values_begin = operator()(*indices_begin);
1700 ++indices_begin;
1701 ++values_begin;
1702 }
1703 }
1704
1705
1706
1707 template <typename Number, typename MemorySpace>
1708 template <typename OtherNumber>
1709 inline void
1711 const std::vector<size_type> &indices,
1712 const ::Vector<OtherNumber> &values)
1713 {
1714 AssertDimension(indices.size(), values.size());
1715 for (size_type i = 0; i < indices.size(); ++i)
1716 {
1717 Assert(
1718 numbers::is_finite(values[i]),
1719 ExcMessage(
1720 "The given value is not finite but either infinite or Not A Number (NaN)"));
1721 this->operator()(indices[i]) += values(i);
1722 }
1723 }
1724
1725
1726
1727 template <typename Number, typename MemorySpace>
1728 template <typename OtherNumber>
1729 inline void
1730 Vector<Number, MemorySpace>::add(const size_type n_elements,
1731 const size_type *indices,
1732 const OtherNumber *values)
1733 {
1734 for (size_type i = 0; i < n_elements; ++i, ++indices, ++values)
1735 {
1736 Assert(
1737 numbers::is_finite(*values),
1738 ExcMessage(
1739 "The given value is not finite but either infinite or Not A Number (NaN)"));
1740 this->operator()(*indices) += *values;
1741 }
1742 }
1743
1744
1745
1746 template <typename Number, typename MemorySpace>
1747 inline MPI_Comm
1749 {
1750 return partitioner->get_mpi_communicator();
1751 }
1752
1753
1754
1755 template <typename Number, typename MemorySpace>
1756 inline const std::shared_ptr<const Utilities::MPI::Partitioner> &
1758 {
1759 return partitioner;
1760 }
1761
1762
1763
1764 template <typename Number, typename MemorySpace>
1765 inline void
1766 Vector<Number, MemorySpace>::set_ghost_state(const bool ghosted) const
1767 {
1768 vector_is_ghosted = ghosted;
1769 }
1770
1771#endif
1772
1773 } // namespace distributed
1774} // namespace LinearAlgebra
1775
1776
1784template <typename Number, typename MemorySpace>
1785inline void
1791
1792
1796template <typename Number, typename MemorySpace>
1797struct is_serial_vector<LinearAlgebra::distributed::Vector<Number, MemorySpace>>
1798 : std::false_type
1799{};
1800
1801
1802
1803namespace internal
1804{
1805 namespace LinearOperatorImplementation
1806 {
1807 template <typename>
1808 class ReinitHelper;
1809
1814 template <typename Number>
1815 class ReinitHelper<LinearAlgebra::distributed::Vector<Number>>
1816 {
1817 public:
1818 // A helper type-trait that leverage SFINAE to figure out if type T has
1819 // void T::get_mpi_communicator()
1820 template <typename T>
1822 decltype(std::declval<T>().get_mpi_communicator());
1823
1824 template <typename T>
1825 static constexpr bool has_get_mpi_communicator =
1826 is_supported_operation<get_mpi_communicator_t, T>;
1827
1828 // A helper type-trait that leverage SFINAE to figure out if type T has
1829 // void T::locally_owned_domain_indices()
1830 template <typename T>
1832 decltype(std::declval<T>().locally_owned_domain_indices());
1833
1834 template <typename T>
1835 static constexpr bool has_locally_owned_domain_indices =
1836 is_supported_operation<locally_owned_domain_indices_t, T>;
1837
1838 // A helper type-trait that leverage SFINAE to figure out if type T has
1839 // void T::locally_owned_range_indices()
1840 template <typename T>
1842 decltype(std::declval<T>().locally_owned_range_indices());
1843
1844 template <typename T>
1845 static constexpr bool has_locally_owned_range_indices =
1846 is_supported_operation<locally_owned_range_indices_t, T>;
1847
1848 // A helper type-trait that leverage SFINAE to figure out if type T has
1849 // void T::initialize_dof_vector(VectorType v)
1850 template <typename T>
1852 decltype(std::declval<T>().initialize_dof_vector(
1854
1855 template <typename T>
1856 static constexpr bool has_initialize_dof_vector =
1857 is_supported_operation<initialize_dof_vector_t, T>;
1858
1859 // Used for (Trilinos/PETSc)Wrappers::SparseMatrix
1860 template <typename MatrixType,
1861#if !defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1900
1862 std::enable_if_t<has_get_mpi_communicator<MatrixType> &&
1863 has_locally_owned_domain_indices<MatrixType>,
1864#else
1865 // workaround for Intel 18
1866 std::enable_if_t<
1867 is_supported_operation<get_mpi_communicator_t, MatrixType> &&
1869 MatrixType>,
1870#endif
1871 MatrixType> * = nullptr>
1872 static void
1873 reinit_domain_vector(MatrixType &mat,
1875 bool /*omit_zeroing_entries*/)
1876 {
1877 vec.reinit(mat.locally_owned_domain_indices(),
1878 mat.get_mpi_communicator());
1879 }
1880
1881 // Used for MatrixFree and DiagonalMatrix
1882 template <typename MatrixType,
1883#if !defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1900
1884 std::enable_if_t<has_initialize_dof_vector<MatrixType>,
1885#else
1886 // workaround for Intel 18
1887 std::enable_if_t<
1888 is_supported_operation<initialize_dof_vector_t, MatrixType>,
1889#endif
1890 MatrixType> * = nullptr>
1891 static void
1892 reinit_domain_vector(MatrixType &mat,
1894 bool omit_zeroing_entries)
1895 {
1896 mat.initialize_dof_vector(vec);
1897 if (!omit_zeroing_entries)
1898 vec = Number();
1899 }
1900
1901 // Used for (Trilinos/PETSc)Wrappers::SparseMatrix
1902 template <typename MatrixType,
1903#if !defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1900
1904 std::enable_if_t<has_get_mpi_communicator<MatrixType> &&
1905 has_locally_owned_range_indices<MatrixType>,
1906#else
1907 // workaround for Intel 18
1908 std::enable_if_t<
1909 is_supported_operation<get_mpi_communicator_t, MatrixType> &&
1910 is_supported_operation<locally_owned_range_indices_t,
1911 MatrixType>,
1912#endif
1913 MatrixType> * = nullptr>
1914 static void
1915 reinit_range_vector(MatrixType &mat,
1917 bool /*omit_zeroing_entries*/)
1918 {
1919 vec.reinit(mat.locally_owned_range_indices(),
1920 mat.get_mpi_communicator());
1921 }
1922
1923 // Used for MatrixFree and DiagonalMatrix
1924 template <typename MatrixType,
1925#if !defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1900
1926 std::enable_if_t<has_initialize_dof_vector<MatrixType>,
1927#else
1928 // workaround for Intel 18
1929 std::enable_if_t<
1930 is_supported_operation<initialize_dof_vector_t, MatrixType>,
1931#endif
1932 MatrixType> * = nullptr>
1933 static void
1934 reinit_range_vector(MatrixType &mat,
1936 bool omit_zeroing_entries)
1937 {
1938 mat.initialize_dof_vector(vec);
1939 if (!omit_zeroing_entries)
1940 vec = Number();
1941 }
1942 };
1943
1944 } // namespace LinearOperatorImplementation
1945} /* namespace internal */
1946
1947
1949
1950#endif
*  *  Point< dim > operator()(const Point< dim > &p) const * 
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
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:119
void swap(LinearAlgebra::distributed::Vector< Number, MemorySpace > &u, LinearAlgebra::distributed::Vector< Number, MemorySpace > &v) noexcept
value_type * iterator
Definition vector.h:118
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_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
Definition config.h:636
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
#define DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
Definition config.h:680
Point< 2 > second
Definition grid_out.cc:4640
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 & 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)
static ::ExceptionBase & ExcMessage(std::string arg1)
std::vector< index_type > data
Definition mpi.cc:734
std::pair< types::global_dof_index, types::global_dof_index > local_range
Definition mpi.cc:814
std::size_t size
Definition mpi.cc:733
const MPI_Comm comm
Definition mpi.cc:912
types::global_dof_index locally_owned_size
Definition mpi.cc:821
*  *  *  RotationFunction< dim, Number >::RotationFunction Number(dim)
constexpr bool is_supported_operation
bool is_finite(const double x)
Definition numbers.h:508
unsigned int global_dof_index
Definition types.h:92