<p> How did you get the MatNest?</p>
<p>What you describe is the right approach, but proper preallocation is messy in the general case. There is a partial implementation in petsc-dev, but it needs to be finished/debugged.</p>
<div class="gmail_quote">On Oct 10, 2012 8:45 AM, "Thomas Witkowski" <<a href="mailto:thomas.witkowski@tu-dresden.de">thomas.witkowski@tu-dresden.de</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div>You are right. But what if a have a
      MATNEST and i must convert it to MATAIJ. Any better way than what
      I wrote in my first mail?<br>
      <br>
      Thomas<br>
      <br>
      Am 10.10.2012 15:33, schrieb Jed Brown:<br>
    </div>
    <blockquote type="cite">
      <p>The best way, by far, is to assemble the matrix as AIJ if that
        is what you want to use. See MatGetLocalSubMatrix and SNES ex28.
        Using MATNEST should he a run-time choice.</p>
      <div class="gmail_quote">On Oct 10, 2012 8:30 AM, "Thomas
        Witkowski" <<a href="mailto:thomas.witkowski@tu-dresden.de" target="_blank">thomas.witkowski@tu-dresden.de</a>>
        wrote:<br type="attribution">
        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
          Is there a fast way to convert a MatNest to a MatAIJ? I tried
          to use MatConvert, but it seems that this convert is not yet
          implemented. As I need this functionality to factorize the
          nested matrix with MUMPS, is there any better way than to
          extract the nested matrices, iterate over all rows of these
          matrices and use MatSetValues to add them again to the final
          MatAIJ?<br>
          <br>
          Thomas<br>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </div>

</blockquote></div>