xref: /phasta/phSolver/common/phIO.cc (revision f262839c0e5005285eae3582f64c884689ac1db1)
1 #include "phIO.h"
2 #include "phComm.h"
3 #include <stdio.h>
4 #include <phastaIO.h>
5 #include <sstream>
6 #include <string>
7 
8 namespace {
9   std::string appendSync(const char* phrase) {
10     std::stringstream ss;
11     ss << phrase << "@" << phcomm_rank()+1 << "?";
12     std::string s = ss.str();
13     return s;
14   }
15 }
16 
17 void phio_readheader( int* fileDescriptor,
18     const  char keyphrase[],
19     void* valueArray,
20     int*  nItems,
21     const char  datatype[],
22     const char  iotype[] ) {
23   std::string syncPhrase = appendSync(keyphrase);
24   readheader(fileDescriptor, syncPhrase.c_str(),
25       valueArray, nItems, datatype, iotype);
26 }
27 
28 void phio_readdatablock(
29     int*  fileDescriptor,
30     const char keyphrase[],
31     void* valueArray,
32     int*  nItems,
33     const char  datatype[],
34     const char  iotype[] ) {
35   std::string syncPhrase = appendSync(keyphrase);
36   readdatablock(fileDescriptor, syncPhrase.c_str(),
37       valueArray, nItems, datatype, iotype);
38 }
39 
40 
41