<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Feb 1, 2017 at 11:46 PM, Praveen C <span dir="ltr"><<a href="mailto:cpraveen@gmail.com" target="_blank">cpraveen@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">Dear all<div>I am creating a vector in fortran like this</div><div><br><p style="margin:0px;font-size:13px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="color:rgb(51,187,200)">PetscReal,allocatable :: res(:,:)</span><br></p><p style="margin:0px;font-size:13px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(51,187,200)">Vec :: v_res</span></p><p style="margin:0px;font-size:13px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(51,187,200)">allocate( res(nvar,nvl_nvg) )</span></p><p style="margin:0px;font-size:13px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(51,187,200)">call</span><span style="font-variant-ligatures:no-common-ligatures"> VecCreateMPIWithArray(PETSC_<wbr>COMM_WORLD, nvar, nvar</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,188,38)">*</span><span style="font-variant-ligatures:no-common-ligatures">nvl, </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(213,59,211)">&</span></p>
<p style="margin:0px;font-size:13px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> PETSC_DECIDE, res(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">1</span><span style="font-variant-ligatures:no-common-ligatures">,</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">1</span><span style="font-variant-ligatures:no-common-ligatures">), v_res, </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(213,59,211)">&</span></p>
<p style="margin:0px;font-size:13px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"> ierr); CHKERRQ(ierr)</span></p><p style="margin:0px;font-size:13px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p>Note that my array "res" is larger than needed by the vector v_res.</div><div><br></div><div>Is this ok to do this ? </div></div></blockquote><div><br></div><div>Yes</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I use the extra "res" array for dummy ghost values, but I dont need v_res to be ghosted.</div><div><br></div><div>Thanks</div><span class="HOEnZb"><font color="#888888"><div>praveen</div></font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="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>