<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jul 16, 2015 at 1:31 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>
> On Jul 16, 2015, at 11:14 AM, Jed Brown <<a href="mailto:jed@jedbrown.org">jed@jedbrown.org</a>> wrote:<br>
><br>
> Gianluca Meneghello <<a href="mailto:gianmail@gmail.com">gianmail@gmail.com</a>> writes:<br>
><br>
>> Hi again,<br>
>><br>
>> I am now trying to write a vector to an HDF5, this time using a DM<br>
>> structure to impose the vector layout.<br>
>><br>
>> Creating the vector with (as in src/dm/examples/tutorials/ex10.c)<br>
>><br>
>> DMCreateGlobalVector(da2D,&gauss);<br>
>><br>
>> every works fine, i.e. the hdf5 file has the correct layout given by the<br>
>> dimension of the DM. On the other side, if I use:<br>
>><br>
>> VecCreate(PETSC_COMM_WORLD,&gauss);<br>
>> VecSetSizes(gauss,PETSC_DECIDE,Nx*Ny);<br>
>> VecSetDM(gauss,da2D);<br>
><br>
> VecSetDM only associates a DM with the Vec. It does not interpose<br>
> itself into VecView.<br>
><br>
> Should we change this so that creating a Vec of the correct size/block<br>
> size/layout and associating a DM is equivalent? Perhaps, but it's more<br>
> nuanced than it might seem.<br>
<br>
Yikes. VecSetDM() seems a very dangerous and odd thing. Should it exist? If it exists it seems it should be exactly equivalent to creating the vector from the DM.<br></blockquote><div><br></div><div>I tend to disagree. It is used to set a member variable which is not exposed:</div><div><br></div><div><div>find src -name "*.c" | xargs grep VecSetDM</div><div>src/dm/impls/composite/pack.c: ierr = VecSetDM(*gvec, dm);CHKERRQ(ierr);</div><div>src/dm/impls/composite/pack.c: ierr = VecSetDM(*lvec, dm);CHKERRQ(ierr);</div><div>src/dm/impls/da/dadist.c: ierr = VecSetDM(*g, da);CHKERRQ(ierr);</div><div>src/dm/impls/da/dalocal.c: ierr = VecSetDM(*g, da);CHKERRQ(ierr);</div><div>src/dm/impls/network/networkcreate.c: ierr = VecSetDM(*vec,dm);CHKERRQ(ierr);</div><div>src/dm/impls/network/networkcreate.c: ierr = VecSetDM(*vec,dm);CHKERRQ(ierr);</div><div>src/dm/impls/redundant/dmredundant.c: ierr = VecSetDM(*gvec,dm);CHKERRQ(ierr);</div><div>src/dm/impls/redundant/dmredundant.c: ierr = VecSetDM(*lvec,dm);CHKERRQ(ierr);</div><div>src/dm/impls/shell/dmshell.c: ierr = VecSetDM(*gvec,dm);CHKERRQ(ierr);</div><div>src/dm/impls/shell/dmshell.c: ierr = VecSetDM(*gvec,dm);CHKERRQ(ierr);</div><div>src/dm/impls/sliced/sliced.c: ierr = VecSetDM(*gvec,dm);CHKERRQ(ierr);</div><div>src/dm/interface/dmi.c: ierr = VecSetDM(*vec, dm);CHKERRQ(ierr);</div><div>src/dm/interface/dmi.c: ierr = VecSetDM(*vec, dm);CHKERRQ(ierr);</div><div>src/dm/interface/ftn-auto/dmf.c:*__ierr = VecSetDM(</div></div><div><br></div><div> I don't like putting in a bunch of side-effects. Those come from actually being created from a DM, which is correct.</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
><br>
> Why don't you want to just call DMCreateGlobalVector()?<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">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>
</div></div>