| /petsc/lib/petsc/bin/ |
| H A D | petsc_gen_xdmf.py | 13 def writeHeader(self, fp, hdfFilename): argument 14 fp.write('''\ 20 fp.write('\n<Xdmf>\n <Domain Name="domain">\n') 23 def writeCells(self, fp, topologyPath, numCells, numCorners, cellsName = "cells"): argument 24 fp.write('''\ 35 def writeVertices(self, fp, geometryPath, numVertices, spaceDim): argument 36 fp.write('''\ 46 def writeLocations(self, fp, numParticles, spaceDim): argument 47 fp.write('''\ 56 def writeTimeGridHeader(self, fp, time): argument [all …]
|
| /petsc/src/sys/tests/ |
| H A D | ex17.c | 10 FILE *fp; in main() local 18 PetscCall(PetscFOpen(comm, filename, "w", &fp)); in main() 19 PetscCall(PetscFPrintf(comm, fp, line1)); in main() 20 PetscCall(PetscFPrintf(comm, fp, line2)); in main() 21 PetscCall(PetscSynchronizedFPrintf(comm, fp, "rank: %d\n", rank)); // Print rankid in order in main() 22 PetscCall(PetscSynchronizedFlush(comm, fp)); in main() 23 PetscCall(PetscFClose(comm, fp)); in main() 31 PetscCall(PetscFOpen(comm, filename, "r", &fp)); in main() 32 PetscCall(PetscSynchronizedFGets(comm, fp, sizeof(line), line)); in main() 35 PetscCall(PetscSynchronizedFGets(comm, fp, sizeof(line), line)); in main() [all …]
|
| /petsc/src/dm/impls/da/ |
| H A D | grvtk.c | 43 FILE *fp; in DMDAVTKWriteAll_VTS() local 69 PetscCall(PetscFOpen(comm, vtk->filename, "wb", &fp)); in DMDAVTKWriteAll_VTS() 70 PetscCall(PetscFPrintf(comm, fp, "<?xml version=\"1.0\"?>\n")); in DMDAVTKWriteAll_VTS() 71 …PetscCall(PetscFPrintf(comm, fp, "<VTKFile type=\"StructuredGrid\" version=\"0.1\" byte_order=\"%s… in DMDAVTKWriteAll_VTS() 72 …PetscCall(PetscFPrintf(comm, fp, " <StructuredGrid WholeExtent=\"%d %" PetscInt_FMT " %d %" Petsc… in DMDAVTKWriteAll_VTS() 100 …PetscCall(PetscFPrintf(comm, fp, " <Piece Extent=\"%" PetscInt_FMT " %" PetscInt_FMT " %" Petsc… in DMDAVTKWriteAll_VTS() 101 PetscCall(PetscFPrintf(comm, fp, " <Points>\n")); in DMDAVTKWriteAll_VTS() 102 …PetscCall(PetscFPrintf(comm, fp, " <DataArray type=\"%s\" Name=\"Position\" NumberOfCompone… in DMDAVTKWriteAll_VTS() 104 PetscCall(PetscFPrintf(comm, fp, " </Points>\n")); in DMDAVTKWriteAll_VTS() 106 PetscCall(PetscFPrintf(comm, fp, " <PointData Scalars=\"ScalarPointData\">\n")); in DMDAVTKWriteAll_VTS() [all …]
|
| /petsc/src/snes/tutorials/network/water/ |
| H A D | waterreaddata.c | 99 PetscErrorCode GetDataSegment(FILE *fp, char *line, fpos_t *data_segment_start_pos, PetscInt *ndata… in GetDataSegment() argument 106 fgetpos(fp, data_segment_start_pos); in GetDataSegment() 107 …PetscCheck(fgets(line, MAXLINE, fp), PETSC_COMM_SELF, PETSC_ERR_FILE_READ, "Cannot read data segme… in GetDataSegment() 109 fgetpos(fp, data_segment_start_pos); in GetDataSegment() 110 …PetscCheck(fgets(line, MAXLINE, fp), PETSC_COMM_SELF, PETSC_ERR_FILE_READ, "Cannot read data segme… in GetDataSegment() 113 …PetscCheck(fgets(line, MAXLINE, fp), PETSC_COMM_SELF, PETSC_ERR_FILE_READ, "Cannot read data segme… in GetDataSegment() 123 FILE *fp = NULL; in WaterReadData() local 140 fp = fopen(filename, "rb"); in WaterReadData() 142 PetscCheck(fp, PETSC_COMM_SELF, PETSC_ERR_FILE_OPEN, "Can't open EPANET data file %s", filename); in WaterReadData() 145 while (fgets(line, MAXLINE, fp)) { in WaterReadData() [all …]
|
| /petsc/src/snes/interface/noise/ |
| H A D | snesnoise.c | 10 FILE *fp; /* output file */ member 54 if (flg) neP->fp = fopen(noise_file, "w"); in SNESDiffParameterCreate_More() 55 else neP->fp = fopen("noise.out", "w"); in SNESDiffParameterCreate_More() 56 PetscCheck(neP->fp, PETSC_COMM_SELF, PETSC_ERR_FILE_OPEN, "Cannot open file"); in SNESDiffParameterCreate_More() 71 err = fclose(neP->fp); in SNESDiffParameterDestroy_More() 89 FILE *fp; in SNESDiffParameterCompute_More() local 100 fp = neP->fp; in SNESDiffParameterCompute_More() 112 PetscCall(PetscFPrintf(comm, fp, "\n ------- SNES iteration %" PetscInt_FMT " ---------\n", i)); in SNESDiffParameterCompute_More() 135 PetscCall(PetscFPrintf(comm, fp, "Difference Table: iter = %" PetscInt_FMT "\n", iter)); in SNESDiffParameterCompute_More() 137 for (j = 0; j < nf - i; j++) PetscCall(PetscFPrintf(comm, fp, " %10.2e ", tab[i][j])); in SNESDiffParameterCompute_More() [all …]
|
| /petsc/src/dm/impls/plex/ |
| H A D | plexvtu.c | 26 static PetscErrorCode TransferWrite(MPI_Comm comm, PetscViewer viewer, FILE *fp, PetscMPIInt srank,… in TransferWrite() argument 46 PetscCall(PetscViewerVTKFWrite(viewer, fp, buffer, count, mpidatatype)); in TransferWrite() 173 FILE *fp; in DMPlexVTKWriteAll_VTU() local 198 PetscCall(PetscFOpen(comm, vtk->filename, "wb", &fp)); in DMPlexVTKWriteAll_VTU() 199 PetscCall(PetscFPrintf(comm, fp, "<?xml version=\"1.0\"?>\n")); in DMPlexVTKWriteAll_VTU() 200 …PetscCall(PetscFPrintf(comm, fp, "<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"… in DMPlexVTKWriteAll_VTU() 201 PetscCall(PetscFPrintf(comm, fp, " <UnstructuredGrid>\n")); in DMPlexVTKWriteAll_VTU() 245 …PetscCall(PetscFPrintf(PETSC_COMM_SELF, fp, " <Piece NumberOfPoints=\"%" PetscInt_FMT "\" Numbe… in DMPlexVTKWriteAll_VTU() 247 PetscCall(PetscFPrintf(PETSC_COMM_SELF, fp, " <Points>\n")); in DMPlexVTKWriteAll_VTU() 248 …PetscCall(PetscFPrintf(PETSC_COMM_SELF, fp, " <DataArray type=\"%s\" Name=\"Position\" Numb… in DMPlexVTKWriteAll_VTU() [all …]
|
| /petsc/src/mat/tests/ |
| H A D | ex152.c | 35 FILE *fp; in main() local 58 PetscCall(PetscFOpen(PETSC_COMM_SELF, fname, "r", &fp)); in main() 60 red = fread(vtxdist, sizeof(idx_t), size + 1, fp); in main() 67 red = fread(xadj, sizeof(idx_t), ni + 1, fp); in main() 73 red = fread(&adjncy[xadj[i]], sizeof(idx_t), xadj[i + 1] - xadj[i], fp); in main() 77 PetscCall(PetscFClose(PETSC_COMM_SELF, fp)); in main() 80 PetscCall(PetscFOpen(PETSC_COMM_SELF, fname, "r", &fp)); in main() 85 red = fread(xyz, sizeof(PetscReal), ndims * ni, fp); in main() 89 PetscCall(PetscFClose(PETSC_COMM_SELF, fp)); in main()
|
| /petsc/src/ksp/pc/impls/tfs/ |
| H A D | comm.c | 66 vfp fp; in PCTFS_giop() local 89 …PetscCheck(fp = (vfp)PCTFS_ivec_fct_addr(type), PETSC_COMM_SELF, PETSC_ERR_PLIB, "PCTFS_giop() :: … in PCTFS_giop() 98 PetscCall((*fp)(vals, work, n, oprs)); in PCTFS_giop() 110 PetscCall((*fp)(vals, work, n, oprs)); in PCTFS_giop() 143 vfp fp; in PCTFS_grop() local 165 …PetscCheck(fp = (vfp)PCTFS_rvec_fct_addr(type), PETSC_COMM_SELF, PETSC_ERR_PLIB, "PCTFS_grop() :: … in PCTFS_grop() 174 PetscCall((*fp)(vals, work, n, oprs)); in PCTFS_grop() 186 PetscCall((*fp)(vals, work, n, oprs)); in PCTFS_grop() 219 vfp fp; in PCTFS_grop_hc() local 247 …PetscCheck(fp = (vfp)PCTFS_rvec_fct_addr(type), PETSC_COMM_SELF, PETSC_ERR_PLIB, "PCTFS_grop_hc() … in PCTFS_grop_hc() [all …]
|
| /petsc/src/sys/fileio/ |
| H A D | mpiuopen.c | 31 PetscErrorCode PetscFOpen(MPI_Comm comm, const char name[], const char mode[], FILE **fp) in PetscFOpen() argument 56 *fp = fd; in PetscFOpen() 156 …PetscPOpen(MPI_Comm comm, const char machine[], const char program[], const char mode[], FILE **fp) in PetscPOpen() argument 198 if (fp) *fp = fd; in PetscPOpen()
|
| H A D | ftest.c | 244 FILE *fp; in PetscLs() local 250 PetscCall(PetscPOpen(comm, NULL, program, "r", &fp)); in PetscLs() 254 f = fgets(found, (int)tlen, fp); in PetscLs() 259 f = fgets(found + len, (int)(tlen - len), fp); in PetscLs() 263 PetscCall(PetscPClose(comm, fp)); in PetscLs()
|
| H A D | smatlab.c | 27 PetscErrorCode PetscStartMatlab(MPI_Comm comm, const char machine[], const char script[], FILE **fp) in PetscStartMatlab() argument 57 PetscCall(PetscPOpen(comm, machine, "xterm -display ${DISPLAY} -e matlab -nosplash", "r", fp)); in PetscStartMatlab()
|
| H A D | mprint.c | 449 static inline PetscErrorCode PetscSynchronizedFPrintf_Private(MPI_Comm comm, FILE *fp, const char f… in PetscSynchronizedFPrintf_Private() argument 459 PetscCall(PetscVFPrintf_Private(fp, format, cpy)); in PetscSynchronizedFPrintf_Private() 548 PetscErrorCode PetscSynchronizedFPrintf(MPI_Comm comm, FILE *fp, const char format[], ...) in PetscSynchronizedFPrintf() argument 554 PetscCall(PetscSynchronizedFPrintf_Private(comm, fp, format, Argp)); in PetscSynchronizedFPrintf() 732 PetscErrorCode PetscSynchronizedFGets(MPI_Comm comm, FILE *fp, size_t len, char string[]) in PetscSynchronizedFGets() argument 739 if (!fgets(string, (int)len, fp)) { in PetscSynchronizedFGets() 741 …PetscCheck(feof(fp), PETSC_COMM_SELF, PETSC_ERR_FILE_READ, "Error reading from file due to \"%s\""… in PetscSynchronizedFGets()
|
| H A D | fretrieve.c | 339 FILE *fp; in PetscFileRetrieve() local 399 PetscCall(PetscPOpen(PETSC_COMM_SELF, NULL, buffer, "r", &fp)); in PetscFileRetrieve() 400 PetscCall(PetscPClose(PETSC_COMM_SELF, fp)); in PetscFileRetrieve() 438 PetscCall(PetscPOpen(PETSC_COMM_SELF, NULL, buffer, "r", &fp)); in PetscFileRetrieve() 439 PetscCall(PetscPClose(PETSC_COMM_SELF, fp)); in PetscFileRetrieve()
|
| /petsc/src/dm/impls/plex/tests/ |
| H A D | ex99.c | 95 FILE *fp; in main() local 117 PetscCall(PetscPOpen(PETSC_COMM_SELF, NULL, cmd, "r", &fp)); in main() 118 if (fp) inum = fscanf(fp, "Version %s %d.%d.%d", space, &major, &minor, µ); in main() 119 PetscCall(PetscPClose(PETSC_COMM_SELF, fp)); in main() 137 PetscCall(PetscPOpen(PETSC_COMM_SELF, NULL, cmd, "r", &fp)); in main() 138 PetscCall(PetscPClose(PETSC_COMM_SELF, fp)); in main()
|
| /petsc/src/snes/tutorials/network/power/ |
| H A D | PFReadData.c | 8 FILE *fp; in PFReadMatPowerData() local 26 fp = fopen(filename, "r"); in PFReadMatPowerData() 28 …PetscCheck(fp, PETSC_COMM_SELF, PETSC_ERR_FILE_OPEN, "Can't open Matpower data file %s", filename); in PFReadMatPowerData() 30 while (fgets(line, MAXLINE, fp)) { in PFReadMatPowerData() 48 fclose(fp); in PFReadMatPowerData() 69 fp = fopen(filename, "r"); in PFReadMatPowerData() 72 …PetscCheck(fgets(line, MAXLINE, fp), PETSC_COMM_SELF, PETSC_ERR_SUP, "File is incorrectly formatte… in PFReadMatPowerData() 186 fclose(fp); in PFReadMatPowerData()
|
| /petsc/src/sys/classes/draw/utils/ |
| H A D | image.c | 68 FILE *fp; in PetscDrawImageSavePNG() local 79 PetscCall(PetscFOpen(PETSC_COMM_SELF, filename, "wb", &fp)); in PetscDrawImageSavePNG() 89 (void)PetscFClose(PETSC_COMM_SELF, fp); in PetscDrawImageSavePNG() 95 png_init_io(png_ptr, fp); in PetscDrawImageSavePNG() 106 PetscCall(PetscFClose(PETSC_COMM_SELF, fp)); in PetscDrawImageSavePNG() 242 FILE *fp; in PetscDrawImageSaveJPG() local 264 PetscCall(PetscFOpen(PETSC_COMM_SELF, filename, "wb", &fp)); in PetscDrawImageSaveJPG() 273 (void)PetscFClose(PETSC_COMM_SELF, fp); in PetscDrawImageSaveJPG() 278 jpeg_stdio_dest(&cinfo, fp); in PetscDrawImageSaveJPG() 292 PetscCall(PetscFClose(PETSC_COMM_SELF, fp)); in PetscDrawImageSaveJPG()
|
| /petsc/src/dm/dt/tests/ |
| H A D | ex12.c | 131 PetscPointFn *f[4] = {f0, f1, f2, f3}, *fp[4]; in TestAdd() local 155 fp[0] = f[i]; in TestAdd() 156 fp[1] = f[j]; in TestAdd() 157 fp[2] = f[k]; in TestAdd() 158 fp[3] = f[l]; in TestAdd() 159 PetscCall(CheckResidual(wf, key, 4, fp, 0, NULL)); in TestAdd() 177 fp[0] = f[i]; in TestAdd() 178 fp[1] = f[j]; in TestAdd() 179 fp[2] = f[k]; in TestAdd() 180 fp[3] = f[l]; in TestAdd() [all …]
|
| /petsc/src/ksp/ksp/tutorials/ |
| H A D | ex49.c | 267 FILE *fp; in DMDACoordViewGnuplot2d() local 274 PetscCall(PetscFOpen(PETSC_COMM_SELF, fname, "w", &fp)); in DMDACoordViewGnuplot2d() 275 PetscCheck(fp, PETSC_COMM_SELF, PETSC_ERR_USER, "Cannot open file"); in DMDACoordViewGnuplot2d() 276 …PetscCall(PetscFPrintf(PETSC_COMM_SELF, fp, "### Element geometry for processor %1.4d ### \n", ran… in DMDACoordViewGnuplot2d() 284 …PetscCall(PetscFPrintf(PETSC_COMM_SELF, fp, "%1.6e %1.6e \n", (double)PetscRealPart(_coords[j][i].… in DMDACoordViewGnuplot2d() 285 …PetscCall(PetscFPrintf(PETSC_COMM_SELF, fp, "%1.6e %1.6e \n", (double)PetscRealPart(_coords[j + 1]… in DMDACoordViewGnuplot2d() 286 …PetscCall(PetscFPrintf(PETSC_COMM_SELF, fp, "%1.6e %1.6e \n", (double)PetscRealPart(_coords[j + 1]… in DMDACoordViewGnuplot2d() 287 …PetscCall(PetscFPrintf(PETSC_COMM_SELF, fp, "%1.6e %1.6e \n", (double)PetscRealPart(_coords[j][i +… in DMDACoordViewGnuplot2d() 288 …PetscCall(PetscFPrintf(PETSC_COMM_SELF, fp, "%1.6e %1.6e \n\n", (double)PetscRealPart(_coords[j][i… in DMDACoordViewGnuplot2d() 293 PetscCall(PetscFClose(PETSC_COMM_SELF, fp)); in DMDACoordViewGnuplot2d() [all …]
|
| H A D | ex43.c | 319 FILE *fp; in DMDACoordViewGnuplot2d() local 326 PetscCall(PetscFOpen(PETSC_COMM_SELF, fname, "w", &fp)); in DMDACoordViewGnuplot2d() 327 PetscCheck(fp, PETSC_COMM_SELF, PETSC_ERR_USER, "Cannot open file"); in DMDACoordViewGnuplot2d() 329 …PetscCall(PetscFPrintf(PETSC_COMM_SELF, fp, "### Element geometry for processor %1.4d ### \n", ran… in DMDACoordViewGnuplot2d() 337 …PetscCall(PetscFPrintf(PETSC_COMM_SELF, fp, "%1.6e %1.6e \n", (double)PetscRealPart(_coords[j][i].… in DMDACoordViewGnuplot2d() 338 …PetscCall(PetscFPrintf(PETSC_COMM_SELF, fp, "%1.6e %1.6e \n", (double)PetscRealPart(_coords[j + 1]… in DMDACoordViewGnuplot2d() 339 …PetscCall(PetscFPrintf(PETSC_COMM_SELF, fp, "%1.6e %1.6e \n", (double)PetscRealPart(_coords[j + 1]… in DMDACoordViewGnuplot2d() 340 …PetscCall(PetscFPrintf(PETSC_COMM_SELF, fp, "%1.6e %1.6e \n", (double)PetscRealPart(_coords[j][i +… in DMDACoordViewGnuplot2d() 341 …PetscCall(PetscFPrintf(PETSC_COMM_SELF, fp, "%1.6e %1.6e \n\n", (double)PetscRealPart(_coords[j][i… in DMDACoordViewGnuplot2d() 346 PetscCall(PetscFClose(PETSC_COMM_SELF, fp)); in DMDACoordViewGnuplot2d() [all …]
|
| /petsc/src/sys/memory/ |
| H A D | mtr.c | 690 PetscErrorCode PetscMallocDump(FILE *fp) in PetscMallocDump() argument 698 if (!fp) fp = PETSC_STDOUT; in PetscMallocDump() 704 …if (TRallocated - libAlloc > 0) fprintf(fp, "[%d]Total space allocated %.0f bytes\n", rank, (Petsc… in PetscMallocDump() 712 …fprintf(fp, "[%2d] %.0f bytes\n", rank, (PetscLogDouble)(TRrequestedSize ? head->rsize : head->siz… in PetscMallocDump() 713 PetscCall(PetscStackPrint(&head->stack, fp)); in PetscMallocDump() 715 …fprintf(fp, "[%2d] %.0f bytes %s() at %s:%d\n", rank, (PetscLogDouble)(TRrequestedSize ? head->rsi… in PetscMallocDump() 861 PetscErrorCode PetscMallocView(FILE *fp) in PetscMallocView() argument 873 PetscCall(PetscFFlush(fp)); in PetscMallocView() 877 if (!fp) fp = PETSC_STDOUT; in PetscMallocView() 880 …(void)fprintf(fp, "[%d] Maximum memory PetscMalloc()ed %.0f maximum size of entire process %.0f\n"… in PetscMallocView() [all …]
|
| /petsc/src/binding/petsc4py/src/petsc4py/ |
| H A D | __init__.py | 75 with open(filename) as fp: 76 stream = StringIO('[petsc]\n' + fp.read())
|
| /petsc/src/tao/linesearch/impls/morethuente/ |
| H A D | morethuente.c | 10 …l *dx, PetscReal *sty, PetscReal *fy, PetscReal *dy, PetscReal *stp, PetscReal *fp, PetscReal *dp); 363 …al *dx, PetscReal *sty, PetscReal *fy, PetscReal *dy, PetscReal *stp, PetscReal *fp, PetscReal *dp) in Tao_mcstep() argument 379 if (*fp > *fx) { in Tao_mcstep() 387 theta = 3 * (*fx - *fp) / (*stp - *stx) + *dx + *dp; in Tao_mcstep() 397 stpq = *stx + ((*dx / ((*fx - *fp) / (*stp - *stx) + *dx)) * 0.5) * (*stp - *stx); in Tao_mcstep() 410 theta = 3 * (*fx - *fp) / (*stp - *stx) + *dx + *dp; in Tao_mcstep() 436 theta = 3 * (*fx - *fp) / (*stp - *stx) + *dx + *dp; in Tao_mcstep() 468 theta = 3 * (*fp - *fy) / (*sty - *stp) + *dy + *dp; in Tao_mcstep() 488 if (*fp > *fx) { in Tao_mcstep() 490 *fy = *fp; in Tao_mcstep() [all …]
|
| /petsc/src/sys/error/ |
| H A D | pstack.c | 216 PetscErrorCode PetscStackPrint(PetscStack *sint, FILE *fp) in PetscStackPrint() argument 220 …if (sint->file[i]) fprintf(fp, " [%d] %s() at %s:%d\n", PetscGlobalRank, sint->function[i], … in PetscStackPrint() 221 else fprintf(fp, " [%d] %s()\n", PetscGlobalRank, sint->function[i]); in PetscStackPrint()
|
| /petsc/src/dm/tutorials/ |
| H A D | swarm_ex1.c | 272 FILE *fp = NULL; in ex1_3() local 276 fp = fopen(name, "w"); in ex1_3() 277 PetscCheck(fp, PETSC_COMM_SELF, PETSC_ERR_FILE_OPEN, "Cannot open file %s", name); in ex1_3() 281 …for (p = 0; p < npoints; p++) fprintf(fp, "%+1.4e %+1.4e %1.4e\n", array_x[p], array_y[p], (double… in ex1_3() 284 fclose(fp); in ex1_3() 462 FILE *fp = NULL; in ex1_4() local 466 fp = fopen(name, "w"); in ex1_4() 467 PetscCheck(fp, PETSC_COMM_SELF, PETSC_ERR_FILE_OPEN, "Cannot open file %s", name); in ex1_4() 471 …for (p = 0; p < npoints; p++) fprintf(fp, "%+1.4e %+1.4e %1.4e\n", array_x[p], array_y[p], (double… in ex1_4() 474 fclose(fp); in ex1_4()
|
| H A D | swarm_ex3.c | 104 FILE *fp; in SwarmViewGP() local 111 fp = fopen(name, "w"); in SwarmViewGP() 112 PetscCheck(fp, PETSC_COMM_SELF, PETSC_ERR_FILE_OPEN, "Cannot open file %s", name); in SwarmViewGP() 116 …for (p = 0; p < npoints; p++) fprintf(fp, "%+1.4e %+1.4e %1.4e\n", array[2 * p], array[2 * p + 1],… in SwarmViewGP() 119 fclose(fp); in SwarmViewGP()
|