This Message Is From an External Sender
This message came from outside your organization.
PetscBinaryIO errors when reading a Vec with zero elements. The following python script demonstrates the issue:
--8<---------------cut here---------------start------------->8--- import PetscBinaryIO import numpy as np io = PetscBinaryIO.PetscBinaryIO() v = np.array([], np.float32).view(PetscBinaryIO.Vec) io.writeBinaryFile("test.bin", (v,)) io.readBinaryFile("test.bin") --8<---------------cut here---------------end--------------->8--- --8<---------------cut here---------------start------------->8--- [...] File "/[...]/lib/petsc/bin/PetscBinaryIO.py", line 258, in readVec raise IOError('Inconsistent or invalid Vec data in file') OSError: Inconsistent or invalid Vec data in file --8<---------------cut here---------------end--------------->8--- Tested on 3.20.5. readVec errors if `len(vals) == 0`, but maybe the check should be `len(vals) != nz`? -- Nick OBrien