On Mon, Sep 21, 2009 at 4:53 PM, Fredrik Bengzon <span dir="ltr">&lt;<a href="mailto:fredrik.bengzon@math.umu.se">fredrik.bengzon@math.umu.se</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
Ryan, I&#39;m aware of Barry&#39;s post<br>
<br>
<a href="https://lists.mcs.anl.gov/mailman/htdig/petsc-users/2008-May/003020.html" target="_blank">https://lists.mcs.anl.gov/mailman/htdig/petsc-users/2008-May/003020.html</a><br>
<br>
and it workes fine for triangle meshes. However, I do not see how this can be used for tetrahedral meshes.<br>
</blockquote><div><br>It is the same for tetrahedra. In fact, this algorithm can be generalized to work<br>for any topology:<br><br><a href="http://arxiv.org/abs/0908.4427">http://arxiv.org/abs/0908.4427</a><br><br>   Matt<br>
 </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">/Fredrik<br>
<br>
<br>
Ryan Yan wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">
Hi Fredrik,<br>
If I understand correctly, I have the same issue as what you have here.<br>
<br>
I do not have the code yet(It is also depends on how your store your matrix data.).  But I can forward Barry&#39;s idea to you.  Hope this is helpful to you.<br>
<br>
Yan,<br>
<br>
    Simply read through the ASCII file(s) twice. The first time count the number of blocks per row, then preallocate then read through the ASCII file again reading and setting the values. This will be very fast.<br>
<br>
  Barry<br>
- Hide quoted text -<br>
<br>
<br>
On Sep 20, 2009, at 10:20 AM, Ryan Yan wrote:<br>
<br>
    Hi All,<br>
    I have a large size application. Mesh size is 30000 nodes, with<br>
    dof 25 on each vertex. And it&#39;s 3d unstructured,  Tet, and Hex<br>
    mesh. In the following I will denote blksize=25<br>
<br>
    I am testing how to build up a PETSc matrix object quick and fast.<br>
<br>
    The data I have is Block Compressed Sparse Row(BCSR) files. And my<br>
    objective is to read BCSR files and generate PETSc Binaries<br>
<br>
    Firstly, I choose the MATMPIAIJ, I opened the BCSR data files on<br>
    each processor, and set up the preallocation use<br>
    MatMPIAIJSetPreallocation(A,blksize,PETSC_NULL,blksize,PETSC_NULL);<br>
    The reason why I choose 25 as the number for d_nz and o_nz is that<br>
    I do not have access to the ordering of the vertices. So it&#39;s the<br>
    worst case set up, and it takes about 7 minutes on 30 MIPS<br>
    node(180 processors) to write the output into PETSc binaries.<br>
<br>
    Secondly, I choose the MatMPIBAIJ, and same procedure as above,<br>
    but also set up<br>
    MatMPIBAIJSetPreallocation(A,blksize,blksize,PETSC_NULL,blksize,PETSC_NULL),<br>
    here blksize = 25 and it&#39;s also the worst case; This experiments<br>
    takes forever and could not generate the PETSc binaries.<br>
<br>
    I guess the reason why it takes so long in the MATMPIBAIJ case is<br>
    that I did not set up the preallocation accurately. Alougth I<br>
    think the preallocation is also not accurate in the MATMPIAIJ<br>
    case, but it seems like the preallocation effect is not as serious<br>
    as for the MPIBAIJ. Correct me please, if there are other reasons.<br>
<br>
    Can I anyone please give a hint on how to set up the preallocation<br>
    right for a unstructured mesh without knowing the mesh ordering?<br>
<br>
    Thank you very much in advance,<br>
<br>
    Yan<br>
<br>
<br>
<br>
<br>
<br></div></div><div class="im">
On Mon, Sep 21, 2009 at 4:24 PM, Fredrik Bengzon &lt;<a href="mailto:fredrik.bengzon@math.umu.se" target="_blank">fredrik.bengzon@math.umu.se</a> &lt;mailto:<a href="mailto:fredrik.bengzon@math.umu.se" target="_blank">fredrik.bengzon@math.umu.se</a>&gt;&gt; wrote:<br>

<br>
    Hi,<br>
    This is probably the wrong forum to ask, but does anyone have a<br>
    piece of code for computing the correct ndnz and nodnz vectors<br>
    needed for assembly of the stiffness (MPIAIJ) matrix on an<br>
    unstructured tetrahedral mesh given the node-to-element adjacency?<br>
    Thanks,<br>
    Fredrik<br>
<br>
<br>
</div></blockquote>
<br>
</blockquote></div><br><br clear="all"><br>-- <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<br>