hi, I am testing my (Fortran) code on PETSc 3.22 and have got it to
build. However I am getting some unusual new behaviour when I write an
IS to an HDF5 file using ISView().
The attached minimal example shows the issue. It creates a simple
10-element IS and writes it to HDF5. With previous versions of PETSc
this would give me a 10x1 dataset containing the values 0 - 9, as expected.
When I run it with PETSc 3.22 (in serial), I again get the expected
values written on stdout, so it looks like the IS itself is correct. But
in the HDF5 file I get a 1x3 dataset containing the values (10,1,0).
Has something changed here?
- Adrian
--
Dr Adrian Croucher
Senior Research Fellow
Department of Engineering Science
Waipapa Taumata Rau / University of Auckland, New Zealand
email: a.crouc...@auckland.ac.nz
tel: +64 (0)9 923 4611
program test_is
! Test viewing IS to HDF5 file
#include <petsc/finclude/petsc.h>
use petsc
implicit none
PetscViewer :: viewer
PetscErrorCode :: ierr
IS :: v
PetscInt, parameter :: n = 10
PetscInt :: i, vals(n)
character(16), parameter :: filename = "is.h5"
call PetscInitialize(PETSC_NULL_CHARACTER, ierr)
vals = [(i, i = 0, n - 1)]
call ISCreateGeneral(PETSC_COMM_WORLD, n, vals, &
PETSC_COPY_VALUES, v, ierr)
call PetscObjectSetName(v, "v", ierr)
call PetscViewerHDF5Open(PETSC_COMM_WORLD, filename, FILE_MODE_WRITE, &
viewer, ierr)
call PetscViewerHDF5PushGroup(viewer, "/", ierr)
call ISView(v, PETSC_VIEWER_STDOUT_WORLD, ierr)
call ISView(v, viewer, ierr)
call PetscViewerDestroy(viewer, ierr)
call PetscFinalize(ierr)
end program test_is