Lines Matching refs:vascii
8 PetscViewer_ASCII *vascii = (PetscViewer_ASCII *)viewer->data; in PetscViewerFileClose_ASCII() local
12 …PetscCheck(!vascii->sviewer, PetscObjectComm((PetscObject)viewer), PETSC_ERR_ARG_WRONGSTATE, "Cann… in PetscViewerFileClose_ASCII()
14 if (rank == 0 && vascii->fd != stderr && vascii->fd != PETSC_STDOUT) { in PetscViewerFileClose_ASCII()
15 if (vascii->fd && vascii->closefile) { in PetscViewerFileClose_ASCII()
16 err = fclose(vascii->fd); in PetscViewerFileClose_ASCII()
19 if (vascii->storecompressed) { in PetscViewerFileClose_ASCII()
23 PetscCall(PetscStrlcat(par, vascii->filename, sizeof(par))); in PetscViewerFileClose_ASCII()
33 PetscCall(PetscFree(vascii->filename)); in PetscViewerFileClose_ASCII()
39 PetscViewer_ASCII *vascii = (PetscViewer_ASCII *)viewer->data; in PetscViewerDestroy_ASCII() local
44 …PetscCheck(!vascii->sviewer, PetscObjectComm((PetscObject)viewer), PETSC_ERR_ARG_WRONGSTATE, "Cann… in PetscViewerDestroy_ASCII()
46 PetscCall(PetscFree(vascii)); in PetscViewerDestroy_ASCII()
91 PetscViewer_ASCII *vascii = (PetscViewer_ASCII *)viewer->data; in PetscViewerDestroy_ASCII_SubViewer() local
94 PetscCall(PetscViewerRestoreSubViewer(vascii->bviewer, 0, &viewer)); in PetscViewerDestroy_ASCII_SubViewer()
119 PetscViewer_ASCII *vascii = (PetscViewer_ASCII *)viewer->data; in PetscViewerASCIIGetPointer() local
122 …PetscCheck(!vascii->fileunit, PetscObjectComm((PetscObject)viewer), PETSC_ERR_ARG_WRONGSTATE, "Can… in PetscViewerASCIIGetPointer()
123 *fd = vascii->fd; in PetscViewerASCIIGetPointer()
129 PetscViewer_ASCII *vascii = (PetscViewer_ASCII *)viewer->data; in PetscViewerFileGetMode_ASCII() local
132 *mode = vascii->mode; in PetscViewerFileGetMode_ASCII()
138 PetscViewer_ASCII *vascii = (PetscViewer_ASCII *)viewer->data; in PetscViewerFileSetMode_ASCII() local
141 vascii->mode = mode; in PetscViewerFileSetMode_ASCII()
523 PetscViewer_ASCII *vascii; in petscviewerasciisetfileunit_() local
527 vascii = (PetscViewer_ASCII *)v->data; in petscviewerasciisetfileunit_()
528 if (vascii->mode == FILE_MODE_READ) { in petscviewerasciisetfileunit_()
532 vascii->fileunit = *unit; in petscviewerasciisetfileunit_()
802 PetscViewer_ASCII *vascii = (PetscViewer_ASCII *)viewer->data; in PetscViewerFileGetName_ASCII() local
805 *name = vascii->filename; in PetscViewerFileGetName_ASCII()
814 PetscViewer_ASCII *vascii = (PetscViewer_ASCII *)viewer->data; in PetscViewerFileSetName_ASCII() local
821 PetscCall(PetscStrallocpy(name, &vascii->filename)); in PetscViewerFileSetName_ASCII()
824 vascii->storecompressed = PETSC_FALSE; in PetscViewerFileSetName_ASCII()
826 PetscCall(PetscStrstr(vascii->filename, ".gz", &gz)); in PetscViewerFileSetName_ASCII()
830 …PetscCheck(vascii->mode == FILE_MODE_WRITE, PetscObjectComm((PetscObject)viewer), PETSC_ERR_SUP, "… in PetscViewerFileSetName_ASCII()
832 vascii->storecompressed = PETSC_TRUE; in PetscViewerFileSetName_ASCII()
841 if (isstderr) vascii->fd = PETSC_STDERR; in PetscViewerFileSetName_ASCII()
842 else if (isstdout) vascii->fd = PETSC_STDOUT; in PetscViewerFileSetName_ASCII()
845 switch (vascii->mode) { in PetscViewerFileSetName_ASCII()
847 vascii->fd = fopen(fname, "r"); in PetscViewerFileSetName_ASCII()
850 vascii->fd = fopen(fname, "w"); in PetscViewerFileSetName_ASCII()
853 vascii->fd = fopen(fname, "a"); in PetscViewerFileSetName_ASCII()
856 vascii->fd = fopen(fname, "r+"); in PetscViewerFileSetName_ASCII()
857 if (!vascii->fd) vascii->fd = fopen(fname, "w+"); in PetscViewerFileSetName_ASCII()
863 vascii->fd = fopen(fname, "r+"); in PetscViewerFileSetName_ASCII()
864 if (!vascii->fd) vascii->fd = fopen(fname, "w+"); in PetscViewerFileSetName_ASCII()
866 int ret = fseek(vascii->fd, 0, SEEK_END); in PetscViewerFileSetName_ASCII()
871 …omm((PetscObject)viewer), PETSC_ERR_SUP, "Unsupported file mode %s", PetscFileModes[vascii->mode]); in PetscViewerFileSetName_ASCII()
873 …PetscCheck(vascii->fd, PETSC_COMM_SELF, PETSC_ERR_FILE_OPEN, "Cannot open PetscViewer file: %s due… in PetscViewerFileSetName_ASCII()
882 PetscViewer_ASCII *vascii = (PetscViewer_ASCII *)viewer->data, *ovascii; in PetscViewerGetSubViewer_ASCII() local
885 …PetscCheck(!vascii->sviewer, PETSC_COMM_SELF, PETSC_ERR_ORDER, "SubViewer already obtained from Pe… in PetscViewerGetSubViewer_ASCII()
901 ovascii->fd = vascii->fd; in PetscViewerGetSubViewer_ASCII()
902 ovascii->fileunit = vascii->fileunit; in PetscViewerGetSubViewer_ASCII()
905 vascii->sviewer = *outviewer; in PetscViewerGetSubViewer_ASCII()
941 PetscViewer_ASCII *vascii = (PetscViewer_ASCII *)viewer->data; in PetscViewerFlush_ASCII() local
944 FILE *fd = vascii->fd; in PetscViewerFlush_ASCII()
947 …PetscCheck(!vascii->sviewer, PetscObjectComm((PetscObject)viewer), PETSC_ERR_ARG_WRONGSTATE, "Cann… in PetscViewerFlush_ASCII()
952 …if (!vascii->bviewer && rank == 0 && (vascii->mode != FILE_MODE_READ)) PetscCall(PetscFFlush(vasci… in PetscViewerFlush_ASCII()
954 if (vascii->allowsynchronized) { in PetscViewerFlush_ASCII()
964 PrintfQueue next = vascii->petsc_printfqueuebase, previous; in PetscViewerFlush_ASCII()
965 for (i = 0; i < vascii->petsc_printfqueuelength; i++) { in PetscViewerFlush_ASCII()
966 if (!vascii->bviewer) { in PetscViewerFlush_ASCII()
967 if (!vascii->fileunit) PetscCall(PetscFPrintf(comm, fd, "%s", next->string)); in PetscViewerFlush_ASCII()
968 else PetscCall(PetscFPrintfFortran(vascii->fileunit, next->string)); in PetscViewerFlush_ASCII()
970 PetscCall(PetscViewerASCIISynchronizedPrintf(vascii->bviewer, "%s", next->string)); in PetscViewerFlush_ASCII()
977 vascii->petsc_printfqueue = NULL; in PetscViewerFlush_ASCII()
978 vascii->petsc_printfqueuelength = 0; in PetscViewerFlush_ASCII()
989 if (!vascii->bviewer) { in PetscViewerFlush_ASCII()
990 if (!vascii->fileunit) PetscCall(PetscFPrintf(comm, fd, "%s", message)); in PetscViewerFlush_ASCII()
991 else PetscCall(PetscFPrintfFortran(vascii->fileunit, message)); in PetscViewerFlush_ASCII()
993 PetscCall(PetscViewerASCIISynchronizedPrintf(vascii->bviewer, "%s", message)); in PetscViewerFlush_ASCII()
999 PrintfQueue next = vascii->petsc_printfqueuebase, previous; in PetscViewerFlush_ASCII()
1002 PetscCallMPI(MPI_Send(&vascii->petsc_printfqueuelength, 1, MPI_INT, 0, tag, comm)); in PetscViewerFlush_ASCII()
1003 for (i = 0; i < vascii->petsc_printfqueuelength; i++) { in PetscViewerFlush_ASCII()
1011 vascii->petsc_printfqueue = NULL; in PetscViewerFlush_ASCII()
1012 vascii->petsc_printfqueuelength = 0; in PetscViewerFlush_ASCII()
1030 PetscViewer_ASCII *vascii; in PetscViewerCreate_ASCII() local
1033 PetscCall(PetscNew(&vascii)); in PetscViewerCreate_ASCII()
1034 viewer->data = (void *)vascii; in PetscViewerCreate_ASCII()
1044 vascii->fd = PETSC_STDOUT; in PetscViewerCreate_ASCII()
1045 vascii->mode = FILE_MODE_WRITE; in PetscViewerCreate_ASCII()
1046 vascii->bviewer = NULL; in PetscViewerCreate_ASCII()
1047 vascii->subviewer = NULL; in PetscViewerCreate_ASCII()
1048 vascii->sviewer = NULL; in PetscViewerCreate_ASCII()
1049 vascii->tab = 0; in PetscViewerCreate_ASCII()
1050 vascii->tab_store = 0; in PetscViewerCreate_ASCII()
1051 vascii->filename = NULL; in PetscViewerCreate_ASCII()
1052 vascii->closefile = PETSC_TRUE; in PetscViewerCreate_ASCII()
1106 PetscViewer_ASCII *vascii = (PetscViewer_ASCII *)viewer->data; in PetscViewerASCIISynchronizedPrintf() local
1117 …PetscCheck(vascii->allowsynchronized, PETSC_COMM_SELF, PETSC_ERR_ARG_WRONGSTATE, "First call Petsc… in PetscViewerASCIISynchronizedPrintf()
1122 if (vascii->bviewer) { in PetscViewerASCIISynchronizedPrintf()
1128 for (; tab < vascii->tab; tab++) string[2 * tab] = string[2 * tab + 1] = ' '; in PetscViewerASCIISynchronizedPrintf()
1132 PetscCall(PetscViewerASCIISynchronizedPrintf(vascii->bviewer, "%s", string)); in PetscViewerASCIISynchronizedPrintf()
1136 FILE *fp = vascii->fd; in PetscViewerASCIISynchronizedPrintf()
1138 tab = vascii->tab; in PetscViewerASCIISynchronizedPrintf()
1140 if (!vascii->fileunit) PetscCall(PetscFPrintf(PETSC_COMM_SELF, fp, " ")); in PetscViewerASCIISynchronizedPrintf()
1141 else PetscCall(PetscFPrintfFortran(vascii->fileunit, " ")); in PetscViewerASCIISynchronizedPrintf()
1145 if (!vascii->fileunit) PetscCall((*PetscVFPrintf)(fp, format, Argp)); in PetscViewerASCIISynchronizedPrintf()
1146 else PetscCall(PetscVFPrintfFortran(vascii->fileunit, format, Argp)); in PetscViewerASCIISynchronizedPrintf()
1162 if (vascii->petsc_printfqueue) { in PetscViewerASCIISynchronizedPrintf()
1163 vascii->petsc_printfqueue->next = next; in PetscViewerASCIISynchronizedPrintf()
1164 vascii->petsc_printfqueue = next; in PetscViewerASCIISynchronizedPrintf()
1166 vascii->petsc_printfqueuebase = vascii->petsc_printfqueue = next; in PetscViewerASCIISynchronizedPrintf()
1168 vascii->petsc_printfqueuelength++; in PetscViewerASCIISynchronizedPrintf()
1173 tab = vascii->tab; in PetscViewerASCIISynchronizedPrintf()
1177 PetscCall(PetscVSNPrintf(string, next->size - 2 * vascii->tab, format, &fullLength, Argp)); in PetscViewerASCIISynchronizedPrintf()
1179 if (fullLength > next->size - 2 * vascii->tab) { in PetscViewerASCIISynchronizedPrintf()
1181 next->size = fullLength + 2 * vascii->tab; in PetscViewerASCIISynchronizedPrintf()
1184 tab = 2 * vascii->tab; in PetscViewerASCIISynchronizedPrintf()
1187 PetscCall(PetscVSNPrintf(string, next->size - 2 * vascii->tab, format, NULL, Argp)); in PetscViewerASCIISynchronizedPrintf()
1216 PetscViewer_ASCII *vascii = (PetscViewer_ASCII *)viewer->data; in PetscViewerASCIIRead() local
1217 FILE *fd = vascii->fd; in PetscViewerASCIIRead()