I am attaching a debugged version. Blaise
On Aug 24, 2012, at 3:30 PM, Matthew Knepley <knepley at gmail.com> wrote: > On Fri, Aug 24, 2012 at 2:16 PM, Chris Eldred <chris.eldred at gmail.com> > wrote: > The following code snippet does not appear to be working: > > 1) I hate Fortran. A lot. It is not debuggable. > > 2) Here is my code that should work, but the do loop somehow does not work: > > program main > implicit none > ! > #include <finclude/petsc.h90> > #include <finclude/petscdmcomplex.h90> > ! > DM dm > PetscInt, target, dimension(4) :: EC > PetscInt, pointer :: pEC(:) > PetscInt c, firstCell, numCells > PetscErrorCode ierr > > call PetscInitialize(PETSC_NULL_CHARACTER,ierr) > call DMComplexCreate(PETSC_COMM_WORLD, dm, ierr) > firstCell = 0 > numCells = 5 > call DMComplexSetChart(dm, 0, numCells, ierr) > do c=firstCell,numCells > write(*,*) 'c',c > call DMComplexSetConeSize(dm, c, 4) > end do > call DMSetUp(dm, ierr) > > EC(1) = 1 > EC(2) = 2 > EC(3) = 3 > EC(4) = 4 > pEC => EC > write(*,*) 'cell',c,pEC > c = 0 > call DMComplexSetCone(dm, c , pEC, ierr) > CHKERRQ(ierr) > call DMComplexGetCone(dm, c , pEC, ierr) > CHKERRQ(ierr) > write(*,*) 'cell',c,pEC > > call DMDestroy(dm,ierr) > call PetscFinalize(ierr) > end > > > Matt > > PetscInt, dimension(4) :: EC > > EC(1) = 1 > EC(2) = 2 > EC(3) = 3 > EC(4) = 4 > write(*,*) 'cell',EC > call DMComplexSetCone(model_mesh, lcell , EC, ierr) > CHKERRQ(ierr) > call DMComplexGetCone(model_mesh, lcell , EC, ierr) > CHKERRQ(ierr) > write(*,*) 'cell', EC > > I get the following as output: > > cell 1 2 3 4 > cell 18673792 0 -1 -1 > > DMComplexGetConeSize returns 4 as expected. I am using the latest > version of petsc-dev. > > Later on there is a segmentation fault violation, probably related to > this issue. > > Any ideas? > > -- > Chris Eldred > DOE Computational Science Graduate Fellow > Graduate Student, Atmospheric Science, Colorado State University > B.S. Applied Computational Physics, Carnegie Mellon University, 2009 > chris.eldred at gmail.com > > > > -- > What most experimenters take for granted before they begin their experiments > is infinitely more interesting than any results to which their experiments > lead. > -- Norbert Wiener -- Department of Mathematics and Center for Computation & Technology Louisiana State University, Baton Rouge, LA 70803, USA Tel. +1 (225) 578 1612, Fax +1 (225) 578 4276 http://www.math.lsu.edu/~bourdin -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120824/a05f3f44/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: TestDMComplex1.F90 Type: application/octet-stream Size: 977 bytes Desc: not available URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120824/a05f3f44/attachment.obj> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120824/a05f3f44/attachment-0001.html>
