Current Topology initializer just takes in an MPI communicator and a cell type, and then all other information is passed through set_index_map or set_connectivity or original_cell_index.
However, a topology isn't really valid (none of the create_entities or create_connectivity functions can be called without):
A cell index map
A vertex index map
A cell_to_vertex connectivity
Original cell indices ( Not required for create_*, but for reading external data).
Additionally, users can make invalid connections or index maps through set_index_map and set_connectivity post initialization.
A benefit of this is that we allow for an "adaptive mesh topology".
However, we do not have the same flexibility for the mesh geometry (cannot replace index map or change the size of x, or the indices of the dofmap).
Thus, I propose we refactor topology such that:
Initializer: Takes in communicator, cell_type, cell_index_map, vertex_index_map, c_to_v and original_cell_indices
Destruction of connectivity: Sometimes users might want to delete a connectivity after usage. We could have a clear_connectivity(i, j) that removes the connectivity (and guards against removal of c_to_v, c_to_c or v_to_v connectivity).
Destruction of entities: Can currently be done with set_index_map (which is unsafe). Should be done with a clear_entities(i) with guards against clearing cells or vertices.
Describe new/missing feature
Current Topology initializer just takes in an MPI communicator and a cell type, and then all other information is passed through
set_index_map
orset_connectivity
ororiginal_cell_index
. However, a topology isn't really valid (none of thecreate_entities
orcreate_connectivity
functions can be called without):Additionally, users can make invalid connections or index maps through
set_index_map
andset_connectivity
post initialization.A benefit of this is that we allow for an "adaptive mesh topology". However, we do not have the same flexibility for the mesh geometry (cannot replace index map or change the size of
x
, or the indices of the dofmap).Thus, I propose we refactor topology such that:
clear_connectivity(i, j)
that removes the connectivity (and guards against removal of c_to_v, c_to_c or v_to_v connectivity).set_index_map
(which is unsafe). Should be done with aclear_entities(i)
with guards against clearing cells or vertices.Suggested user interface
No response