-
Notifications
You must be signed in to change notification settings - Fork 708
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
Fix hp::Refinement::limit_p_level_difference
for p-coarsening
#16705
Merged
Merged
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Fixed: The function hp::Refinement::limit_p_level_difference() now | ||
correctly sets future FE indices in case of p-coarsening. | ||
<br> | ||
(Marc Fehling, 2024/02/29) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// ------------------------------------------------------------------------ | ||
// | ||
// SPDX-License-Identifier: LGPL-2.1-or-later | ||
// Copyright (C) 2021 - 2024 by the deal.II authors | ||
// | ||
// This file is part of the deal.II library. | ||
// | ||
// Part of the source code is dual licensed under Apache-2.0 WITH | ||
// LLVM-exception OR LGPL-2.1-or-later. Detailed license information | ||
// governing the source code and code contributions can be found in | ||
// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II. | ||
// | ||
// ------------------------------------------------------------------------ | ||
|
||
|
||
// hp::Refinement::limit_p_level_difference() used to ignore updating future | ||
// FE indices when they coincide with the active FE index of a cell. | ||
// This posed a problem with p-coarsening. | ||
|
||
|
||
#include <deal.II/dofs/dof_handler.h> | ||
|
||
#include <deal.II/fe/fe_q.h> | ||
|
||
#include <deal.II/grid/grid_generator.h> | ||
#include <deal.II/grid/tria.h> | ||
|
||
#include <deal.II/hp/fe_collection.h> | ||
#include <deal.II/hp/refinement.h> | ||
|
||
#include "../tests.h" | ||
|
||
#include "../test_grids.h" | ||
|
||
|
||
template <int dim> | ||
void | ||
test() | ||
{ | ||
// setup FE collection | ||
hp::FECollection<dim> fes; | ||
while (fes.size() < 3) | ||
fes.push_back(FE_Q<dim>(1)); | ||
|
||
// setup two cell triangulation | ||
Triangulation<dim> tria; | ||
TestGrids::hyper_line(tria, 2); | ||
|
||
DoFHandler<dim> dofh(tria); | ||
dofh.distribute_dofs(fes); | ||
|
||
// set both cells to the same active FE index, | ||
// and assign a future FE index one higher and one lower | ||
for (const auto &cell : dofh.active_cell_iterators()) | ||
{ | ||
cell->set_active_fe_index(1); | ||
|
||
if (cell->id().to_string() == "0_0:") | ||
cell->set_future_fe_index(2); | ||
else if (cell->id().to_string() == "1_0:") | ||
cell->set_future_fe_index(0); | ||
else | ||
Assert(false, ExcInternalError()); | ||
} | ||
|
||
const bool future_fe_indices_changed = | ||
hp::Refinement::limit_p_level_difference(dofh); | ||
|
||
(void)future_fe_indices_changed; | ||
Assert(future_fe_indices_changed, ExcInternalError()); | ||
|
||
// display FE indices for all cells | ||
for (const auto &cell : dofh.active_cell_iterators()) | ||
deallog << cell->id().to_string() << ": active:" << cell->active_fe_index() | ||
<< " future:" << cell->future_fe_index() | ||
<< " flag:" << cell->future_fe_index_set() << std::endl; | ||
|
||
deallog << "OK" << std::endl; | ||
} | ||
|
||
|
||
int | ||
main() | ||
{ | ||
initlog(); | ||
|
||
test<2>(); | ||
test<3>(); | ||
} |
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,7 @@ | ||
|
||
DEAL::0_0:: active:1 future:2 flag:1 | ||
DEAL::1_0:: active:1 future:1 flag:0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before the patch, this used to read
|
||
DEAL::OK | ||
DEAL::0_0:: active:1 future:2 flag:1 | ||
DEAL::1_0:: active:1 future:1 flag:0 | ||
DEAL::OK |
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.
Shall I already use the Apache license for new files?