Skip to content

Grid getter in FunctionSpace #260

@tom-j-h

Description

@tom-j-h

Is your feature request related to a problem? Please describe.

I'm working on something where it would be helpful for a FunctionSpace to be able to return a Grid.

If I understand correctly, all FunctionSpaces (excluding Spectral) should have a Grid underlying them in some way, whether that's directly ((Block)StructuredColumns), via the Mesh (Cell/Edge/NodeColumns), or implicitly via a list of Points (PointCloud).

Describe the solution you'd like

Could we have a getter in FunctionSpace, with implementations in each of the individual types except Spectral? This should be simple for the xColumns FunctionSpaces. PointCloud is trickier - I think we could generate a Grid on the fly using iterate() and return that, or return a Grid that was copied on construction of the PointCloud if it was constructed with one.

Describe alternatives you've considered

At the moment, I think I'd have to dynamic_cast to get the FunctionSpace of particualr type from the base FunctionSpace, then get Grids in the same way as described above.

Additional context

My use case is that we are implementing a simple parallel NetCDF I/O system for FieldSets in JEDI-OOPS. The first step before writing is to redistribute the data (using Redistribution) to a FunctionSpace on the same Grid as the native Fields (hence the need to obtain the grid) but who's Distribution is simply putting ~equal numbers of points onto each PE in order of Atlas's global index. The data is then written to the file in that order so that the files are agnostic to the number of PEs/domain decomposition of the native Fields. For reading the data back in, we do the reverse.

Organisation

Met Office

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions