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

Simplify mesh creation interface and algorithms #2954

Merged
merged 92 commits into from
Jan 5, 2024

Conversation

garth-wells
Copy link
Member

This PR simplifies the interfaces for mesh creation from topology and geometry data, and simplifies many of the associated algorithms. It fixes #2949.

Background

The mesh interface has been complicated by using an adjacency list for cells when we only support one cell type in a mesh, and by having vectors of cell type and element coordinate maps in topology and geometry, and an obscure 'cell offset' array. The current discussion on how to support mixed topology meshes is pointing away from an adjacency list being the appropriate data structure for cells of mesh. The direction of travel is to store different cell types separately. This will make many algorithms much simpler, and it preserves the IndexMap abstraction (which was broken when mixing different cell types in a single data structures.

Next steps

When adding mixed topology support, we should start from the bottom up. The eventual design will inform the appropriate interfaces.

If we need functions like:

/// @warning Experimental interface for ...
const std::vector<mesh::CoordinateElement<T>>& dolfinx::mesh::Geometry::cmaps() const
{ return _cmaps; }

we should do

const mesh::CoordinateElement<T>& dolfinx::mesh::Geometry::cmap() const
{
  if (_cmaps.size() > 1)
     throw std::runtime_error("Geometry has more than one coordinate element");
  assert(!_cmaps.empty());
  return _cmaps.front();
}

to avoid (i) introducing pollution throughout the code and (ii) to give much more robust error handling as we transition to supporting mixed topology.

@garth-wells garth-wells added this pull request to the merge queue Jan 5, 2024
Merged via the queue into main with commit b9db7ba Jan 5, 2024
19 checks passed
@garth-wells garth-wells deleted the garth/mesh-simplifications-4 branch January 5, 2024 17:00
jorgensd added a commit to jorgensd/dolfinx_mpc that referenced this pull request Jan 8, 2024
jorgensd added a commit to jorgensd/adios4dolfinx that referenced this pull request Jan 8, 2024
jorgensd added a commit to jorgensd/dolfinx_mpc that referenced this pull request Jan 8, 2024
* Fixes related to
FEniCS/dolfinx#2890
Currently need to rewrite distribute_ghost_data, as it needs all blocks to create the compressed map.
Plan is to add it as extra input

* Resolve issues with global_to_local. See: FEniCS/dolfinx#2963

* Fix option name

* Revert branches

* API changes from: FEniCS/dolfinx#2954
jorgensd added a commit to jorgensd/adios4dolfinx that referenced this pull request Jan 8, 2024
* API changes: FEniCS/dolfinx#2954

* Add dev0 to dep bound

* Add dtype to basix.ufl elements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplify mesh creation interface (remove AdjacencyList for cells, use flat or 2D array)
4 participants