<div dir="ltr">Thanks Matt.<br><br>Given the PETSc way of doing things, I believe the following should be possible:<br><div>[1] attach an option prefix to a viewer<br></div><div>[2] skip the header on some binary viewers<br></div><div>[3] use mpiio for some binary viewers, but not all of them.<br></div><br><div>However, it doesn't appear to be completely simple to allow this behaviour.<br></div><div><br>For instance, replacing<br>    ierr = PetscOptionsGetBool(NULL,"-viewer_binary_mpiio",&useMPIIO,NULL);CHKERRQ(ierr);<br>with <br>    ierr = PetscOptionsGetBool(((PetscObject)viewer)->prefix,"-viewer_binary_mpiio",&useMPIIO,NULL);CHKERRQ(ierr);<br></div>won't work as an option prefix will never have been set.<br><div><br></div><div>If I was to add a PetscViewerSetFromOptions_Binary(), I would have to ensure that PetscViewerSetFromOptions() was called before PetscViewerFileSetName() was called as the latter this triggers a swap of the functions used to open binary file, e.g. from PetscViewerFileSetName_Binary() to PetscViewerFileSetName_MPIIO()<br><br></div><div>Would it be simpler and cleaner to have MPIIO be defined as an independent implementation which was a sub-class of the binary class?<br></div><div><br>Then we could use command line flags to switch between implementations at runtime<br></div><div>  -xxx_viewer_type binary<br></div><div>versus<br></div><div><div>  -xxx_viewer_type mpiio<br></div>rather than having to use<br></div><div>  -xxx_viewer_type binary -viewer_binary_mpiio<br></div><div>which has obvious short comings like forcing all binary viewers, independent of the prefix to use mpiio. It would also allow the PetscViewer object to be used in a manner which follows the standard PETSc pattern of: XXCreate(), XXSetOptionsPrefix(), XXSetType(), XXSetFromOptions().<br><br></div><div>Then we could do this<br></div><div>  PetscViewerCreate()<br></div><div>  PetscViewerSetOptionsPrefix()<br></div><div>  PetscViewerSetType()<br>  PetscViewerFileSetMode()<br>  PetscViewerBinarySetSkipHeader()<br>  PetscViewerFileSetName()<br></div><div>  PetscViewerSetFromOptions()<br></div><div>and it wouldn't matter which order SetName(), BinarySkipHeader() etc were called.<br><br></div><div>What do people think?<br><br><br>Cheers<br></div><div>  Dave<br></div><div><br><br></div><div><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 30 January 2015 at 13:56, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Fri, Jan 30, 2015 at 2:06 AM, Dave May <span dir="ltr"><<a href="mailto:dave.mayhem23@gmail.com" target="_blank">dave.mayhem23@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hello,<br><br></div>I've noticed the create function PetscViewerCreate_Binary() doesn't appear to be using the options prefix attached to the PetscViewer.<br></div><div>Specifically, I see on line 1276 of <br>  petsc-3.5.2/src/sys/classes/viewer/impls/binary/binv.c<br>the following<br>  ierr = PetscOptionsGetBool(NULL,"-viewer_binary_mpiio",&useMPIIO,NULL);CHKERRQ(ierr);<br><br></div><div>Is this an oversight or something intentional?</div></div></div></div></blockquote><div><br></div></span><div>This is an oversight.</div><div><br></div><div>  Matt</div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Are PetscViewers in general behaving such that they cannot be configured independently of each other if<br></div>PetscViewerSetOptionsPrefix() and PetscViewerSetFromOptions() are called?<br><br><br>Cheers<span><font color="#888888"><br></font></span></div><span><font color="#888888">  Dave<br></font></span></div>
</blockquote></span></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</font></span></div></div>
</blockquote></div><br></div>