-
Notifications
You must be signed in to change notification settings - Fork 707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce MGTransferBlockGlobalCoarsening #13637
Merged
kronbichler
merged 2 commits into
dealii:master
from
peterrum:MGTransferBlockGlobalCoarsening
May 11, 2022
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
include/deal.II/multigrid/mg_transfer_matrix_free.templates.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// --------------------------------------------------------------------- | ||
// | ||
// Copyright (C) 2016 - 2021 by the deal.II authors | ||
// | ||
// This file is part of the deal.II library. | ||
// | ||
// The deal.II library is free software; you can use it, redistribute | ||
// it, and/or modify it under the terms of the GNU Lesser General | ||
// Public License as published by the Free Software Foundation; either | ||
// version 2.1 of the License, or (at your option) any later version. | ||
// The full text of the license can be found in the file LICENSE.md at | ||
// the top level directory of deal.II. | ||
// | ||
// --------------------------------------------------------------------- | ||
|
||
#ifndef dealii_mg_transfer_matrix_free_templates_h | ||
#define dealii_mg_transfer_matrix_free_templates_h | ||
|
||
#include <deal.II/base/config.h> | ||
|
||
#include <deal.II/multigrid/mg_transfer_matrix_free.h> | ||
|
||
|
||
DEAL_II_NAMESPACE_OPEN | ||
|
||
template <int dim, typename Number, typename TransferType> | ||
void | ||
MGTransferBlockMatrixFreeBase<dim, Number, TransferType>::prolongate( | ||
const unsigned int to_level, | ||
LinearAlgebra::distributed::BlockVector<Number> & dst, | ||
const LinearAlgebra::distributed::BlockVector<Number> &src) const | ||
{ | ||
const unsigned int n_blocks = src.n_blocks(); | ||
AssertDimension(dst.n_blocks(), n_blocks); | ||
|
||
for (unsigned int b = 0; b < n_blocks; ++b) | ||
{ | ||
const unsigned int data_block = same_for_all ? 0 : b; | ||
get_matrix_free_transfer(data_block) | ||
.prolongate(to_level, dst.block(b), src.block(b)); | ||
} | ||
} | ||
|
||
|
||
|
||
template <int dim, typename Number, typename TransferType> | ||
void | ||
MGTransferBlockMatrixFreeBase<dim, Number, TransferType>::prolongate_and_add( | ||
const unsigned int to_level, | ||
LinearAlgebra::distributed::BlockVector<Number> & dst, | ||
const LinearAlgebra::distributed::BlockVector<Number> &src) const | ||
{ | ||
const unsigned int n_blocks = src.n_blocks(); | ||
AssertDimension(dst.n_blocks(), n_blocks); | ||
|
||
for (unsigned int b = 0; b < n_blocks; ++b) | ||
{ | ||
const unsigned int data_block = same_for_all ? 0 : b; | ||
get_matrix_free_transfer(data_block) | ||
.prolongate_and_add(to_level, dst.block(b), src.block(b)); | ||
} | ||
} | ||
|
||
|
||
|
||
template <int dim, typename Number, typename TransferType> | ||
void | ||
MGTransferBlockMatrixFreeBase<dim, Number, TransferType>::restrict_and_add( | ||
const unsigned int from_level, | ||
LinearAlgebra::distributed::BlockVector<Number> & dst, | ||
const LinearAlgebra::distributed::BlockVector<Number> &src) const | ||
{ | ||
const unsigned int n_blocks = src.n_blocks(); | ||
AssertDimension(dst.n_blocks(), n_blocks); | ||
|
||
for (unsigned int b = 0; b < n_blocks; ++b) | ||
{ | ||
const unsigned int data_block = same_for_all ? 0 : b; | ||
get_matrix_free_transfer(data_block) | ||
.restrict_and_add(from_level, dst.block(b), src.block(b)); | ||
} | ||
} | ||
|
||
DEAL_II_NAMESPACE_CLOSE | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you assign a better name to this variable
b
?