<div dir="ltr">I am not exactly sure what you mean.<div><br></div><div>Given an IEN array, how do you get dnz and onz? Do you have any algorithm or pseudocode for that? Any reference will be appreciated!</div><div><br></div><div>Thanks,</div><div><br></div><div>Luis</div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-01-18 20:59 GMT-08:00 Sanjay Govindjee <span dir="ltr"><<a href="mailto:s_g@berkeley.edu" target="_blank">s_g@berkeley.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If you are doing FEA, then you should have the element connectivity data available from the input.  From this it is an easy task to compute the the assembly pattern and hence the precise allocation data, dnz and onz.  There should be no need to perform a 'trial' assembly.<span class="HOEnZb"><font color="#888888"><br>
<br>
-sanjay</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
On 1/18/18 8:49 PM, saturday luis wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi PETSc team:<br>
<br>
Is there a way to make precise matrix preallocation for an unstructured grid (I am not using the DMPlex object). Or do you have any example code for estimating the dnz & onz data?<br>
<br>
On top of my head, I can do a two-phase calculation. I can first give a rough estimate and do one finite element assembly, then I will call MatGetRow to locate the column indices for nonzero entries. Then in the second step, I will destroy the Mat and create a new Mat with this obtained sparsity pattern.<br>
<br>
Do you have any suggestions?<br>
<br>
Thanks!<br>
<br>
Luis<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div>