<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Mar 25, 2014 at 10:11 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class="">On Tue, Mar 25, 2014 at 8:52 PM, Adrian Croucher <span dir="ltr"><<a href="mailto:a.croucher@auckland.ac.nz" target="_blank">a.croucher@auckland.ac.nz</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"><div>
<br>
<blockquote type="cite">
<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></div>
I tried that but got a similar linker error from
PetscObjectViewFromOptions().
<div><blockquote 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></div>
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></div></blockquote><div><br></div></div><div>Below, you should not need an if, and can just use DMView(). If that does not work in parallel, something is wrong.</div><div>Likely on the interpretation of the default viewer. Let me try it.</div>
</div></div></div></blockquote><div><br></div><div>I have written the Fortran interface for PetscObjectViewFromOptions() and pushed to next, so</div><div>you should be able to use that now.</div><div><br></div><div> Thanks,</div>
<div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> Matt</div>
<div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF">
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<div><br>
<br>
<pre cols="72">--
Dr Adrian Croucher
Department of Engineering Science
University of Auckland
New Zealand
tel 64-9-373-7599 ext 84611
</pre>
</div></div>
</blockquote></div></div></div><br><br clear="all"><div class=""><div><br></div>-- <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
</div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <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
</div></div>