<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Oct 20, 2014 at 5:21 PM, Harshad Sahasrabudhe <span dir="ltr"><<a href="mailto:hsahasra@purdue.edu" target="_blank">hsahasra@purdue.edu</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">Hi Matt,<div><br></div><div>If I have 2 instances of PETSc, one which is initialized by LibMesh and the other which is initialized in my code, then would getting a Mat from one version to the other cause this issue? I know that this is not the right way to do it, I'm just trying to zero in on the problem.</div></div></blockquote><div><br></div><div>No, this is a simple check that is common to any PETSc.</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>a) is not the problem, since I create and assemble the matrix using LibMesh API. b) is not it either, I ran a simple example and it works in that case. For c), I ran my code with Valgrind and didn't get any invalid write errors.</div><div><br></div><div>Thanks,<br>Harshad</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 20, 2014 at 4:19 PM, 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>On Mon, Oct 20, 2014 at 3:17 PM, Harshad Sahasrabudhe <span dir="ltr"><<a href="mailto:hsahasra@purdue.edu" target="_blank">hsahasra@purdue.edu</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">I get the Mat object from <a href="http://libmesh.github.io/libmesh/doxygen/classlibMesh_1_1PetscMatrix.html#aaca7a5afeb063716ee67fa11302c2aea" target="_blank">libMesh::PetscMatrix<>::mat()</a>, and it's been created and assembled before I call MatGetType.</div></blockquote><div><br></div></span><div>But what you are getting is invalid, so either</div><div><br></div><div>  a) it has not been created and assembled in LibMesh</div><div><br></div><div>  b) the right thing is not getting passed back (LibMesh problem)</div><div><br></div><div>or</div><div><br></div><div>  c) you are overwriting memory and it manifests here (check with valgrind)</div><div><br></div><div>It is very easy to look in these structures using the debugger. We are just checking an integer</div><div>in the header for the object that identifies it as a Mat.</div><div><br></div><div>   Matt</div><span><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_extra"><div class="gmail_quote">On Mon, Oct 20, 2014 at 4:12 PM, 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>On Mon, Oct 20, 2014 at 3:07 PM, Harshad Sahasrabudhe <span dir="ltr"><<a href="mailto:hsahasra@purdue.edu" target="_blank">hsahasra@purdue.edu</a>></span> wrote:<br></span><div><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I get the following error when I call MatGetType even though I'm calling the function with a Mat object.</div><div><br></div><div><div>[0]PETSC ERROR: Invalid argument!</div><div>[0]PETSC ERROR: Wrong type of object: Parameter # 1!</div></div><div><br></div><div>What could be going wrong?</div></div></blockquote><div><br></div></div></div><div>You are not calling it with a valid Mat object. Did you call MatCreate?</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>Thanks,</div><div>Harshad</div></div><span><font color="#888888">
</font></span></blockquote></div><span><font color="#888888"><br><br clear="all"><span class="HOEnZb"><font color="#888888"><span><font color="#888888"><div><br></div>-- <br>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
</font></span></font></span></font></span></div></div><span class="HOEnZb"><font color="#888888">
</font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888">
</font></span></blockquote></span></div><span class="HOEnZb"><font color="#888888"><span><br><br clear="all"><div><br></div>-- <br>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
</span></font></span></div></div>
</blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>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>