72 bool copy(
unsigned int stepsize,
unsigned int counter) {
77 bool copy_data(
unsigned int stepsize,
unsigned int counter) {
80 std::stringstream output_filename;
81 std::fstream output_file;
86 std::stringstream output_filename(
"");
88 if (counter<1000) output_filename <<
"0";
89 if (counter<100) output_filename <<
"0";
90 if (counter<10) output_filename <<
"0";
91 output_filename << counter;
96 output_file.open(output_filename.str().c_str(), std::fstream::out);
98 output_file << N << line << std::endl;
99 std::cout << N << line << std::endl;
100 for (
unsigned int i=0; i<N; i++) {
102 output_file << line << std::endl;
108 for(
unsigned int j=1; j<stepsize; j++) {
109 for (
unsigned int i=0; i<N+1; i++) getline(
data_file,line);
117 bool copy_fstat(
unsigned int stepsize,
unsigned int counter) {
119 std::stringstream output_filename;
120 std::fstream output_file;
125 output_filename.str(
"");
127 if (counter<1000) output_filename <<
"0";
128 if (counter<100) output_filename <<
"0";
129 if (counter<10) output_filename <<
"0";
130 output_filename << counter;
134 output_file.open(output_filename.str().c_str(), std::fstream::out);
135 std::cout << line << std::endl;
136 output_file << line << std::endl;
138 output_file << line << std::endl;
140 output_file << line << std::endl;
142 while (line.c_str()[0] !=
'#'&&
fstat_file.good()) {
144 output_file << line << std::endl;
149 for(
unsigned int j=1; j<stepsize; j++) {
153 while (line.c_str()[0] !=
'#'&&
fstat_file.good()) {
172 int main(
int argc,
char *argv[])
175 std::cerr <<
"split_files problem_name [stepsize [initial_counter]]" << std::endl;
178 std::string name(argv[1]);
179 std::cout <<
"Name: " << name << std::endl;
181 unsigned int stepsize = 1;
182 if (argc>2) stepsize = atoi(argv[2]);
185 unsigned int counter = 0;
186 if (argc>3) counter = atoi(argv[3]);
189 files.
copy(stepsize,counter);
190 std::cout <<
"finished writing split files: " << name << std::endl;
bool copy(unsigned int stepsize, unsigned int counter)
int main(int argc, char *argv[])
takes data and fstat files and splits them into *.data.???? and *.fstat.???? files ...
bool copy_fstat(unsigned int stepsize, unsigned int counter)
std::stringstream fstat_filename
std::fstream data_file
Stream used for data files.
CFile(std::string name)
Constructor.
bool copy_data(unsigned int stepsize, unsigned int counter)
std::stringstream data_filename
These store the save file names,.