GridTools / gtc

A stencil DSL toolchain written in Python.
GNU General Public License v3.0
0 stars 3 forks source link

Mesh traits and concept helpers #61

Open havogt opened 4 years ago

havogt commented 4 years ago
anstaf commented 4 years ago

The design challenges:

anstaf commented 4 years ago

Observations:

anstaf commented 4 years ago

Let us restrict the requirements to the neighbor chain with the following:

I.e the chain vertex->vertex->vertex is illegal. vertex->edge->vertex->edge->vertex should be used instead (which is semantically the same)

anstaf commented 4 years ago

Should Euler formula for the mesh be validated somewhere in the concept helpers? It is clear that meshes on torus or Klein bottle are not the target of the concept. However we can distinguish between meshes on sphere and meshes on disk (where the "outer" cell is explicitly excluded from neighbour tables). Should we support both?

anstaf commented 4 years ago

Let us assume that we calculate something on the mesh on disk. Suppose we are taking connectivity for the chain that ends on cell. For example vertex->edge->cell. If for the given vertex number the neighbours list contains -1 (skip value), the semantic meaning of that is ambiquis. Either the topological number of the neighbours for that vertix is less than max_neighbour, or there is a neighbour that on the other side of the disk border.

anstaf commented 3 years ago

Mesh Contracts

Mesh API for generated code

Generated code accepts mesh as a template parameter.

template <class Mesh, class... Fields>
void nabla(Mesh, Fields&&... fields)  {...}

Here Mesh is an empty class. This means that it is cheap to pass it everywhere by value (including kernel functions). The "real" state of the mesh is hold as a singleton. This singleton stays immutable after initialization.

Things that can be performed with the instance of Mesh (aka obj):

Mesh Generator Inputs