Chris Eldred <[email protected]> writes:
> if (rank==0) then
> call DMPlexCreateFromCellList(PETSC_COMM_WORLD, 2, 2, 4, 3,  1 , cell_list
> , 2 , vertex_coords , dm,  ierr)

The problem here is that after this line, dm is garbage on rank 1.  You
want to start by creating the DM on COMM_WORLD, but have all the cells
on rank 0.  Try the attached.

program test
  implicit none

#include <finclude/petsc.h90>

  DM :: dm, dm_distrib
  PetscViewer :: viewer
  PetscErrorCode :: ierr
  PetscInt :: rank

  PetscInt, dimension(6) :: cell_list
  PetscReal, dimension(8) :: vertex_coords

  call PetscInitialize(PETSC_NULL_CHARACTER,ierr)
  CHKERRQ(ierr)
  call MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr)
  CHKERRQ(ierr)

  cell_list = (/ 0 , 1 , 2  , 1 , 3 , 2 /)
  vertex_coords = 0.0

  !call DMPlexCreate(PETSC_COMM_WORLD, dm, ierr)
  !CHKERRQ(ierr)

  if (rank==0) then
     call DMPlexCreateFromCellList(PETSC_COMM_WORLD, 2, 2, 4, 3,  1 , cell_list , 2 , vertex_coords , dm,  ierr)
     CHKERRQ(ierr)
  else
     call DMPlexCreateFromCellList(PETSC_COMM_WORLD, 2, 0, 0, 3,  1 , cell_list , 2 , vertex_coords , dm,  ierr)
     CHKERRQ(ierr)
  end if

  call DMPlexDistribute(dm,'chaco',1,dm_distrib,ierr)
  CHKERRQ(ierr)

  call DMDestroy(dm,ierr)
  CHKERRQ(ierr)

  call DMView(dm_distrib,PETSC_VIEWER_STDOUT_WORLD,ierr)
  CHKERRQ(ierr)

  call DMDestroy(dm_distrib,ierr)
  CHKERRQ(ierr)

  call PetscFinalize(ierr)
  CHKERRQ(ierr)

end program test

Attachment: pgpDquD2IS6zI.pgp
Description: PGP signature

Reply via email to