Skip to content
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

Correct an error in the reduceNbGhostLayers() method #1785

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions arcane/src/arcane/cartesianmesh/CartesianMesh.cc
Original file line number Diff line number Diff line change
Expand Up @@ -777,18 +777,21 @@ reduceNbGhostLayers(Integer level, Integer target_nb_ghost_layers)
}

level_max = m_mesh->parallelMng()->reduce(Parallel::ReduceMax, level_max);
//debug() << "Level max : " << level_max;

computeDirections();

Integer level_0_nb_ghost_layer = m_mesh->ghostLayerMng()->nbGhostLayer();
//info() << "NbGhostLayers : " << level_0_nb_ghost_layer;
//debug() << "NbGhostLayers level 0 : " << level_0_nb_ghost_layer;

if (level_0_nb_ghost_layer == 0) {
return 0;
}

Integer nb_ghost_layer = Convert::toInt32(level_0_nb_ghost_layer * pow(2, level));

//debug() << "NbGhostLayers level " << level << " : " << nb_ghost_layer;

// On considère qu'on a toujours 2*2 mailles filles (2*2*2 en 3D).
if (target_nb_ghost_layers % 2 != 0) {
target_nb_ghost_layers++;
Expand All @@ -798,6 +801,8 @@ reduceNbGhostLayers(Integer level, Integer target_nb_ghost_layers)
return nb_ghost_layer;
}

//debug() << "TargetNbGhostLayers level " << level << " : " << target_nb_ghost_layers;

Integer parent_level = level - 1;
Integer parent_target_nb_ghost_layer = target_nb_ghost_layers / 2;

Expand All @@ -809,6 +814,7 @@ reduceNbGhostLayers(Integer level, Integer target_nb_ghost_layers)

children_list = [&cell_lid2, &children_list](Cell cell) -> void {
for (Integer i = 0; i < cell.nbHChildren(); ++i) {
//debug() << "child of lid=" << cell.localId() << " : lid=" << cell.hChild(i).localId() << " -- level : " << cell.level();
cell_lid2[cell.level()].add(cell.hChild(i).localId());
children_list(cell.hChild(i));
}
Expand Down Expand Up @@ -862,7 +868,7 @@ reduceNbGhostLayers(Integer level, Integer target_nb_ghost_layers)
}

// Maille n'ayant pas de nodes déjà traités.
if (min == 10 && max == -1) {
if (min == max_nb_layer && max == -1) {
continue;
}

Expand Down Expand Up @@ -898,7 +904,7 @@ reduceNbGhostLayers(Integer level, Integer target_nb_ghost_layers)
if (m_mesh->parallelMng()->reduce(Parallel::ReduceMax, cell_lid2[i].size()) == 0) {
continue;
}
//debug() << "Ghost cells to remove (level=" << i << ") (localIds) : " << cell_lid2[i];
//debug() << "Removing children of ghost cell (parent level=" << i << ") (children localIds) : " << cell_lid2[i];

m_mesh->modifier()->flagCellToCoarsen(cell_lid2[i]);
m_mesh->modifier()->coarsenItemsV2(false);
Expand Down
2 changes: 1 addition & 1 deletion arcane/src/arcane/mesh/MeshRefinement.cc
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@
}
// Si la maille à côté est raffinée, on aura plus d'un niveau de décalage.
if (other_cell.nbHChildren() != 0) { // && !(other_cell.mutableItemBase().flags() & ItemFlags::II_Coarsen)) { // Impossible de dé-raffiner plusieurs niveaux.
ARCANE_FATAL("Once level diff between two cells needed -- Cell uid: {0} -- Opposite cell uid: {1}", cell.uniqueId(), other_cell.uniqueId());
ARCANE_FATAL("Max one level diff between two cells is allowed -- Uid of Cell to be coarseing: {0} -- Uid of Opposite cell with children: {1}", cell.uniqueId(), other_cell.uniqueId());

Check warning on line 667 in arcane/src/arcane/mesh/MeshRefinement.cc

View check run for this annotation

Codecov / codecov/patch

arcane/src/arcane/mesh/MeshRefinement.cc#L667

Added line #L667 was not covered by tests
}
// Si la maille d'à côté n'est pas à nous, elle prend la propriété de la maille d'à côté.
if (other_cell.owner() != cell.owner()) {
Expand Down
Loading