Many thanks! My rationale: I have abstracted a C++ class called PetscLinearSolver that is supposed to wrap all the complex ksp &amp; co functionality in an easy to use C++ class. There, I do not know apriori if a class user will want to have x and b ghosted or not - that depends on the problem type. So even it it is known in runtime, it is not known in coding or setup time. Therefore I would benefit from a function to declare a vector as ghosted.<div>
<br></div><div>Dominik<br><div><br><div class="gmail_quote">On Wed, Oct 19, 2011 at 11:54 PM, Barry Smith <span dir="ltr">&lt;<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5"><br>
On Oct 19, 2011, at 1:27 PM, Jed Brown wrote:<br>
<br>
&gt; On Wed, Oct 19, 2011 at 13:26, Dominik Szczerba &lt;<a href="mailto:dominik@itis.ethz.ch">dominik@itis.ethz.ch</a>&gt; wrote:<br>
&gt; Is it possible to VecCreate() first and set its type to ghosted later, just as it is possible with VECMPI?<br>
&gt;<br>
&gt; Not currently, you have to use VecCreateGhost*().<br>
<br>
<br>
</div></div>  Ghosting is basically a property of VECMPI not a different vector class.  I have added a VecMPISetGhost() to petsc-dev that you can call after VecCreate(), VecSetType() and VecSetSizes().<br>
<br>
   It is not clear to me that this is a particularly useful function because you generally decide before you write the code if you are going to use ghosted vectors or not; that is, it is unlikely it is a runtime decision so you might as well just use VecCreateGhost() instead of the sequence VecCreate(), VecSetType(), VecSetSizes(), VecMPISetGhost(). But for uniformity of PETSc style it is good to have it so here it is.<br>

<font color="#888888"><br>
<br>
  Barry<br>
<br>
<br>
</font></blockquote></div><br></div></div>