[petsc-dev] PetscPrintf() is never suppose to be used to print error messages

Barry Smith bsmith at mcs.anl.gov
Wed Jan 2 02:07:43 CST 2013


  that is what (*PetscErrorPrintf)() is for. Please fix. Thanks Barry


  ierr = MatSetValues(A, numIndices, indices, numIndices, indices, values, mode);
  if (ierr) {
    PetscMPIInt    rank;
    PetscErrorCode ierr2;

    ierr2 = MPI_Comm_rank(((PetscObject) A)->comm, &rank);CHKERRQ(ierr2);
    ierr2 = PetscPrintf(PETSC_COMM_SELF, "[%D]ERROR in DMPlexMatSetClosure\n", rank);CHKERRQ(ierr2);
    ierr2 = DMPlexPrintMatSetValues(A, point, numIndices, indices, values);CHKERRQ(ierr2);
    ierr2 = DMRestoreWorkArray(dm, numIndices, PETSC_INT, &indices);CHKERRQ(ierr);

                                      Also the above should be ierr2 ^^^^^
    CHKERRQ(ierr);
  }


Why? Because PetscPrintf() and (*PetscErrorPrintf)() may be completely different streams, for example (*PetscErrorPrintf)() going to a nice GUI popup or console etc etc




More information about the petsc-dev mailing list