[petsc-dev] Uninitialized value 'basedimension2' in HDF5 Viewer

Håkon Strandenes haakon at hakostra.net
Fri Apr 17 05:36:58 CDT 2015



On 17. april 2015 12:20, Matthew Knepley wrote:
> On Fri, Apr 17, 2015 at 4:00 AM, Håkon Strandenes <haakon at hakostra.net
> <mailto:haakon at hakostra.net>> wrote:
>
>     Hi,
>
>     I don't think Bitbucket sends emails or does anything about comments
>     to commits, so I thought I could bring up a small issue here:
>
>     See my comment:
>     https://bitbucket.org/petsc/petsc/commits/056833d77d2d143230ea8833ad5b795a5f311c87?at=master
>     both to the commit itself and to file hdf5v.c:211.
>
>     Short summary:
>     I can't find any explicit default value for the basedimension2 flag
>     recently added to the HDF5 viewer (correct me if I'm wrong). I have
>     not read C or C++ standards closely, but unless the C/C++ standards
>     specify that all enums always should be initialized to their first
>     value, it seems to me that we rely on the compiler to choose a
>     default value. Could we also risk that the basedimension2 flag gets
>     a value that is neither PETSC_TRUE nor PETSC_FALSE, since the enum
>     maps to an int (at least in plain C), and the int can take values
>     different from 0 (PETSC_FALSE) and 1 (PETSC_TRUE)?
>
>     I also see that the binary viewer explicitly sets a default value
>     for all its PetscBool flags...
>
>
> The PetscNew call sets the memory to 0, which should give this value 0 I
> think.

Ah. Sorry for not spotting this.

Håkon

>
>    Thanks,
>
>       Matt
>
>     Regards,
>     Håkon
>
>
>     BTW:
>     I think this flag is great, and toggle it when switching between
>     writing plain Vecs (in which I do not want this extra dim for bs=1)
>     and DMDA's (where I find it practical to have an extra dim for dof=1).
>
>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which
> their experiments lead.
> -- Norbert Wiener



More information about the petsc-dev mailing list