Skip to main content
`Ctrl`+`K`

# PetscViewerASCIISynchronizedPrintf

Prints synchronized output to the specified `PETSCVIEWERASCII` file from several processors. Output of the first processor is followed by that of the second, etc.

## Synopsis

    #include "petscviewer.h"
    PetscErrorCode PetscViewerASCIISynchronizedPrintf(PetscViewer viewer, const char format[], ...)

Not Collective, must call collective `PetscViewerFlush()` to get the results flushed

## Input Parameters

- viewer - the `PETSCVIEWERASCII` `PetscViewer`

- format - the usual printf() format string

## Notes

You must have previously called `PetscViewerASCIIPushSynchronized()` to allow this routine to be called. Then you can do multiple independent calls to this routine.

The actual synchronized print is then done using `PetscViewerFlush()`. `PetscViewerASCIIPopSynchronized()` should be then called if we are already done with the synchronized output to conclude the “synchronized session”.

So the typical calling sequence looks like

        PetscViewerASCIIPushSynchronized(viewer);
        PetscViewerASCIISynchronizedPrintf(viewer, ...);
        PetscViewerASCIISynchronizedPrintf(viewer, ...);
        ...
        PetscViewerFlush(viewer);
        PetscViewerASCIISynchronizedPrintf(viewer, ...);
        PetscViewerASCIISynchronizedPrintf(viewer, ...);
        ...
        PetscViewerFlush(viewer);
        PetscViewerASCIIPopSynchronized(viewer);

## Fortran Notes

Can only print a single character* string

## See Also

Viewers: Looking at PETSc Objects, `PetscViewerASCIIPushSynchronized()`, `PetscViewerFlush()`, `PetscViewerASCIIPopSynchronized()`, `PetscSynchronizedPrintf()`, `PetscViewerASCIIPrintf()`, `PetscViewerASCIIOpen()`, `PetscViewerCreate()`, `PetscViewerDestroy()`, `PetscViewerSetType()`

## Level

intermediate

## Location

src/sys/classes/viewer/impls/ascii/filev.c

## Examples

src/dm/tutorials/swarm_ex1.c
src/vec/is/sf/tutorials/ex1.c

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