<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    On 7/6/2012 4:33 AM, Jed Brown wrote:
    <blockquote
cite="mid:CAM9tzSm5L8HQ8RQ86QqdPsNT9F_pMWnG-5uVZU=NVOSU22HmRA@mail.gmail.com"
      type="cite">
      <div class="gmail_quote">On Wed, Jun 6, 2012 at 4:21 PM, TAY
        wee-beng <span dir="ltr"><<a moz-do-not-send="true"
            href="mailto:zonexo@gmail.com" target="_blank">zonexo@gmail.com</a>></span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <b>call PCMGSetLevels(pc,mg_lvl,MPI_COMM_WORLD,ierr)</b></blockquote>
        <div><br>
        </div>
        <div>The third arguments is an array of length mg_lvl, not a
          single communicator. You can pass PETSC_NULL_OBJECT just like
          the man page says to use the default.</div>
        <div> </div>
        <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
          0.8ex; border-left: 1px solid rgb(204, 204, 204);
          padding-left: 1ex;"><br>
        </blockquote>
      </div>
    </blockquote>
    I changed but the same Segmentation still occurs:<br>
    <br>
    call KSPCreate(MPI_COMM_WORLD,ksp,ierr)<br>
        <br>
    call KSPGetPC(ksp,pc,ierr)<br>
        <br>
    call PCSetType(pc_uv,PCMG,ierr) <br>
        <br>
    mg_lvl = 1 (or 2)<br>
        <br>
    call PCMGSetLevels(pc,mg_lvl,PETSC_NULL_OBJECT,ierr) <br>
    <br>
    call
DMDACreate2d(MPI_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,size_x,size_y,1,num_procs,i1,i1,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,da,ierr)<br>
    <br>
    ...<br>
    <br>
    Btw, I tried to look at
    <a class="moz-txt-link-freetext" href="http://www.mcs.anl.gov/petsc/petsc-current/src/ksp/ksp/examples/tutorials/ex42.c.html">http://www.mcs.anl.gov/petsc/petsc-current/src/ksp/ksp/examples/tutorials/ex42.c.html</a>
    but I think there's some error in the page formatting.<br>
    <blockquote
cite="mid:CAM9tzSm5L8HQ8RQ86QqdPsNT9F_pMWnG-5uVZU=NVOSU22HmRA@mail.gmail.com"
      type="cite">
      <div class="gmail_quote">
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br>
          However, I get the error:<br>
          <br>
          Caught signal number 11 SEGV: Segmentation Violation, probably
          memory access out of range<br>
          <br>
          after calling <b>PCMGSetLevels</b><br>
          <br>
          What's the problem? Is there any examples which I can follow?<br>
        </blockquote>
      </div>
      <br>
      <div>I believe the other examples that use this routine are in C
        or just tests (not tutorial-style) examples.</div>
    </blockquote>
  </body>
</html>