diff --git a/src/libnptm/Configuration.cpp b/src/libnptm/Configuration.cpp index 4e96a32f4da27fcaba2c4abfe94408b251afa388..9dff8f8fbcbe730852cb8e4423e411b315c26e48 100644 --- a/src/libnptm/Configuration.cpp +++ b/src/libnptm/Configuration.cpp @@ -673,34 +673,6 @@ void ScattererConfiguration::write_binary(string file_name, string mode) { if (mode.compare("LEGACY") == 0) { // Legacy mode was chosen. fstream output; int ies = (use_external_sphere)? 1 : 0; - double *xi_vec; - if (reference_variable_name.compare("XIV") == 0) xi_vec = scale_vec; - else { - is_new_vector = true; - xi_vec = new double[number_of_scales]; - if (reference_variable_name.compare("WNS") == 0) { - for (int i = 0; i < number_of_scales; i++) - xi_vec[i] = 3.0e8 * scale_vec[i] / wp; - } else if (reference_variable_name.compare("WLS") == 0) { - for (int i = 0; i < number_of_scales; i++) { - double wn = two_pi / scale_vec[i]; - xi_vec[i] = 3.0e8 * wn / wp; - } - } else if (reference_variable_name.compare("PUS") == 0) { - for (int i = 0; i < number_of_scales; i++) - xi_vec[i] = scale_vec[i] / wp; - } else if (reference_variable_name.compare("EVS") == 0) { - for (int i = 0; i < number_of_scales; i++) { - double pu = scale_vec[i] / evc; - xi_vec[i] = pu / wp; - } - } else { - throw UnrecognizedConfigurationException( - "Wrong parameter set: unrecognized scale type " - + reference_variable_name - ); - } - } output.open(file_name.c_str(), ios::out | ios::binary); output.write(reinterpret_cast<char *>(&number_of_spheres), sizeof(int)); for (int i = 0; i < number_of_spheres; i++) @@ -711,7 +683,7 @@ void ScattererConfiguration::write_binary(string file_name, string mode) { output.write(reinterpret_cast<char *>(&idfc), sizeof(int)); output.write(reinterpret_cast<char *>(&number_of_scales), sizeof(int)); for (int i = 0; i < number_of_scales; i++) - output.write(reinterpret_cast<char *>(&(xi_vec[i])), sizeof(double)); + output.write(reinterpret_cast<char *>(&(scale_vec[i])), sizeof(double)); for (int i115 = 1; i115 <= number_of_spheres; i115++) { if (iog_vec[i115 - 1] < i115) continue; output.write(reinterpret_cast<char *>(&(nshl_vec[i115 - 1])), sizeof(int)); @@ -741,7 +713,6 @@ void ScattererConfiguration::write_binary(string file_name, string mode) { } } } - if (is_new_vector) delete[] xi_vec; output.close(); } } @@ -790,10 +761,10 @@ void ScattererConfiguration::write_formatted(string file_name) { case 1: fprintf(output, " JXI WNS WLS PUS EVS XIV\n"); for (int i = 0; i < number_of_scales; i++) { - wn_vec[i] = scale_vec[i]; - wl_vec[i] = two_pi / wn_vec[i]; - xi_vec[i] = 3.0e8 * wn_vec[i] / wp; + xi_vec[i] = scale_vec[i]; pu_vec[i] = xi_vec[i] * wp; + wn_vec[i] = pu_vec[i] / 3.0e8; + wl_vec[i] = two_pi / wn_vec[i]; ev_vec[i] = pu_vec[i] * evc; fprintf( output, @@ -810,10 +781,10 @@ void ScattererConfiguration::write_formatted(string file_name) { case 2: fprintf(output, " JXI WLS WNS PUS EVS XIV\n"); for (int i = 0; i < number_of_scales; i++) { - wl_vec[i] = scale_vec[i]; - wn_vec[i] = two_pi / wl_vec[i]; - xi_vec[i] = 3.0e8 * wn_vec[i] / wp; + xi_vec[i] = scale_vec[i]; pu_vec[i] = xi_vec[i] * wp; + wn_vec[i] = pu_vec[i] / 3.0e8; + wl_vec[i] = two_pi / wn_vec[i]; ev_vec[i] = pu_vec[i] * evc; fprintf( output, @@ -830,8 +801,8 @@ void ScattererConfiguration::write_formatted(string file_name) { case 3: fprintf(output, " JXI PUS WNS WLS EVS XIV\n"); for (int i = 0; i < number_of_scales; i++) { - pu_vec[i] = scale_vec[i]; - xi_vec[i] = pu_vec[i] / wp; + xi_vec[i] = scale_vec[i]; + pu_vec[i] = xi_vec[i] * wp; wn_vec[i] = pu_vec[i] / 3.0e8; wl_vec[i] = two_pi / wn_vec[i]; ev_vec[i] = pu_vec[i] * evc; @@ -850,11 +821,11 @@ void ScattererConfiguration::write_formatted(string file_name) { case 4: fprintf(output, " JXI EVS WNS WLS PUS XIV\n"); for (int i = 0; i < number_of_scales; i++) { - ev_vec[i] = scale_vec[i]; - pu_vec[i] = ev_vec[i] / evc; - xi_vec[i] = pu_vec[i] / wp; + xi_vec[i] = scale_vec[i]; + pu_vec[i] = xi_vec[i] * wp; wn_vec[i] = pu_vec[i] / 3.0e8; wl_vec[i] = two_pi / wn_vec[i]; + ev_vec[i] = pu_vec[i] * evc; fprintf( output, "%5d%13.4lE%13.4lE%13.4lE%13.4lE%13.4lE\n",