xref: /phasta/phSolver/common/phIO.cc (revision 064bab1d5bdf3aea43bbb2384c828c3c38ab8501)
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string>
4 #include "phIO.h"
5 #include "phComm.h"
6 #include "phio_base.h"
7 #include "phio_sync.h"
8 #include "phio_posix.h"
9 
10 void phio_readheader(
11     phio_fp f,
12     const  char keyphrase[],
13     void* valueArray,
14     int*  nItems,
15     const char  datatype[],
16     const char  iotype[] ) {
17   f->ops->readheader(f->file, keyphrase, valueArray,
18       nItems, datatype, iotype);
19 }
20 void phio_writeheader(
21     const int* fileDescriptor,
22     const char keyphrase[],
23     const void* valueArray,
24     const int* nItems,
25     const int* ndataItems,
26     const char datatype[],
27     const char iotype[] ) {
28 }
29 void phio_readdatablock(
30     phio_fp f,
31     const  char keyphrase[],
32     void* valueArray,
33     int*  nItems,
34     const char  datatype[],
35     const char  iotype[] ) {
36   f->ops->readdatablock(f->file, keyphrase, valueArray,
37       nItems, datatype, iotype);
38 }
39 void phio_writedatablock(
40     const int* fileDescriptor,
41     const char keyphrase[],
42     const void* valueArray,
43     const int* nItems,
44     const char datatype[],
45     const char iotype[]) {
46 }
47 void phio_openfile_read(
48     const char filename[],
49     int* numFiles,
50     phio_fp* fileDescriptor) {
51   std::string fn(filename);
52   std::string syncSuffix("-dat");
53   std::string posixSuffix(".dat");
54   if( fn.find(syncSuffix) != std::string::npos )
55     sync_openfile_read(filename, numFiles, fileDescriptor);
56   else if( fn.find(posixSuffix) != std::string::npos )
57     posix_openfile_read(filename, numFiles, fileDescriptor);
58   else {
59     fprintf(stderr,
60         "type of file %s is unknown... exiting\n", filename);
61     exit(1);
62   }
63 }
64 void phio_openfile_write(
65     const char filename[],
66     int* numFiles,
67     int* numFields,
68     int* numPPF,
69     int* fileDescriptor) {
70 }
71 void phio_restartname(int* step, char* filename) {
72 }
73 void phio_closefile_read(phio_fp f) {
74   f->ops->closefile_read(f);
75 }
76 void phio_closefile_write(int* fileDescriptor) {
77 }
78 
79