36 for(
int i=0; i < nJobs; ++i )
43 srand(
unsigned( time(NULL) ) );
71 string in_name = Base +
".in";
72 remove( in_name.c_str() );
73 string out_name = Base +
".out";
74 append_file( main_output_handle, out_name.c_str() );
75 remove( out_name.c_str() );
77 fclose( main_output_handle );
79 fstream main_input_handle;
85 while( getline( main_input_handle, line ) )
89 string::const_iterator p = line.begin();
90 while( p != line.end() )
91 caps_line.push_back(
toupper(*p++) );
92 if( caps_line.compare( 0, 4,
"SAVE" ) == 0 || caps_line.compare( 0, 4,
"PUNC" ) == 0 )
96 string::size_type p = line.find(
'"' );
97 fnam += line.substr( ++p );
98 fnam.erase( fnam.find(
'"' ) );
117 rename( fnam.c_str(), gridnam.c_str() );
126 remove( gridnam.c_str() );
129 if( caps_line.find(
"XSPE", 4 ) != string::npos )
135 fseek( dest, 0, SEEK_END );
136 ASSERT( ftell(dest)%2880 == 0 );
145 fprintf(
ioQQQ,
"PROBLEM - could not open file %s\n", fnam.c_str() );
153 fprintf(
ioQQQ,
"PROBLEM - an internal error occurred while post-processing the grid output\n" );
166 bool lgForceNoDelimiter =
false;
170 lgForceNoDelimiter =
true;
172 bool lgAppendDelimiter =
true;
173 bool lgAppendNewline =
false;
179 str.seekg( 0, ios_base::end );
180 if( str.good() && str.tellg() > 0 )
183 str.seekg( -1, ios_base::cur );
186 lgAppendNewline = ( chr !=
'\n' );
189 str.seekg( 0, ios_base::beg );
190 while( getline( str, line ) )
192 if( line.find(
"GRID_DELIMIT" ) != string::npos )
193 lgAppendDelimiter =
false;
198 if( lgForceNoDelimiter )
199 lgAppendDelimiter =
false;
200 if( lgAppendNewline || lgAppendDelimiter )
205 if( lgAppendNewline )
207 if( lgAppendDelimiter )
210 str << setfill(
'0' ) << setw(9) << j << endl;
229 const size_t BUF_SIZE = 4096;
234 size_t nb = fread( buf,
sizeof(
char), BUF_SIZE, src );
235 fwrite( buf,
sizeof(
char), nb, dest );
#define DEBUG_ENTRY(funcname)
FILE * open_data(const char *fname, const char *mode, access_scheme scheme)
const ios_base::openmode mode_r
const ios_base::openmode mode_a
const int NUM_OUTPUT_TYPES
void append_file(FILE *dest, const char *source)
STATIC void check_grid_file(const string &fnam, int j, int ipPun)
string GridPointPrefix(int n)
void saveFITSfile(FILE *io, int option)
bool lgTimeDependentStatic
bool lg_separate_iterations[LIMPUN]
bool lgSaveToSeparateFiles[LIMPUN]
bool lgHashEndIter[LIMPUN]
char chHashString[INPUT_LINE_LENGTH]