jorgensd / jorgensd/adios4dolfinx

Global cells in legacy files

Open
#23 0 comments 0 reactions 0 assignees View on GitHub
dolfin-legacy help wanted
Dominant language
Python
Stars
33
Forks
8
Avg merge
22d 12h
Merged PRs (30d)
1

Description

In legacy dolfin, each function where stored with a `cells` group. I suspect this has something to do with the partition used when saving the file, but currently this information is not used in `adios4dolfinx`.

Here is a function for reading the global cells.

```python
def read_global_cells(filename: pathlib.Path, group: str):

adios = adios2.ADIOS(MPI.COMM_WORLD)
io = adios.DeclareIO("Cells reader")
io.SetEngine("HDF5")

# Open ADIOS2 Reader
infile = io.Open(str(filename), adios2.Mode.Read)
cells = io.InquireVariable(f"/{group}/cells")
num_cells_global = cells.Shape()[0]
cells.SetSelection([[0], [num_cells_global]])

global_cells = np.empty(num_cells_global, dtype=cells.Type().strip("_t"))
infile.Get(cells, global_cells, adios2.Mode.Sync)
infile.Close()
assert adios.RemoveIO("Cells reader")
return global_cells.astype(np.int64)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.