[petsc-dev] DMPlex test ex18 and DMPlexCreateFromDAG

Vaclav Hapla vaclav.hapla at erdw.ethz.ch
Thu Nov 23 10:15:41 CST 2017


Hello

The DMPlex example src/dm/impls/plex/examples/tests/ex18.c fails with  -cell_simplex 0 :

[0]PETSC ERROR: Null argument, when expecting valid pointer
[0]PETSC ERROR: Null Object: Parameter # 1
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
[0]PETSC ERROR: Petsc Development GIT revision: v3.8.2-360-gb71d430  GIT Date: 2017-11-23 09:02:30 -0600
[0]PETSC ERROR: ./ex18 on a arch-linux-gcc-salvus named salvus-vm by haplav Thu Nov 23 17:03:16 2017
[0]PETSC ERROR: Configure options --download-chaco --download-exodusii --download-hdf5 --download-med --download-metis --download-netcdf --download-parmetis --download-ptscotch --download-triangle --download-ctetgen --with-cc=mpicc --with-cxx=mpicxx --with-eigen-dir=/usr --with-fc=mpifort --with-python=1 --with-shared-libraries=1 --with-valgrind-dir=/opt/valgrind/valgrind-3.13 PETSC_ARCH=arch-linux-gcc-salvus
[0]PETSC ERROR: #1 DMGetDimension() line 4048 in /scratch/petsc-dev/src/dm/interface/dm.c
[0]PETSC ERROR: #2 DMPlexCreateFromDAG() line 2704 in /scratch/petsc-dev/src/dm/impls/plex/plexcreate.c
[0]PETSC ERROR: #3 CreateQuad_2D() line 302 in /scratch/petsc-dev/src/dm/impls/plex/examples/tests/ex18.c
[0]PETSC ERROR: #4 CreateMesh() line 425 in /scratch/petsc-dev/src/dm/impls/plex/examples/tests/ex18.c
[0]PETSC ERROR: #5 main() line 464 in /scratch/petsc-dev/src/dm/impls/plex/examples/tests/ex18.c


The problem is that the DM is never created in this case. It could be fixed by adding 
  ierr = DMCreate(comm, dm);CHKERRQ(ierr);
  ierr = DMSetType(*dm, DMPLEX);CHKERRQ(ierr);
to the beginning of CreateQuad_2D and CreateHex_3D in ex18.c.

However, I rather suggest to
1) change the DM argument of these functions to DM* to unify them with CreateSimplex_2D and CreateSimplex_3D,
2) alter DMPlexCreateFromDAG so that DM is strictly output parameter. I don't understand why it couldn't create the DMPlex on its own - see the manual page: "dm - The empty DM object, usually from DMCreate() and DMSetDimension()".

I can fix that as suggested above if you agree.

Vaclav


More information about the petsc-dev mailing list