PetscEnumCase#

case() statement for a PETSc enum variable or value Fortran only

Synopsis#

#include <petsc/finclude/petscsys.h>
PetscEnumCase(PetscObject enm)

Input Parameters#

  • enum - the PETSc enum value or variable

Example Usage#

  DMPolytopeType cellType
  select PetscEnumCase(cellType)
    PetscEnumCase(DM_POLYTOPE_TRIANGLE)
      write(*,*) 'cell is a triangle'
    PetscEnumCase(DM_POLYTOPE_TETRAHEDRON)
      write(*,*) 'cell is a tetrahedron'
    case default
      write(*,*) 'cell is a something else'
  end select

is equivalent to

  DMPolytopeType cellType
  select case(cellType%v)
    case(DM_POLYTOPE_TRIANGLE%v)
      write(*,*) 'cell is a triangle'
    case(DM_POLYTOPE_TETRAHEDRON%v)
      write(*,*) 'cell is a tetrahedron'
    case default
      write(*,*) 'cell is a something else'
  end select

See Also#

PetscObject

Level#

beginner

Location#

src/sys/objects/inherit.c


Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages