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

Global cells in legacy files #23

Open
finsberg opened this issue Aug 9, 2023 · 0 comments
Open

Global cells in legacy files #23

finsberg opened this issue Aug 9, 2023 · 0 comments
Labels
dolfin-legacy Issues related to reading data from legacy Dolfin files help wanted Extra attention is needed

Comments

@finsberg
Copy link
Collaborator

finsberg commented Aug 9, 2023

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.

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)
@jorgensd jorgensd added the help wanted Extra attention is needed label Feb 9, 2024
@jorgensd jorgensd added the dolfin-legacy Issues related to reading data from legacy Dolfin files label Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dolfin-legacy Issues related to reading data from legacy Dolfin files help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants