Skip to content

Commit

Permalink
Use within MGTransferMatrixFree::build()
Browse files Browse the repository at this point in the history
  • Loading branch information
peterrum committed Jul 6, 2021
1 parent 4d01b83 commit 011b9d3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
14 changes: 7 additions & 7 deletions include/deal.II/multigrid/mg_transfer.h
Original file line number Diff line number Diff line change
Expand Up @@ -619,20 +619,20 @@ class MGLevelGlobalTransfer<LinearAlgebra::distributed::Vector<Number>>
mutable MGLevelObject<LinearAlgebra::distributed::Vector<Number>>
solution_ghosted_level_vector;

/**
* Function to initialize internal level vectors.
*/
std::function<void(const unsigned int,
LinearAlgebra::distributed::Vector<Number> &)>
initialize_dof_vector;

private:
/**
* This function is called to make sure that build() has been invoked.
*/
template <int dim, int spacedim>
void
assert_built(const DoFHandler<dim, spacedim> &dof_handler) const;

/**
* Function to initialize internal level vectors.
*/
const std::function<void(const unsigned int,
LinearAlgebra::distributed::Vector<Number> &)>
initialize_dof_vector;
};


Expand Down
8 changes: 8 additions & 0 deletions source/multigrid/mg_transfer_matrix_free.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ MGTransferMatrixFree<dim, Number>::build(
const std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
&external_partitioners)
{
if (external_partitioners.size() > 0)
this->initialize_dof_vector =
[&external_partitioners](
const unsigned int level,
LinearAlgebra::distributed::Vector<Number> &vec) {
vec.reinit(external_partitioners[level]);
};

this->fill_and_communicate_copy_indices(dof_handler);

vector_partitioners.resize(0,
Expand Down

0 comments on commit 011b9d3

Please sign in to comment.