* Perform prolongation.
*/
void
- prolongate(VectorType &dst, const VectorType &src) const;
+ prolongate_and_add(VectorType &dst, const VectorType &src) const;
/**
* Perform restriction.
* Perform prolongation.
*/
void
- prolongate(LinearAlgebra::distributed::Vector<Number> & dst,
- const LinearAlgebra::distributed::Vector<Number> &src) const;
+ prolongate_and_add(
+ LinearAlgebra::distributed::Vector<Number> & dst,
+ const LinearAlgebra::distributed::Vector<Number> &src) const;
/**
* Perform restriction.
VectorType & dst,
const VectorType & src) const override;
+ /**
+ * Perform prolongation.
+ */
+ void
+ prolongate_and_add(const unsigned int to_level,
+ VectorType & dst,
+ const VectorType & src) const override;
+
/**
* Perform restriction.
*/
VectorType & dst,
const VectorType & src) const
{
- this->transfer[to_level].prolongate(dst, src);
+ dst = 0;
+ prolongate_and_add(to_level, dst, src);
+}
+
+
+
+template <int dim, typename VectorType>
+void
+MGTransferGlobalCoarsening<dim, VectorType>::prolongate_and_add(
+ const unsigned int to_level,
+ VectorType & dst,
+ const VectorType & src) const
+{
+ this->transfer[to_level].prolongate_and_add(dst, src);
}
template <int dim, typename Number>
void
-MGTwoLevelTransfer<dim, LinearAlgebra::distributed::Vector<Number>>::prolongate(
- LinearAlgebra::distributed::Vector<Number> & dst,
- const LinearAlgebra::distributed::Vector<Number> &src) const
+MGTwoLevelTransfer<dim, LinearAlgebra::distributed::Vector<Number>>::
+ prolongate_and_add(
+ LinearAlgebra::distributed::Vector<Number> & dst,
+ const LinearAlgebra::distributed::Vector<Number> &src) const
{
using VectorizedArrayType = VectorizedArray<Number>;
this->vec_coarse
.update_ghost_values(); // note: make sure that ghost values are set
- if (fine_element_is_continuous)
+ if (fine_element_is_continuous && (use_dst_inplace == false))
*vec_fine_ptr = Number(0.);
AlignedVector<VectorizedArrayType> evaluation_data_fine;
weights[i];
else
for (unsigned int i = 0; i < scheme.dofs_per_cell_fine; ++i)
- vec_fine_ptr->local_element(indices_fine[i]) =
+ vec_fine_ptr->local_element(indices_fine[i]) +=
this->vec_coarse.local_element(indices_coarse[i]);
indices_fine += scheme.dofs_per_cell_fine;
evaluation_data_fine[i][v] * weights[i];
else
for (unsigned int i = 0; i < scheme.dofs_per_cell_fine; ++i)
- vec_fine_ptr->local_element(indices[i]) =
+ vec_fine_ptr->local_element(indices[i]) +=
evaluation_data_fine[i][v];
indices += scheme.dofs_per_cell_fine;
vec_fine_ptr->compress(VectorOperation::add);
if (use_dst_inplace == false)
- dst.copy_locally_owned_data_from(this->vec_fine);
+ dst += this->vec_fine;
}
{
src = 0.0;
src = 1.0;
- transfer.prolongate(dst, src);
+ dst = 0.0;
+ transfer.prolongate_and_add(dst, src);
// transfer operator sets only non-constrained dofs -> update the rest
// via constraint matrix
src[i] = 1.0;
dst = 0.0;
- transfer.prolongate(dst, src);
+ transfer.prolongate_and_add(dst, src);
for (unsigned int j = 0; j < dst.size(); j++)
prolongation_matrix[j][i] = dst[j];