<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <br>
    <blockquote
cite="mid:CAMYG4Gn-qp9-_DpUoWTdNdE_Q+h1t8oyLpuLRFNu08b5Tyg0Eg@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote"><br>
            <div>PETSC_STATIC_INLINE PetscErrorCode DMViewFromOptions(DM
              A,const char prefix[],const char name[]) {return
              PetscObjectViewFromOptions((PetscObject)A,prefix,name);}</div>
            <div><br>
            </div>
            <div>so I think it might be better to just call the
              PetscObject version from Fortran.</div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    I tried that but got a similar linker error from
    PetscObjectViewFromOptions().
    <blockquote
cite="mid:CAMYG4Gn-qp9-_DpUoWTdNdE_Q+h1t8oyLpuLRFNu08b5Tyg0Eg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div> </div>
            Can you run an example, like SNES ex12, and give -dm_view in
            parallel?</div>
        </div>
      </div>
    </blockquote>
    <br>
    Yes, that works.  The C version of my test code also works- that's
    why I figured it might be just a missing fortran interface. My
    fortran test code is below.<br>
    <br>
    Cheers, Adrian<br>
    <br>
    --<br>
    program main<br>
    <br>
    ! distributing a DMPlex<br>
    <br>
      implicit none<br>
    <br>
    #include <finclude/petsc.h90><br>
    <br>
      DM :: dm, interp_dm, dist_dm<br>
      PetscInt, parameter :: dim = 3<br>
      PetscInt :: depth = 1<br>
      PetscErrorCode :: ierr<br>
      PetscInt :: rank, size<br>
      PetscInt, allocatable :: numPoints(:)<br>
      PetscInt, allocatable :: coneSize(:)<br>
      PetscInt, allocatable :: cones(:)<br>
      PetscInt, allocatable :: coneOrientations(:)<br>
      PetscScalar, allocatable :: vertexCoords(:)<br>
      character(5) :: partitioner = "chaco"<br>
    <br>
      call PetscInitialize(PETSC_NULL_CHARACTER,ierr); CHKERRQ(ierr)<br>
      call MPI_Comm_rank(PETSC_COMM_WORLD, rank, ierr); CHKERRQ(ierr);<br>
      call MPI_Comm_size(PETSC_COMM_WORLD, size, ierr); CHKERRQ(ierr);<br>
    <br>
      call DMPlexCreate(PETSC_COMM_WORLD, dm, ierr); CHKERRQ(ierr)<br>
      call PetscObjectSetName(dm, "testplex", ierr); CHKERRQ(ierr)<br>
      call DMPlexSetDimension(dm, dim, ierr); CHKERRQ(ierr)<br>
    <br>
      if (rank == 0) then<br>
         numPoints = [12, 2]<br>
         coneSize  = [8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]<br>
         cones = [2,5,4,3,6,7,8,9,  3,4,11,10,7,12,13,8]<br>
         coneOrientations = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0]<br>
         vertexCoords = [ &<br>
              -0.5,0.0,0.0, 0.0,0.0,0.0, 0.0,1.0,0.0, -0.5,1.0,0.0,
    &<br>
              -0.5,0.0,1.0, 0.0,0.0,1.0, 0.0,1.0,1.0, -0.5,1.0,1.0,
    &<br>
              0.5,0.0,0.0, 0.5,1.0,0.0, 0.5,0.0,1.0,  0.5,1.0,1.0 ]<br>
         call DMPlexCreateFromDAG(dm, depth, numPoints, coneSize, cones,
    &<br>
              coneOrientations, vertexCoords, ierr)<br>
      else<br>
         numPoints = [0, 0, 0]<br>
         coneSize = [0]<br>
         cones = [0]<br>
         coneOrientations = [0]<br>
         vertexCoords = [0]<br>
         call DMPlexCreateFromDAG(dm, 1, numPoints, coneSize, &<br>
              cones, coneOrientations, vertexCoords, ierr);<br>
      end if<br>
      CHKERRQ(ierr)<br>
    <br>
      call DMPlexInterpolate(dm, interp_dm, ierr); CHKERRQ(ierr)<br>
      call DMPlexCopyCoordinates(dm, interp_dm, ierr); CHKERRQ(ierr)<br>
      call DMDestroy(dm, ierr); CHKERRQ(ierr)<br>
      dm = interp_dm<br>
    <br>
      call DMPlexDistribute(dm, partitioner, 0, PETSC_NULL_OBJECT,
    dist_dm, ierr)<br>
      CHKERRQ(ierr)<br>
      if (size > 1) then<br>
        call DMViewFromOptions(dist_dm, PETSC_NULL_OBJECT, "-dm_view",
    ierr)<br>
        CHKERRQ(ierr)<br>
      else ! one processor<br>
        call DMView(dm, PETSC_VIEWER_STDOUT_WORLD, ierr); CHKERRQ(ierr)<br>
      end if<br>
      call DMDestroy(dm, ierr); CHKERRQ(ierr)<br>
      dm = dist_dm<br>
    <br>
      call DMDestroy(dm, ierr); CHKERRQ(ierr)<br>
      call PetscFinalize(ierr); CHKERRQ(ierr)<br>
      deallocate(numPoints, coneSize, cones, coneOrientations,
    vertexCoords)<br>
    <br>
    end program main<br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Dr Adrian Croucher
Department of Engineering Science
University of Auckland
New Zealand
tel 64-9-373-7599 ext 84611
</pre>
  </body>
</html>