DLR-AMR / t8code

Parallel algorithms and data structures for tree-based adaptive mesh refinement (AMR) with arbitrary element shapes.
https://dlr-amr.github.io/t8code/
GNU General Public License v2.0
153 stars 52 forks source link

Feature request: connectivity lists #413

Open jmark opened 1 year ago

jmark commented 1 year ago

This issue is primarly for noting down my thougths and make them available for the public in order to ignite an open discussion.

Looking from the Julia lang perspective (and also Trixi.jl, StartUpDG.jl, GPU programming, ...) it might be very convenient (and probably very efficient) to generate connectivity lists in t8code and pass them to the user as an alternative to iterator callback handlers.

What do I mean by connectivity lists? Take an examples from StartUpDG.jl :

# Simple hybrid mesh in 2D
# 
#   1  7______8______9
#      |      | 3  / |
#      |   4  |  / 5 |
#   0  4 ---- 5 ---- 6 
#      |      |      |
#      |   1  |   2  |
#   -1 1 ---- 2 ---- 3
#     -1      0      1

VX = [-1;  0;  1; -1; 0; 1; -1; 0; 1] # vertices x coordinates
VY = [-1; -1; -1;  0; 0; 0;  1; 1; 1] # vertices y coordinates
EToV = [[1 2 4 5], [2 3 5 6], [5 8 9], [4 5 7 8], [9 6 5]] # element to vertex map

# StartUpDG.jl builds its own representation of the mesh from above three arrays.

If t8code would give me directly above three arrays, this would simplify the interaction with t8code a lot and also would save lots of CPU cycles for transforming between the different grid representations of t8code and the application.

Moreover, the future for efficient computation is batch processing, especially on the GPU. This even goes beyond element boundaries (data of multiple elements is efficiently processed as one big chunk). I think element-wise iterators cannot account for this use case.

holke commented 1 year ago

Is this question about

or

The first one is a rather involved task that is planned in a PhD project at Uni Bonn. The second would be more or less copying code from the Advect example and wrapping it in an interface. The t8_mesh.c/h files (currently empty) are created as placeholders to contain this functionality.

jmark commented 1 year ago

Both. ;)

I understand that the first point is a rather evolved plan.

But if it is ok to provide such a kind of interface (according to the second point) than I am happy to stitch something together.