13#ifndef dealii_mg_transfer_matrix_free_h
14#define dealii_mg_transfer_matrix_free_h
45 class MGTwoLevelTransferImplementation;
50 template <
int dim,
typename VectorType>
55 class MGTwoLevelTransferImplementation;
123template <
int dim,
typename VectorType>
136 "This class is currently only implemented for vectors of "
137 "type LinearAlgebra::distributed::Vector.");
176 virtual std::pair<bool, bool>
178 const std::shared_ptr<const Utilities::MPI::Partitioner>
180 const std::shared_ptr<const Utilities::MPI::Partitioner>
193 virtual std::pair<const DoFHandler<dim> *,
unsigned int>
204 template <
int dim,
typename VectorType>
211 using Number =
typename VectorType::value_type;
236 const VectorType &src)
const = 0;
272 template <std::
size_t w
idth,
typename IndexType>
273 std::pair<bool, bool>
275 const std::shared_ptr<const Utilities::MPI::Partitioner>
277 const std::shared_ptr<const Utilities::MPI::Partitioner>
282 &constraint_info_coarse,
283 std::vector<unsigned
int> &dof_indices_fine);
317 std::shared_ptr<const Utilities::MPI::Partitioner>
324 std::shared_ptr<const Utilities::MPI::Partitioner>
369template <
int dim,
typename VectorType>
383 "This class is currently only implemented for vectors of "
384 "type LinearAlgebra::distributed::Vector.");
389 using Number =
typename VectorType::value_type;
470 const unsigned int dof_handler_index_fine,
472 const unsigned int dof_handler_index_coarse);
484 const unsigned int fe_degree_coarse);
490 interpolate(VectorType &dst,
const VectorType &src)
const override;
496 std::pair<bool, bool>
498 const std::shared_ptr<const Utilities::MPI::Partitioner>
512 std::pair<const DoFHandler<dim> *,
unsigned int>
518 const VectorType &src)
const override;
522 const VectorType &src)
const override;
594 internal::MatrixFreeFunctions::
595 ConstraintInfo<dim, VectorizedArrayType, types::global_dof_index>
601 internal::MatrixFreeFunctions::
602 ConstraintInfo<dim, VectorizedArrayType, types::global_dof_index>
686 LinearAlgebra::distributed::Vector<Number, MemorySpace::Default>>;
697template <int dim, typename VectorType>
707 "type LinearAlgebra::distributed::Vector. This class should not be used for host vectors since it would perform redundant transfers. Use MGTwoLevelTransfer instead.");
713 using Number =
typename VectorType::value_type;
744 const unsigned int dof_handler_index_fine,
746 const unsigned int dof_handler_index_coarse);
753 const unsigned int fe_degree_coarse);
771 interpolate(VectorType &dst,
const VectorType &src)
const override;
776 std::pair<bool, bool>
778 const std::shared_ptr<const Utilities::MPI::Partitioner>
780 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner_fine)
792 std::pair<const DoFHandler<dim> *,
unsigned int>
823 friend class internal::MGTwoLevelTransferImplementation;
827 typename VectorType::memory_space>;
835template <int dim, typename VectorType>
844 "This class is currently only implemented for vectors of "
845 "type LinearAlgebra::distributed::Vector.");
847 using Number =
typename VectorType::value_type;
871 const unsigned int rtree_level = 0,
872 const bool enforce_all_points_found =
true)
873 : tolerance(tolerance)
874 , rtree_level(rtree_level)
875 , enforce_all_points_found(enforce_all_points_found)
927 interpolate(VectorType &dst,
const VectorType &src)
const override;
933 std::pair<bool, bool>
935 const std::shared_ptr<const Utilities::MPI::Partitioner>
937 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner_fine)
949 std::pair<const DoFHandler<dim> *,
unsigned int>
955 boost::signals2::connection
961 boost::signals2::connection
967 boost::signals2::connection
973 boost::signals2::connection
983 const VectorType &src)
const override;
990 const VectorType &src)
const override;
996 template <
int n_components>
999 const VectorType &src)
const;
1004 template <
int n_components>
1043 internal::MatrixFreeFunctions::
1044 ConstraintInfo<dim, VectorizedArrayType, unsigned int>
1067 typename VectorType::memory_space>;
1104template <int dim, typename Number, typename MemorySpace>
1107 LinearAlgebra::distributed::Vector<Number, MemorySpace>>
1136 template <
typename MGTwoLevelTransferObject>
1139 const std::function<
void(
const unsigned int,
VectorType &)>
1140 &initialize_dof_vector = {});
1145 template <
typename MGTwoLevelTransferObject>
1159 build(
const std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
1160 &external_partitioners = {});
1168 &initialize_dof_vector);
1207 const std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
1208 &external_partitioners = {});
1221 const std::function<
void(
const unsigned int,
VectorType &)>
1222 &initialize_dof_vector);
1264 template <
class InVector>
1268 const InVector &src)
const;
1279 template <
class OutVector>
1303 template <
class InVector>
1307 const InVector &src)
const;
1317 template <
class InVector>
1370 std::pair<const DoFHandler<dim> *,
unsigned int>
1385 template <
typename MGTwoLevelTransferObject>
1398 template <
class InVector>
1402 const InVector &vector_reference,
1403 const bool omit_zeroing_entries,
1404 const bool force_same_partitioner =
false)
const;
1431 std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
1440template <
int dim,
typename Number,
typename TransferType>
1442 :
public MGTransferBase<LinearAlgebra::distributed::BlockVector<Number>>
1446 : same_for_all(same_for_all)
1465 const unsigned int to_level,
1471 const unsigned int to_level,
1495 const unsigned int from_level,
1509 template <
typename BlockVectorType2>
1514 const BlockVectorType2 &src)
const;
1519 template <
typename BlockVectorType2>
1524 const BlockVectorType2 &src)
const;
1529 template <
typename BlockVectorType2>
1533 BlockVectorType2 &dst,
1540 template <
typename BlockVectorType2>
1544 BlockVectorType2 &dst,
1553 virtual const TransferType &
1576template <
int dim,
typename Number>
1581 MGTransferMatrixFree<dim, Number, ::MemorySpace::Host>>
1589 &transfer_operator);
1607 const std::vector<MGConstrainedDoFs> &mg_constrained_dofs);
1620 const std::vector<MGConstrainedDoFs> &mg_constrained_dofs);
1642 std::vector<MGTransferMatrixFree<dim, Number, ::MemorySpace::Host>>
1660template <
int dim,
typename VectorType>
1667 const unsigned int mg_level_fine,
1668 const unsigned int mg_level_coarse)
1670 host_transfer.
reinit(dof_handler_fine,
1678template <
int dim,
typename VectorType>
1682 const unsigned int dof_handler_index_fine,
1684 const unsigned int dof_handler_index_coarse)
1686 host_transfer.
reinit(matrix_free_fine,
1687 dof_handler_index_fine,
1689 dof_handler_index_coarse);
1693template <
int dim,
typename VectorType>
1697 const unsigned int fe_degree_coarse)
1703template <
int dim,
typename VectorType>
1707 const VectorType &src)
const
1709 if (host_vector_coarse.
size() == 0)
1710 host_vector_coarse.
reinit(src.get_partitioner());
1711 if (host_vector_fine.
size() == 0)
1712 host_vector_fine.
reinit(dst.get_partitioner());
1714 copy_to_host(host_vector_fine, dst);
1715 copy_to_host(host_vector_coarse, src);
1719 copy_from_host(dst, host_vector_fine);
1722template <
int dim,
typename VectorType>
1726 const VectorType &src)
const
1728 if (host_vector_coarse.
size() == 0)
1729 host_vector_coarse.
reinit(dst.get_partitioner());
1730 if (host_vector_fine.
size() == 0)
1731 host_vector_fine.
reinit(src.get_partitioner());
1733 copy_to_host(host_vector_coarse, dst);
1734 copy_to_host(host_vector_fine, src);
1738 copy_from_host(dst, host_vector_coarse);
1741template <
int dim,
typename VectorType>
1745 const VectorType &src)
const
1747 if (host_vector_coarse.
size() == 0)
1748 host_vector_coarse.
reinit(dst.get_partitioner());
1749 if (host_vector_fine.
size() == 0)
1750 host_vector_fine.
reinit(src.get_partitioner());
1752 copy_to_host(host_vector_fine, src);
1754 host_transfer.
interpolate(host_vector_coarse, host_vector_fine);
1756 copy_from_host(dst, host_vector_coarse);
1759template <
int dim,
typename VectorType>
1760std::pair<bool, bool>
1763 const std::shared_ptr<const Utilities::MPI::Partitioner>
1764 &partitioner_coarse,
1765 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner_fine)
1771template <
int dim,
typename VectorType>
1778template <
int dim,
typename VectorType>
1779std::pair<const DoFHandler<dim> *,
unsigned int>
1786template <
int dim,
typename VectorType>
1789 VectorTypeHost &dst,
1790 const VectorType &src)
const
1793 src.get_partitioner()->locally_owned_range());
1799template <
int dim,
typename VectorType>
1803 const VectorTypeHost &src)
const
1806 src.get_partitioner()->locally_owned_range());
1814template <
int dim,
typename Number,
typename MemorySpace>
1815template <
typename MGTwoLevelTransferObject>
1818 const std::function<
void(
const unsigned int, VectorType &)>
1819 &initialize_dof_vector)
1821 this->transfer.
clear();
1822 this->internal_transfer.clear();
1824 this->initialize_transfer_references(transfer);
1825 this->build(initialize_dof_vector);
1830template <
int dim,
typename Number,
typename MemorySpace>
1831template <
typename MGTwoLevelTransferObject>
1836 this->initialize_transfer_references(transfer);
1841template <
int dim,
typename Number,
typename MemorySpace>
1842template <
typename MGTwoLevelTransferObject>
1847 const unsigned int min_level = transfer.
min_level();
1848 const unsigned int max_level = transfer.
max_level();
1850 this->transfer.
resize(min_level, max_level);
1853 for (
unsigned int l = min_level + 1;
l <= max_level; ++
l)
1861template <
int dim,
typename Number,
typename MemorySpace>
1862template <
class InVector>
1865 const unsigned int level,
1867 const InVector &vec_reference,
1868 const bool omit_zeroing_entries,
1869 const bool force_same_partitioner)
const
1871 std::shared_ptr<const Utilities::MPI::Partitioner> partitioner;
1873 if (external_partitioners.empty())
1875 partitioner = vec_reference.get_partitioner();
1882 partitioner = external_partitioners[
level - transfer.
min_level()];
1888 if (vec.get_partitioner().get() == partitioner.get())
1890 if (omit_zeroing_entries ==
false)
1896 if (!force_same_partitioner && vec.size() == partitioner->size() &&
1897 vec.locally_owned_size() == partitioner->locally_owned_size())
1899 if (omit_zeroing_entries ==
false)
1905 vec.reinit(partitioner, omit_zeroing_entries);
1910template <
int dim,
typename Number,
typename MemorySpace>
1911template <
class InVector>
1916 const InVector &src)
const
1918 assert_dof_handler(dof_handler);
1922 const bool zero_out_values =
1923 (this->perform_plain_copy ==
false &&
1924 this->perform_renumbered_plain_copy ==
false) ||
1927 this->initialize_dof_vector(
level,
1934 if (this->perform_plain_copy)
1936 dst[dst.
max_level()].copy_locally_owned_data_from(src);
1938 else if (this->perform_renumbered_plain_copy)
1942 for (
unsigned int i = 0; i < this->copy_indices.back().n_cols(); ++i)
1943 dst_level.local_element(this->copy_indices.back()(1, i)) =
1944 src.local_element(i);
1948 this->ghosted_global_vector = src;
1949 this->ghosted_global_vector.update_ghost_values();
1955 auto &dst_level = dst[
l];
1957 const auto copy_unknowns = [&](
const auto &indices) {
1958 for (
unsigned int i = 0; i < indices.n_cols(); ++i)
1959 dst_level.local_element(indices(1, i)) =
1960 this->ghosted_global_vector.local_element(indices(0, i));
1963 copy_unknowns(this->copy_indices[l]);
1964 copy_unknowns(this->copy_indices_level_mine[l]);
1973template <
int dim,
typename Number,
typename MemorySpace>
1974template <
class OutVector>
1981 assert_dof_handler(dof_handler);
1983 if (this->perform_plain_copy)
1985 dst.zero_out_ghost_values();
1986 dst.copy_locally_owned_data_from(src[src.
max_level()]);
1988 else if (this->perform_renumbered_plain_copy)
1990 const auto &src_level = src[src.
max_level()];
1991 dst.zero_out_ghost_values();
1992 for (
unsigned int i = 0; i < this->copy_indices.back().n_cols(); ++i)
1993 dst.local_element(i) =
1994 src_level.local_element(this->copy_indices.back()(1, i));
2001 auto &ghosted_vector = this->ghosted_level_vector[
l];
2003 if (this->ghosted_level_vector[l].
size() > 0)
2004 ghosted_vector = src[l];
2006 const auto *
const ghosted_vector_ptr =
2007 (this->ghosted_level_vector[
l].size() > 0) ? &ghosted_vector :
2010 ghosted_vector_ptr->update_ghost_values();
2012 const auto copy_unknowns = [&](
const auto &indices) {
2013 for (
unsigned int i = 0; i < indices.n_cols(); ++i)
2014 dst.local_element(indices(0, i)) =
2015 ghosted_vector_ptr->local_element(indices(1, i));
2018 copy_unknowns(this->copy_indices[l]);
2019 copy_unknowns(this->copy_indices_global_mine[l]);
2027template <
int dim,
typename Number,
typename MemorySpace>
2028template <
class InVector>
2032 const InVector &src)
const
2036 this->interpolate_to_mg(dof_handler_dummy, dst, src);
2041template <
int dim,
typename Number,
typename MemorySpace>
2042template <
class InVector>
2047 const InVector &src)
const
2049 assert_dof_handler(dof_handler);
2051 const unsigned int min_level = dst.
min_level();
2052 const unsigned int max_level = transfer.
max_level();
2058 const bool zero_out_values =
false;
2059 this->initialize_dof_vector(
level, dst[
level], src, !zero_out_values);
2062 if (this->perform_plain_copy)
2064 dst[max_level].copy_locally_owned_data_from(src);
2066 for (
unsigned int l = max_level;
l > min_level; --
l)
2067 this->transfer[l]->
interpolate(dst[l - 1], dst[l]);
2069 else if (this->perform_renumbered_plain_copy)
2071 auto &dst_level = dst[max_level];
2073 for (
unsigned int i = 0; i < this->solution_copy_indices.back().n_cols();
2075 dst_level.local_element(this->solution_copy_indices.back()(1, i)) =
2076 src.local_element(i);
2078 for (
unsigned int l = max_level;
l > min_level; --
l)
2079 this->transfer[l]->
interpolate(dst[l - 1], dst[l]);
2083 this->solution_ghosted_global_vector = src;
2084 this->solution_ghosted_global_vector.update_ghost_values();
2086 for (
unsigned int l = max_level + 1;
l != min_level;)
2090 auto &dst_level = dst[
l];
2092 const auto copy_unknowns = [&](
const auto &indices) {
2093 for (
unsigned int i = 0; i < indices.n_cols(); ++i)
2094 dst_level.local_element(indices(1, i)) =
2095 this->solution_ghosted_global_vector.local_element(
2099 copy_unknowns(this->solution_copy_indices[l]);
2100 copy_unknowns(this->solution_copy_indices_level_mine[l]);
2105 this->transfer[
l]->interpolate(dst[l - 1], dst[l]);
2112template <
int dim,
typename Number,
typename TransferType>
2113template <
typename BlockVectorType2>
2118 const BlockVectorType2 &src)
const
2122 "This object was initialized with support for usage with one "
2123 "DoFHandler for each block, but this method assumes that "
2124 "the same DoFHandler is used for all the blocks!"));
2125 const std::vector<const DoFHandler<dim> *> mg_dofs(src.n_blocks(),
2128 copy_to_mg(mg_dofs, dst, src);
2133template <
int dim,
typename Number,
typename TransferType>
2134template <
typename BlockVectorType2>
2139 const BlockVectorType2 &src)
const
2141 const unsigned int n_blocks = src.n_blocks();
2147 const unsigned int min_level = dst.
min_level();
2148 const unsigned int max_level = dst.
max_level();
2152 dst[
level].reinit(n_blocks);
2156 min_level, max_level);
2160 const unsigned int data_block = same_for_all ? 0 :
b;
2161 get_matrix_free_transfer(data_block)
2162 .copy_to_mg(*dof_handler[b], dst_non_block, src.block(b));
2164 for (
unsigned int l = min_level;
l <= max_level; ++
l)
2165 dst[l].block(b) = dst_non_block[
l];
2172template <
int dim,
typename Number,
typename TransferType>
2173template <
typename BlockVectorType2>
2177 BlockVectorType2 &dst,
2183 "This object was initialized with support for usage with one "
2184 "DoFHandler for each block, but this method assumes that "
2185 "the same DoFHandler is used for all the blocks!"));
2186 const std::vector<const DoFHandler<dim> *> mg_dofs(dst.n_blocks(),
2189 copy_from_mg(mg_dofs, dst, src);
2192template <
int dim,
typename Number,
typename TransferType>
2193template <
typename BlockVectorType2>
2197 BlockVectorType2 &dst,
2201 const unsigned int n_blocks = dst.n_blocks();
2207 const unsigned int min_level = src.min_level();
2208 const unsigned int max_level = src.max_level();
2210 for (
unsigned int l = min_level;
l <= max_level; ++
l)
2215 min_level, max_level);
2219 for (
unsigned int l = min_level;
l <= max_level; ++
l)
2221 src_non_block[
l].reinit(src[l].block(b));
2222 src_non_block[
l] = src[
l].block(b);
2224 const unsigned int data_block = same_for_all ? 0 :
b;
2225 get_matrix_free_transfer(data_block)
2226 .copy_from_mg(*dof_handler[b], dst.block(b), src_non_block);
virtual size_type size() const override
void reinit(const size_type size, const bool omit_zeroing_entries=false)
std::function< void(const unsigned int, LinearAlgebra::distributed::Vector< Number, MemorySpace > &)> initialize_dof_vector
void resize(const unsigned int new_minlevel, const unsigned int new_maxlevel, Args &&...args)
unsigned int max_level() const
unsigned int min_level() const
virtual void prolongate(const unsigned int to_level, LinearAlgebra::distributed::BlockVector< Number > &dst, const LinearAlgebra::distributed::BlockVector< Number > &src) const override
virtual void prolongate_and_add(const unsigned int to_level, LinearAlgebra::distributed::BlockVector< Number > &dst, const LinearAlgebra::distributed::BlockVector< Number > &src) const override
virtual const TransferType & get_matrix_free_transfer(const unsigned int b) const =0
void copy_from_mg(const std::vector< const DoFHandler< dim > * > &dof_handler, BlockVectorType2 &dst, const MGLevelObject< LinearAlgebra::distributed::BlockVector< Number > > &src) const
void copy_to_mg(const DoFHandler< dim > &dof_handler, MGLevelObject< LinearAlgebra::distributed::BlockVector< Number > > &dst, const BlockVectorType2 &src) const
virtual void restrict_and_add(const unsigned int from_level, LinearAlgebra::distributed::BlockVector< Number > &dst, const LinearAlgebra::distributed::BlockVector< Number > &src) const override
MGTransferBlockMatrixFreeBase(const bool same_for_all)
void copy_from_mg(const DoFHandler< dim > &dof_handler, BlockVectorType2 &dst, const MGLevelObject< LinearAlgebra::distributed::BlockVector< Number > > &src) const
void copy_to_mg(const std::vector< const DoFHandler< dim > * > &dof_handler, MGLevelObject< LinearAlgebra::distributed::BlockVector< Number > > &dst, const BlockVectorType2 &src) const
const MGTransferMatrixFree< dim, Number, ::MemorySpace::Host > & get_matrix_free_transfer(const unsigned int b) const override
MGTransferBlockMatrixFree(const MGTransferMatrixFree< dim, Number, ::MemorySpace::Host > &transfer_operator)
MGTransferBlockMatrixFree(const MGConstrainedDoFs &mg_constrained_dofs)
std::vector< ObserverPointer< const MGTransferMatrixFree< dim, Number, ::MemorySpace::Host > > > transfer_operators
std::vector< MGTransferMatrixFree< dim, Number, ::MemorySpace::Host > > transfer_operators_internal
MGTransferBlockMatrixFree(const std::vector< MGConstrainedDoFs > &mg_constrained_dofs)
void build(const DoFHandler< dim > &dof_handler)
MGTransferBlockMatrixFree()=default
void build(const std::vector< const DoFHandler< dim > * > &dof_handler)
void initialize_constraints(const std::vector< MGConstrainedDoFs > &mg_constrained_dofs)
void initialize_constraints(const MGConstrainedDoFs &mg_constrained_dofs)
void initialize_two_level_transfers(const MGLevelObject< MGTwoLevelTransferObject > &transfer)
void interpolate_to_mg(MGLevelObject< VectorType > &dst, const InVector &src) const
std::vector< std::shared_ptr< const Utilities::MPI::Partitioner > > external_partitioners
void interpolate_to_mg(const DoFHandler< dim > &dof_handler, MGLevelObject< VectorType > &dst, const InVector &src) const
void initialize_transfer_references(const MGLevelObject< MGTwoLevelTransferObject > &transfer)
MGLevelObject< MGTwoLevelTransfer< dim, LinearAlgebra::distributed::Vector< Number, ::MemorySpace::Host > > > internal_transfer
void build(const std::vector< std::shared_ptr< const Utilities::MPI::Partitioner > > &external_partitioners={})
unsigned int max_level() const
void prolongate(const unsigned int to_level, VectorType &dst, const VectorType &src) const override
void initialize_dof_vector(const unsigned int level, VectorType &vector, const InVector &vector_reference, const bool omit_zeroing_entries, const bool force_same_partitioner=false) const
void copy_from_mg(const DoFHandler< dim > &dof_handler, OutVector &dst, const MGLevelObject< VectorType > &src) const
void build(const DoFHandler< dim > &dof_handler, const std::vector< std::shared_ptr< const Utilities::MPI::Partitioner > > &external_partitioners={})
MGTransferMatrixFree(const MGConstrainedDoFs &mg_constrained_dofs)
void fill_and_communicate_copy_indices_global_coarsening(const DoFHandler< dim > &dof_handler)
void build(const DoFHandler< dim > &dof_handler, const std::function< void(const unsigned int, VectorType &)> &initialize_dof_vector)
void initialize_internal_transfer(const DoFHandler< dim > &dof_handler, const ObserverPointer< const MGConstrainedDoFs > &mg_constrained_dofs)
virtual void restrict_and_add(const unsigned int from_level, VectorType &dst, const VectorType &src) const override
void prolongate_and_add(const unsigned int to_level, VectorType &dst, const VectorType &src) const override
MGLevelObject< ObserverPointer< MGTwoLevelTransferBase< dim, VectorType > > > transfer
void build(const std::function< void(const unsigned int, VectorType &)> &initialize_dof_vector)
MGTransferMatrixFree(const MGLevelObject< MGTwoLevelTransferObject > &transfer, const std::function< void(const unsigned int, VectorType &)> &initialize_dof_vector={})
void initialize_constraints(const MGConstrainedDoFs &mg_constrained_dofs)
unsigned int min_level() const
std::pair< const DoFHandler< dim > *, unsigned int > get_dof_handler_fine() const
void copy_to_mg(const DoFHandler< dim > &dof_handler, MGLevelObject< VectorType > &dst, const InVector &src) const
void assert_dof_handler(const DoFHandler< dim > &dof_handler_out) const
std::size_t memory_consumption() const
std::shared_ptr< const Utilities::MPI::Partitioner > partitioner_fine
virtual std::pair< const DoFHandler< dim > *, unsigned int > get_dof_handler_fine() const =0
virtual std::size_t memory_consumption() const =0
virtual void restrict_and_add(VectorType &dst, const VectorType &src) const =0
virtual std::pair< bool, bool > enable_inplace_operations_if_possible(const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner_coarse, const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner_fine)=0
std::shared_ptr< const Utilities::MPI::Partitioner > partitioner_coarse
virtual void prolongate_and_add(VectorType &dst, const VectorType &src) const =0
virtual void interpolate(VectorType &dst, const VectorType &src) const =0
typename VectorType::value_type Number
std::size_t memory_consumption() const override
MGTwoLevelTransfer< dim, VectorTypeHost > host_transfer
void interpolate(VectorType &dst, const VectorType &src) const override
void reinit(const MatrixFree< dim, Number > &matrix_free_fine, const unsigned int dof_handler_index_fine, const MatrixFree< dim, Number > &matrix_free_coarse, const unsigned int dof_handler_index_coarse)
void restrict_and_add(VectorType &dst, const VectorType &src) const override
bool fast_polynomial_transfer_supported(const unsigned int fe_degree_fine, const unsigned int fe_degree_coarse)
void copy_to_host(VectorTypeHost &dst, const VectorType &src) const
VectorTypeHost host_vector_fine
MGTwoLevelTransferCopyToHost()=default
std::pair< const DoFHandler< dim > *, unsigned int > get_dof_handler_fine() const override
std::pair< bool, bool > enable_inplace_operations_if_possible(const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner_coarse, const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner_fine) override
void copy_from_host(VectorType &dst, const VectorTypeHost &src) const
void prolongate_and_add(VectorType &dst, const VectorType &src) const override
VectorTypeHost host_vector_coarse
void reinit(const DoFHandler< dim > &dof_handler_fine, const DoFHandler< dim > &dof_handler_coarse, const AffineConstraints< Number > &constraint_fine=AffineConstraints< Number >(), const AffineConstraints< Number > &constraint_coarse=AffineConstraints< Number >(), const unsigned int mg_level_fine=numbers::invalid_unsigned_int, const unsigned int mg_level_coarse=numbers::invalid_unsigned_int)
std::shared_ptr< NonMatching::MappingInfo< dim, dim, Number > > mapping_info
boost::signals2::connection connect_restriction(const std::function< void(const bool)> &slot)
void reinit(const DoFHandler< dim > &dof_handler_fine, const DoFHandler< dim > &dof_handler_coarse, const Mapping< dim > &mapping_fine, const Mapping< dim > &mapping_coarse, const AffineConstraints< Number > &constraint_fine=AffineConstraints< Number >(), const AffineConstraints< Number > &constraint_coarse=AffineConstraints< Number >())
AdditionalData additional_data
std::unique_ptr< FiniteElement< dim > > fe_coarse
std::vector< Number > rpe_input_output
ObserverPointer< const DoFHandler< dim > > dof_handler_fine
void restrict_and_add_internal_comp(VectorType &dst, const VectorType &src) const
boost::signals2::connection connect_prolongation_cell_loop(const std::function< void(const bool)> &slot)
std::vector< Number > rpe_buffer
std::size_t memory_consumption() const override
std::pair< bool, bool > enable_inplace_operations_if_possible(const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner_coarse, const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner_fine) override
Utilities::MPI::RemotePointEvaluation< dim > rpe
void restrict_and_add_internal(VectorType &dst, const VectorType &src) const override
std::vector< unsigned int > level_dof_indices_fine_ptrs
mg::SignalsNonNested signals_non_nested
internal::MatrixFreeFunctions::ConstraintInfo< dim, VectorizedArrayType, unsigned int > constraint_info
boost::signals2::connection connect_prolongation(const std::function< void(const bool)> &slot)
boost::signals2::connection connect_restriction_cell_loop(const std::function< void(const bool)> &slot)
void prolongate_and_add_internal_comp(VectorType &dst, const VectorType &src) const
MGTwoLevelTransferNonNested(const AdditionalData &data=AdditionalData())
void interpolate(VectorType &dst, const VectorType &src) const override
std::vector< unsigned int > level_dof_indices_fine
typename VectorType::value_type Number
unsigned int mg_level_fine
void prolongate_and_add_internal(VectorType &dst, const VectorType &src) const override
std::pair< const DoFHandler< dim > *, unsigned int > get_dof_handler_fine() const override
void reinit_geometric_transfer(const DoFHandler< dim > &dof_handler_fine, const DoFHandler< dim > &dof_handler_coarse, const AffineConstraints< Number > &constraint_fine=AffineConstraints< Number >(), const AffineConstraints< Number > &constraint_coarse=AffineConstraints< Number >(), const unsigned int mg_level_fine=numbers::invalid_unsigned_int, const unsigned int mg_level_coarse=numbers::invalid_unsigned_int)
internal::MatrixFreeFunctions::ConstraintInfo< dim, VectorizedArrayType, types::global_dof_index > constraint_info_fine
void reinit(const MatrixFree< dim, Number > &matrix_free_fine, const unsigned int dof_handler_index_fine, const MatrixFree< dim, Number > &matrix_free_coarse, const unsigned int dof_handler_index_coarse)
friend class internal::MGTwoLevelTransferImplementation
std::vector< MGTransferScheme > schemes
ObserverPointer< const DoFHandler< dim > > dof_handler_fine
friend class Portable::internal::MGTwoLevelTransferImplementation
typename VectorType::value_type Number
std::vector< unsigned char > weights_are_compressed
std::pair< const DoFHandler< dim > *, unsigned int > get_dof_handler_fine() const override
void interpolate(VectorType &dst, const VectorType &src) const override
internal::MatrixFreeFunctions::ConstraintInfo< dim, VectorizedArrayType, types::global_dof_index > constraint_info_coarse
std::unique_ptr< MatrixFreeRelatedData > matrix_free_data
static bool fast_polynomial_transfer_supported(const unsigned int fe_degree_fine, const unsigned int fe_degree_coarse)
AlignedVector< VectorizedArrayType > weights
void reinit_polynomial_transfer(const DoFHandler< dim > &dof_handler_fine, const DoFHandler< dim > &dof_handler_coarse, const AffineConstraints< Number > &constraint_fine=AffineConstraints< Number >(), const AffineConstraints< Number > &constraint_coarse=AffineConstraints< Number >(), const unsigned int mg_level_fine=numbers::invalid_unsigned_int, const unsigned int mg_level_coarse=numbers::invalid_unsigned_int)
unsigned int mg_level_fine
std::pair< bool, bool > enable_inplace_operations_if_possible(const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner_coarse, const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner_fine) override
void restrict_and_add_internal(VectorType &dst, const VectorType &src) const override
unsigned int n_components
std::vector< unsigned int > weights_start
void reinit(const DoFHandler< dim > &dof_handler_fine, const DoFHandler< dim > &dof_handler_coarse, const AffineConstraints< Number > &constraint_fine=AffineConstraints< Number >(), const AffineConstraints< Number > &constraint_coarse=AffineConstraints< Number >(), const unsigned int mg_level_fine=numbers::invalid_unsigned_int, const unsigned int mg_level_coarse=numbers::invalid_unsigned_int)
std::size_t memory_consumption() const override
void prolongate_and_add_internal(VectorType &dst, const VectorType &src) const override
Abstract base class for mapping classes.
Communicate values between a mesh and arbitrary points.
static constexpr std::size_t size()
bool fine_element_is_continuous
std::shared_ptr< const Utilities::MPI::Partitioner > partitioner_fine_embedded
void restrict_and_add(VectorType &dst, const VectorType &src) const override
virtual void restrict_and_add_internal(VectorType &dst, const VectorType &src) const =0
void zero_out_ghost_values(const VectorType &vec) const
AlignedVector< Number > buffer_fine_embedded
AlignedVector< Number > buffer_coarse_embedded
std::pair< bool, bool > internal_enable_inplace_operations_if_possible(const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner_coarse, const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner_fine, bool &vec_fine_needs_ghost_update, internal::MatrixFreeFunctions::ConstraintInfo< dim, VectorizedArray< Number, width >, IndexType > &constraint_info_coarse, std::vector< unsigned int > &dof_indices_fine)
void compress(VectorType &vec, const VectorOperation::values op) const
std::shared_ptr< const Utilities::MPI::Partitioner > partitioner_coarse_embedded
typename VectorType::value_type Number
bool vec_fine_needs_ghost_update
virtual void prolongate_and_add_internal(VectorType &dst, const VectorType &src) const =0
void prolongate_and_add(VectorType &dst, const VectorType &src) const override
void update_ghost_values(const VectorType &vec) const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcMessage(std::string arg1)
std::vector< index_type > data
std::enable_if_t< IsBlockVector< VectorType >::value, void > collect_sizes(VectorType &vector)
std::enable_if_t< IsBlockVector< VectorType >::value, unsigned int > n_blocks(const VectorType &vector)
Tensor< 2, dim, Number > l(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
* * * RotationFunction< dim, Number >::RotationFunction Number(dim)
T & get_underlying_value(T &p)
constexpr unsigned int invalid_unsigned_int
bool enforce_all_points_found
AdditionalData(const double tolerance=1e-6, const unsigned int rtree_level=0, const bool enforce_all_points_found=true)
unsigned int degree_coarse
unsigned int n_dofs_per_cell_coarse
unsigned int n_coarse_cells
AlignedVector< double > restriction_matrix
internal::MatrixFreeFunctions::ShapeInfo< double > shape_info_coarse
unsigned int n_dofs_per_cell_fine
AlignedVector< double > prolongation_matrix
boost::signals2::signal< void(const bool before)> prolongation_cell_loop
boost::signals2::signal< void(const bool before)> restriction
boost::signals2::signal< void(const bool before)> restriction_cell_loop
boost::signals2::signal< void(const bool before)> prolongation