Sorry a typo: <br> MatCreate(MPI_COMM_WORLD,*A);<br><br><br><div class="gmail_quote">On Sat, Nov 7, 2009 at 2:57 PM, Ryan Yan <span dir="ltr"><<a href="mailto:vyan2000@gmail.com">vyan2000@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi All,<br>I have a question as follows:<br><br>In order to use MatSetValuesBlocked() for a MPIAIJ matrix. I need to call MatSetBlockSize() when I create the matrix.<br>
<br>so I did the following. Here the blocksize = 5;<br>
<br><br>Mat *A;<br>....<br> MatCreate(MPI_COMM_WORLD,A);<br> MatSetSizes(*A,m*blocksize,n*blocksize,M*blocksize,N*blocksize);<br> MatSetType(*A,MATMPIAIJ);<br> MatSetBlockSize(*A,blocksize);<br> ierr=MatMPIAIJSetPreallocation(*A,0,ourlens_ptws,0,offlens_ptws); CHKERRQ(ierr); <br>
<br> ierr = MatAssemblyBegin(*A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);<br> ierr = MatAssemblyEnd(*A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); <br> PetscPrintf(PETSC_COMM_WORLD,"the bs BEFORE is %d\n", bs);<br> MatGetBlockSize(*A,&bs);<br>
<br> PetscPrintf(PETSC_COMM_WORLD,"the bs is %d\n", bs);<br> PetscPrintf(PETSC_COMM_WORLD,"the blocksize is %d\n", blocksize);<br>...<br><br>The output I get is:<br><br>the bs BEFORE is 0<br>the bs is 1<br>
the blocksize is 5<br><br><br>It seems like the Mat A does not absorb the information blocksize=5 at all. How should I make the function-call sequence correct, if I want to set a blocksize for the MPIAIJ. <br><br>Thanks for any suggestions in advance,<br>
<font color="#888888">
<br>Yan<br>
</font></blockquote></div><br>