Actual source code: ex81.c

  1: static char help[] = "Tests PetscLogView() called with no PetscGlobalArgc and PetscGlobalArgs.\n\n";

  3: #include <petscvec.h>

  5: int main(int argc, char **args)
  6: {
  7:   Vec         vec;
  8:   PetscBool   flg = PETSC_FALSE;
  9:   PetscViewer viewer;

 11:   PetscFunctionBegin;
 12:   PetscCall(PetscInitialize(NULL, NULL, NULL, help));
 13:   PetscCall(PetscLogDefaultBegin());
 14:   PetscCall(PetscViewerCreate(PETSC_COMM_SELF, &viewer));
 15:   PetscCall(PetscViewerSetType(viewer, PETSCVIEWERASCII));
 16:   for (PetscInt i = 1; i < argc; ++i) {
 17:     PetscCall(PetscStrcmp(args[i], "foo", &flg));
 18:     if (flg) break;
 19:   }
 20:   if (flg) {
 21:     PetscCall(VecCreate(PETSC_COMM_SELF, &vec));
 22:     PetscCall(VecDestroy(&vec));
 23:   }
 24:   PetscCall(PetscLogView(viewer));
 25:   PetscCall(PetscViewerDestroy(&viewer));
 26:   PetscCall(PetscFinalize());
 27:   return 0;
 28: }

 30: /*TEST

 32:   testset:
 33:     requires: defined(PETSC_USE_LOG)
 34:     nsize: 1
 35:     filter: grep -E "^              (Vector|Viewer)"
 36:     test:
 37:       suffix: 1
 38:       output_file: output/ex81_1.out
 39:     test:
 40:       suffix: 2
 41:       args: foo
 42:       output_file: output/ex81_2.out

 44:  TEST*/