MeshValueCollection for cell is wrongly handled in parallel
Issue #368
resolved
There is a problem in MeshPartitioning::build_mesh_domains
when each partition has exactly 1 element and and cells are marked. Then mesh/MeshPartitioning.h:1103
raises a segfault (d - d connectivity is empty). But in general it is wrong anyway, because a marked cell is referenced as the 0 local entity of entities of dimension d, and this is clearly not contained in d - d connectivity (accordingly to dolfin personal definition of d - d connectivity).
An easy fix is:
diff --git a/dolfin/mesh/MeshPartitioning.cpp b/dolfin/mesh/MeshPartitioning.cpp
index bc8853d..3d41634 100644
--- a/dolfin/mesh/MeshPartitioning.cpp
+++ b/dolfin/mesh/MeshPartitioning.cpp
@@ -1099,9 +1099,14 @@ void MeshPartitioning::build_mesh_domains(Mesh& mesh,
const std::size_t cell_index = it->first.first;
const std::size_t local_entity_index = it->first.second;
- const Cell cell(mesh, cell_index);
- const MeshEntity e(mesh, dim, cell.entities(dim)[local_entity_index]);
- markers[e.index()] = it->second;
+ if ( dim == D )
+ markers[0] = it->second;
+ else
+ {
+ const Cell cell(mesh, cell_index);
+ const MeshEntity e(mesh, dim, cell.entities(dim)[local_entity_index]);
+ markers[e.index()] = it->second;
+ }
}
}
}
The procedure should be further optimized by properly changing build_mesh_value_collection
, because it initializes d - d connectivity, which we know is very expensive and clearly useless in this context.
Comments (2)
-
-
- changed status to resolved
Fix issue 368.
→ <<cset 27ddc3805efa>>
- Log in to comment
Another sign of the inconsistency with d-d connectivity.