#ifndef OUTPUT_PVD_H
#define OUTPUT_PVD_H
/**
see [output_htg.h](output_htg.h) on how to use this code
*/
#if _MPI
void output_pvd_mpiio(char* name, double t, MPI_File fp, bool firstTimeWritten){
char head[] ="\n\t\n";
char tail[] = "\t\n\n";
if (firstTimeWritten == true) // Write Head
MPI_File_write(fp,&head, strlen(head), MPI_CHAR, MPI_STATUS_IGNORE);
else
MPI_File_seek(fp, -strlen(tail), MPI_SEEK_END);
char buffer[100];
snprintf(buffer,sizeof(buffer),"\t\t\n",t, name);
MPI_File_write(fp, &buffer, strlen(buffer), MPI_CHAR, MPI_STATUS_IGNORE);
MPI_File_write(fp, &tail, strlen(tail), MPI_CHAR, MPI_STATUS_IGNORE);
}
#endif
void output_pvd(char* name, double t, FILE* fp, bool firstTimeWritten){
char head[] ="\n\t\n";
char tail[] = "\t\n\n";
if (firstTimeWritten == true) // Write Head
fprintf(fp,"%s", head);
else
fseek(fp, -strlen(tail), SEEK_END);
fprintf(fp,"\t\t\n",t, name);
fprintf(fp,"%s",tail);
}
#endif