User: reisswig Date: 2015/07/09 06:55 AM
Modified: /PITTNullCode/SphericalHarmonicReconGen/src/ read.cc, sph_database.cc, sph_database.hh, startup.cc
Log: SphericalHarmonicsReconstructGen: Cleanup commented out code.
File Changes:
Directory: /PITTNullCode/SphericalHarmonicReconGen/src/ =======================================================
File [modified]: read.cc Delta lines: +0 -60 =================================================================== --- PITTNullCode/SphericalHarmonicReconGen/src/read.cc 2014-03-14 16:05:18 UTC (rev 122) +++ PITTNullCode/SphericalHarmonicReconGen/src/read.cc 2015-07-09 11:55:34 UTC (rev 123) @@ -32,8 +32,6 @@ // identify iteration which corresponds to the time just before the target time "time" int iteration = SHR::C[0]->get_iteration(time + SHR::initial_time_in_file);
- //cout << "Target-Time = " << time + SHR::initial_time_in_file << ". Iteration (time) just before target time: " << iteration << " (" << SHR::db[0]->time(iteration) << ")" << endl; - if (iteration < 0) { cout << "Error: iteration = -1. time = "<<time << ", SHR::initial_time_in_file="<<SHR::initial_time_in_file << endl; assert(iteration >= 0); @@ -72,13 +70,6 @@ SHR::C[0]->get_time_of_coeff_in_file(1), SHR::C[0]->get_time_of_coeff_in_file(0) };
- /*cout << "Stencil times: 5: " << x[0] << endl; - cout << " 4: " << x[1] << endl; - cout << " 3: " << x[2] << endl; - cout << " 2: " << x[3] << endl; - cout << " 1: " << x[4] << endl; - cout << " 0: " << x[5] << endl;*/ - // precompute Lagrange coefficients for (int i=0; i < 6; ++i) { @@ -167,7 +158,6 @@ " SphericalHarmonicReconGeneric_Startup"); }
- //if (CCTK_MyProc(cctkGH) == 0) if (!time_interpolate) { // read coefficients for current iteration @@ -184,7 +174,6 @@ const int my_iteration = cctk_iteration - (cctk_time < initial_relaxation_time ? cctk_iteration : initial_relaxation_time / CCTK_DELTA_TIME); - //if ((cctk_iteration == 0 && static_components) || cctk_iteration == 0 || cctk_time >= initial_relaxation_time) { if (my_iteration == 0 || my_iteration*CCTK_DELTA_TIME >= SHR::iteration_in_file*SHR::db[0]->delta_t()) { @@ -299,55 +288,6 @@
}
- /*if (verbose) - CCTK_INFO("Sync'ing coeffs..."); - - // do sync at once - const int nm = SHR::db[0]->lmax()*SHR::db[0]->lmax() + 2*SHR::db[0]->lmax(); - const int N = 3*NUM_METRIC_COMPONENTS * (nm + 1); - vector<double> re(N, 0); - vector<double> im(N, 0); - for (int c=0; c < NUM_METRIC_COMPONENTS; ++c) - { - for (int l=0; l <= SHR::db[0]->lmax(); ++l) - for (int m=-l; m <= l; ++m) - { - const int n = 3 * (c*nm + (l*l + l+m)); - re[n] = SHR::C[c]->get_mode(l, m).real(); - im[n] = SHR::C[c]->get_mode(l, m).imag(); - re[n+1] = SHR::Cr[c]->get_mode(l, m).real(); - im[n+1] = SHR::Cr[c]->get_mode(l, m).imag(); - if (time_derivative_in_file) { - re[n+2] = SHR::Ct[c]->get_mode(l, m).real(); - im[n+2] = SHR::Ct[c]->get_mode(l, m).imag(); - } - } - - //SHR::C[c]->sync(0); - //SHR::Cr[c]->sync(0); - //SHR::Ct[c]->sync(0); - } - const int root = 0; // proc 0 sends the data - MPI_Bcast(&re.front(), N, MPI_DOUBLE, root, SHR::comm_world); - MPI_Bcast(&im.front(), N, MPI_DOUBLE, root, SHR::comm_world); - - // copy back - for (int c=0; c < NUM_METRIC_COMPONENTS; c++) - { - for (int l=0; l <= SHR::db[0]->lmax(); ++l) - for (int m=-l; m <= l; ++m) - { - const int n = 3*(c*nm + l*l + l+m); - SHR::C[c]->set_mode(l, m, CCTK_Cmplx(re[n], im[n])); - SHR::Cr[c]->set_mode(l, m, CCTK_Cmplx(re[n+1], im[n+1])); - if (time_derivative_in_file) { - SHR::Ct[c]->set_mode(l, m, CCTK_Cmplx(re[n+2], im[n+2])); - } - } - } - if (verbose) - CCTK_INFO("...done.");*/ - SHR::read_data = 1; }
File [modified]: sph_database.cc Delta lines: +2 -171 =================================================================== --- PITTNullCode/SphericalHarmonicReconGen/src/sph_database.cc 2014-03-14 16:05:18 UTC (rev 122) +++ PITTNullCode/SphericalHarmonicReconGen/src/sph_database.cc 2015-07-09 11:55:34 UTC (rev 123) @@ -68,116 +68,12 @@
}
- // read all modes on all extraction spheres for a given timestep and variable number into array -/*void SPH_db_ASCII::read(const int timestep, const int varno, - vector<vector<vector<CCTK_COMPLEX> > >& coeff) const -{ - // check cache if data is there - if (is_in_cache(coeff)) return;
- file.clear(); - - //cout << file.tellg() << endl; - // move-pointer to byte-offset for requested timestep - file.seekg(byte_offset[timestep], ios::beg); - //cout << timestep << " " << file.tellg() << " " << byte_offset[timestep] << " " << byte_offset[timestep+1] << endl; - - char *line_buffer = new char[10000]; - - istringstream instream; // input string-stream - string s; - - double val, val_re, val_im; - int sphere = 0, l = 0, m = 0; - - while (file.good() && file.tellg() < byte_offset[timestep+1]) - { - // reset input-stringstream (clear from previous errors etc.) - instream.clear(); - s.clear(); - - // read line from file (max 10000 chars) - file.getline(line_buffer, 10000); - - // store length of input line - int line_length = strlen(line_buffer); - - // set input -stringstream to line-buffer string - s = (const char*) line_buffer; - instream.str(s); - - // only read line if it is not a comment - int this_line_num_columns = 0; - if (! (instream.str().c_str()[0] == '#')) - { - - instream >> ws; // get rid of white spaces at beginning of stream - - // try to read values until we hit end of stream (which is end of line) - while (!instream.eof()) - { - - // if value was successfully extracted, we count this as a column - // and extract the data - if (instream >> val) - { - this_line_num_columns++; - - // based on the current column, we assign the data - // based on the selected varno (column) - - if (this_line_num_columns == varno) // real-part - val_re = (CCTK_REAL) val; - - if (this_line_num_columns == varno+1) { // imaginary-part - val_im = (CCTK_REAL) val; - //break; - } - } - else - { - CCTK_WARN(0, "Error in reading spherical coefficient file: not a number!"); - } - instream >> ws; // get rid of whitespaces - } - } - - - // if this line had no data continue with the next one, then we can assume that we - // the next data block is the next extraction sphere. - if (this_line_num_columns == 0) - { - l=0; - m=0; - sphere++; - continue; - } - else - { - //cout << sphere << ", " << l << ", " << m << endl; - coeff[sphere][l][m] = CCTK_Cmplx(val_re, val_im); - //cout << sphere << ", " << l << ", " << m << ", " << coeff[sphere][l][m] << ", " << coeff[sphere].size() << endl; - - m++; - - if (m >= 2*l+1) - { - l++; - m=0; - } - } - } - - delete [] line_buffer; -}*/
- // read all modes on all extraction spheres for a given timestep and variable number into array void SPH_db_ASCII::read(const size_t timestep, const size_t varno, vector<vector<vector<CCTK_COMPLEX> > >& coeff) const { - //cout << _fname << ": reading timestep " << timestep << ", variable " << varno << endl; - // check cache if data is there and return it if (is_in_cache(timestep, varno, coeff)) return;
@@ -205,10 +101,8 @@
file.clear();
- //cout << file.tellg() << endl; // move-pointer to byte-offset for requested timestep file.seekg(byte_offset[timestep], ios::beg); - //cout << timestep << " " << file.tellg() << " " << byte_offset[timestep] << " " << byte_offset[timestep+1] << endl;
char *line_buffer = new char[10000];
@@ -233,7 +127,6 @@ l=0; m=0; sphere=0; - //cout << t << endl; } // reset input-stringstream (clear from previous errors etc.) instream.clear(); @@ -285,10 +178,6 @@ } else { - //cout << sphere << ", " << l << ", " << m << endl; - //coeff[sphere][l][m] = CCTK_Cmplx(val_re, val_im); - //cout << sphere << ", " << l << ", " << m << ", " << coeff[sphere][l][m] << ", " << coeff[sphere].size() << endl; - m++; if (m >= 2*l+1) @@ -301,8 +190,6 @@
delete [] line_buffer;
- // done reading in cache ------------------------------- - //cout << "done" << endl;
// finally set coeff array according to cache if (!is_in_cache(timestep, varno, coeff)) @@ -347,7 +234,6 @@ s.clear();
// store byte offset of this line - //int offset = file.tellg(); this_line.byte_offset = file.tellg();
// read line from file (max 10000 chars) @@ -558,7 +444,6 @@ void SPH_db_DAT::read(const size_t timestep, const size_t varno, vector<vector<vector<CCTK_COMPLEX> > >& coeff) const { - //cout << _fname << ": reading timestep " << timestep << ", variable " << varno << endl;
// check cache if data is there and return it if (is_in_cache(timestep, varno*2+1, coeff)) return; @@ -589,10 +474,8 @@
file.clear();
- //cout << file.tellg() << endl; // move-pointer to byte-offset for requested timestep file.seekg(byte_offset[timestep], ios::beg); - //cout << timestep << " " << file.tellg() << " " << byte_offset[timestep] << " " << byte_offset[timestep+1] << endl;
char *line_buffer = new char[1000000];
@@ -653,26 +536,6 @@ // based on the current column, we assign the data // based on the selected varno (column) - /*if (this_line_num_columns == start_column) // real part - val_re = (CCTK_REAL) val; - - if (this_line_num_columns == start_column+1) { // imaginary-part - val_im = (CCTK_REAL) val; - - coeff[sphere][l][m] = CCTK_Cmplx(val_re, val_im); - start_column += 2; // next lm-mode - m++; - if (m >= 2*l+1) - { - l++; - m=0; - } - if (l >= _lmax) { - done = true; - break; // stop reading further! - } - }*/ - if (this_line_num_columns == column) // real part cache[t][v][sphere][l][inverse_m ? 2*l-m : m] = (CCTK_REAL) val; @@ -711,10 +574,7 @@ }
delete [] line_buffer; - - // done reading in cache ------------------------------- - //cout << "done" << endl; - + // finally set coeff array according to cache if (!is_in_cache(timestep, varno*2+1, coeff)) CCTK_WARN(0, "Variable not in cache even though I have put it there!"); @@ -753,7 +613,6 @@ s.clear();
// store byte offset of this line - //int offset = file.tellg(); this_line.byte_offset = file.tellg();
// read line from file (max 1000000 chars) @@ -821,10 +680,6 @@ new_dataset(this_line); }
- /*if (!first_line && num_columns != this_line_num_columns) - { - CCTK_WARN(0, "Error in reading spherical coefficient file: Number of columns of the current line have to be equal to other lines!"); - }*/
// compare the data of current line with data of previous line // and decide whether we have a new iteration etc... @@ -1006,7 +861,6 @@ int c = 0; for (int l=0; l <= _lmax; ++l) { for (int m=l; m >= -l; --m, ++c) { - //coeff[0][l][m+l] = CCTK_Cmplx(buffer[c], buffer[c + buffer.size()/2]); coeff[0][l][m+l] = CCTK_Cmplx(buffer[2*c], buffer[2*c + 1]); } } @@ -1058,12 +912,9 @@ H5_INDEX_NAME, H5_ITER_NATIVE, NULL, H5iter, this, H5P_DEFAULT));
- // sort 'steps' vector - //sort(steps.begin(), steps.end()); _iterations.resize(steps.size()); _times.resize(steps.size()); for (size_t i=0; i < steps.size(); ++i) { - //cout << steps[i].name << " " << steps[i].time << endl; _iterations[i] = i; _times[i] = steps[i].time; } @@ -1072,7 +923,6 @@ hid_t dataset = HDF5_ERROR(H5Dopen(file, (varname_table[0][0]+"/"+ steps[0].name+"/"+ varname_table[0][1]).c_str())); - //cout << (varname_table[0][0]+"/"+steps[0].name+"/"+varname_table[0][1]) << endl; hid_t dataspace = HDF5_ERROR(H5Dget_space(dataset)); hsize_t size = HDF5_ERROR(H5Sget_simple_extent_npoints(dataspace)); HDF5_ERROR(H5Sclose(dataspace)); @@ -1275,7 +1125,6 @@ int c = 0; for (int l=0; l <= _lmax; ++l) { for (int m=l; m >= -l; --m, ++c) { - //coeff[0][l][m+l] = CCTK_Cmplx(buffer[2*c], buffer[2*c + 1]); cache[t][2*v ][0][l][m+l] = buffer[t*nmodes + 2*c]; cache[t][2*v+1][0][l][m+l] = buffer[t*nmodes + 2*c + 1]; } @@ -1293,26 +1142,9 @@
void SPH_db_SpEC_H5_v2::scan_HDF5() -{/* - // pick one variable and browse through entire file - // to find out how many (and what) cycles and times there are - // (assuming that all variables are present at the same timesteps) - H5Literate_by_name (file, varname_table[0][0].c_str(), H5_INDEX_NAME, H5_ITER_NATIVE, NULL, H5iter, this, H5P_DEFAULT); - - // sort 'steps' vector - //sort(steps.begin(), steps.end()); - _iterations.resize(steps.size()); - _times.resize(steps.size()); - for (size_t i=0; i < steps.size(); ++i) { - //cout << steps[i].name << " " << steps[i].time << endl; - _iterations[i] = i; - _times[i] = steps[i].time; - } -*/ - +{ // get lmax from first variable and timestep hid_t dataset = HDF5_ERROR(H5Dopen(file, "gxx.dat")); - //cout << (varname_table[0][0]+"/"+steps[0].name+"/"+varname_table[0][1]) << endl; hid_t dataspace = HDF5_ERROR(H5Dget_space(dataset)); hsize_t dims[2]; HDF5_ERROR(H5Sget_simple_extent_dims (dataspace, dims, NULL)); @@ -1346,7 +1178,6 @@ _iterations.resize(steps.size()); _times.resize(steps.size()); for (size_t i=0; i < steps.size(); ++i) { - //cout << steps[i].name << " " << steps[i].time << endl; _iterations[i] = i; _times[i] = steps[i]; }
File [modified]: sph_database.hh Delta lines: +0 -8 =================================================================== --- PITTNullCode/SphericalHarmonicReconGen/src/sph_database.hh 2014-03-14 16:05:18 UTC (rev 122) +++ PITTNullCode/SphericalHarmonicReconGen/src/sph_database.hh 2015-07-09 11:55:34 UTC (rev 123) @@ -160,8 +160,6 @@ double radius; record_t() : byte_offset(0), line_length(0), time(-100000), it(0), radius(0) { } - - //vector<double> columns; };
@@ -252,8 +250,6 @@ record_t() : byte_offset(0), line_length(0), time(-100000), it(0), radius(0), lmax(-1), n_variables(-1) { } - - //vector<double> columns; };
@@ -678,10 +674,6 @@ } } } - //cout << "iteration_in_file:" << iteration_in_file << ", "; - //cout << coeff[0][1][8][8].real() << " "; - //cout << coeff[1][1][8][8].real() << " "; - //cout << coeff[2][1][8][8].real() << " " << endl; }
File [modified]: startup.cc Delta lines: +1 -1 =================================================================== --- PITTNullCode/SphericalHarmonicReconGen/src/startup.cc 2014-03-14 16:05:18 UTC (rev 122) +++ PITTNullCode/SphericalHarmonicReconGen/src/startup.cc 2015-07-09 11:55:34 UTC (rev 123) @@ -323,7 +323,7 @@
// set iteration number in file to current iteration // (which in case of recovery and/or initial_time!=0 is non-zero) - SHR::iteration_in_file = cctk_iteration;// + SHR::C[0]->get_iteration(initial_time); + SHR::iteration_in_file = cctk_iteration;
}
commits@lists.einsteintoolkit.org