[petsc-dev] Issues with DMComplexSetCone

Matthew Knepley knepley at gmail.com
Fri Aug 24 15:30:46 CDT 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120824/029c3e03/attachment.html>


More information about the petsc-dev mailing list