Loading src/libnptm/Configuration.cpp +864 −878 Original line number Original line Diff line number Diff line Loading @@ -72,14 +72,8 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(string file_name) { regex re = regex("-?[0-9]+"); regex re = regex("-?[0-9]+"); str_target = file_lines[last_read_line++]; str_target = file_lines[last_read_line++]; regex_search(str_target, m, re); regex_search(str_target, m, re); //sscanf(file_lines[last_read_line].c_str(), " %d", &_nsph); _nsph = stoi(m.str()); _nsph = stoi(m.str()); if (_nsph == 1) { if (_nsph == 1) { //sscanf( // file_lines[last_read_line++].c_str(), // " %*d %d %d %d %d %d", // &_lm, &_in_pol, &_npnt, &_npntts, &_isam //); for (int ri = 0; ri < 5; ri++) { for (int ri = 0; ri < 5; ri++) { str_target = m.suffix().str(); str_target = m.suffix().str(); regex_search(str_target, m, re); regex_search(str_target, m, re); Loading @@ -90,11 +84,6 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(string file_name) { if (ri == 4) _isam = stoi(m.str()); if (ri == 4) _isam = stoi(m.str()); } } } else { } else { //sscanf( // file_lines[last_read_line++].c_str(), // " %*d %d %d %d %d %d %d %d %d", // &_li, &_le, &_mxndm, &_in_pol, &_npnt, &_npntts, &_iavm, &_isam //); for (int ri = 0; ri < 8; ri++) { for (int ri = 0; ri < 8; ri++) { str_target = m.suffix().str(); str_target = m.suffix().str(); regex_search(str_target, m, re); regex_search(str_target, m, re); Loading Loading @@ -166,7 +155,6 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(string file_name) { re = regex("[0-9]+"); re = regex("[0-9]+"); str_target = file_lines[last_read_line++]; str_target = file_lines[last_read_line++]; regex_search(str_target, m, re); regex_search(str_target, m, re); //sscanf(file_lines[last_read_line].c_str(), " %d", &_nsph); _jwtm = stoi(m.str()); _jwtm = stoi(m.str()); GeometryConfiguration *conf = new GeometryConfiguration( GeometryConfiguration *conf = new GeometryConfiguration( _nsph, _lm, _in_pol, _npnt, _npntts, _isam, _nsph, _lm, _in_pol, _npnt, _npntts, _isam, Loading Loading @@ -403,9 +391,7 @@ ScattererConfiguration* ScattererConfiguration::from_dedfb(string dedfb_file_nam variable_name = "XIV"; variable_name = "XIV"; if (instpc < 1) { // The variable vector is explicitly defined. if (instpc < 1) { // The variable vector is explicitly defined. double xi; double xi; //int xi_exp; List<double> xi_vector; List<double> xi_vector; //sscanf(file_lines[++last_read_line].c_str(), " %9lE D%d", &xi, &xi_exp); str_target = file_lines[++last_read_line]; str_target = file_lines[++last_read_line]; re = regex("-?[0-9]+\\.[0-9]+([eEdD][-+]?)?[0-9]+"); re = regex("-?[0-9]+\\.[0-9]+([eEdD][-+]?)?[0-9]+"); regex_search(str_target, m, re); regex_search(str_target, m, re); Loading Loading @@ -448,9 +434,7 @@ ScattererConfiguration* ScattererConfiguration::from_dedfb(string dedfb_file_nam variable_vector = new double[nxi](); variable_vector = new double[nxi](); if (instpc == 0) { // The variable vector is explicitly defined if (instpc == 0) { // The variable vector is explicitly defined double vs; double vs; //int vs_exp; for (int jxi_r = 0; jxi_r < nxi; jxi_r++) { for (int jxi_r = 0; jxi_r < nxi; jxi_r++) { //sscanf(file_lines[++last_read_line].c_str(), " %lf D%d", &vs, &vs_exp); str_target = file_lines[++last_read_line]; str_target = file_lines[++last_read_line]; re = regex("-?[0-9]+\\.[0-9]+([eEdD][-+]?)?[0-9]+"); re = regex("-?[0-9]+\\.[0-9]+([eEdD][-+]?)?[0-9]+"); regex_search(str_target, m, re); regex_search(str_target, m, re); Loading Loading @@ -479,8 +463,6 @@ ScattererConfiguration* ScattererConfiguration::from_dedfb(string dedfb_file_nam } } } else { // The variable vector needs to be computed in steps } else { // The variable vector needs to be computed in steps double vs, vs_step; double vs, vs_step; //int vs_exp, vs_step_exp; //sscanf(file_lines[++last_read_line].c_str(), " %lf D%d %lf D%d", &vs, &vs_exp, &vs_step, &vs_step_exp); str_target = file_lines[++last_read_line]; str_target = file_lines[++last_read_line]; re = regex("-?[0-9]+\\.[0-9]+([eEdD][-+]?)?[0-9]+"); re = regex("-?[0-9]+\\.[0-9]+([eEdD][-+]?)?[0-9]+"); regex_search(str_target, m, re); regex_search(str_target, m, re); Loading Loading @@ -516,33 +498,37 @@ ScattererConfiguration* ScattererConfiguration::from_dedfb(string dedfb_file_nam } } } } } } last_read_line++; //last_read_line++; int *iog_vector = new int[nsph](); int *iog_vector = new int[nsph](); double *ros_vector = new double[nsph](); double *ros_vector = new double[nsph](); double **rcf_vector = new double*[nsph]; double **rcf_vector = new double*[nsph]; int *nshl_vector = new int[nsph](); int *nshl_vector = new int[nsph](); //printf("\nDEBUG: reading IOG from %s", file_lines[last_read_line].c_str()); /*for (int i = 0; i < nsph; i++) { //fflush(stdout); for (int i = 0; i < nsph; i++) { string read_format = ""; string read_format = ""; for (int j = 0; j < (i % 15); j++) read_format += " %*d"; for (int j = 0; j < (i % 15); j++) read_format += " %*d"; read_format += " %d"; read_format += " %d"; sscanf(file_lines[last_read_line].c_str(), read_format.c_str(), (iog_vector + i)); sscanf(file_lines[last_read_line].c_str(), read_format.c_str(), (iog_vector + i)); if (i > 0 && i % 15 == 0) { if (i > 0 && i % 15 == 0) { last_read_line++; last_read_line++; //printf("DEBUG: reading IOG from %s", file_lines[last_read_line].c_str()); } //fflush(stdout); }*/ int filled_iogs = 0; re = regex("[0-9]+"); while (filled_iogs < nsph) { string str_target = file_lines[++last_read_line]; while(regex_search(str_target, m, re)) { iog_vector[filled_iogs++] = stoi(m.str()); str_target = m.suffix().str(); if (filled_iogs == nsph) break; } } } } for (int i113 = 1; i113 <= nsph; i113++) { for (int i113 = 1; i113 <= nsph; i113++) { int i_val, nsh; int i_val, nsh; double ros_val; double ros_val; //int ros_val_exp; if (iog_vector[i113 - 1] < i113) { if (iog_vector[i113 - 1] < i113) { rcf_vector[i113 - 1] = new double[1](); rcf_vector[i113 - 1] = new double[1](); continue; continue; } } //sscanf(file_lines[++last_read_line].c_str(), " %d %lf D%d", &i_val, &ros_val, &ros_val_exp); re = regex("[0-9]+"); re = regex("[0-9]+"); str_target = file_lines[++last_read_line]; str_target = file_lines[++last_read_line]; regex_search(str_target, m, re); regex_search(str_target, m, re); Loading Loading
src/libnptm/Configuration.cpp +864 −878 Original line number Original line Diff line number Diff line Loading @@ -72,14 +72,8 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(string file_name) { regex re = regex("-?[0-9]+"); regex re = regex("-?[0-9]+"); str_target = file_lines[last_read_line++]; str_target = file_lines[last_read_line++]; regex_search(str_target, m, re); regex_search(str_target, m, re); //sscanf(file_lines[last_read_line].c_str(), " %d", &_nsph); _nsph = stoi(m.str()); _nsph = stoi(m.str()); if (_nsph == 1) { if (_nsph == 1) { //sscanf( // file_lines[last_read_line++].c_str(), // " %*d %d %d %d %d %d", // &_lm, &_in_pol, &_npnt, &_npntts, &_isam //); for (int ri = 0; ri < 5; ri++) { for (int ri = 0; ri < 5; ri++) { str_target = m.suffix().str(); str_target = m.suffix().str(); regex_search(str_target, m, re); regex_search(str_target, m, re); Loading @@ -90,11 +84,6 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(string file_name) { if (ri == 4) _isam = stoi(m.str()); if (ri == 4) _isam = stoi(m.str()); } } } else { } else { //sscanf( // file_lines[last_read_line++].c_str(), // " %*d %d %d %d %d %d %d %d %d", // &_li, &_le, &_mxndm, &_in_pol, &_npnt, &_npntts, &_iavm, &_isam //); for (int ri = 0; ri < 8; ri++) { for (int ri = 0; ri < 8; ri++) { str_target = m.suffix().str(); str_target = m.suffix().str(); regex_search(str_target, m, re); regex_search(str_target, m, re); Loading Loading @@ -166,7 +155,6 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(string file_name) { re = regex("[0-9]+"); re = regex("[0-9]+"); str_target = file_lines[last_read_line++]; str_target = file_lines[last_read_line++]; regex_search(str_target, m, re); regex_search(str_target, m, re); //sscanf(file_lines[last_read_line].c_str(), " %d", &_nsph); _jwtm = stoi(m.str()); _jwtm = stoi(m.str()); GeometryConfiguration *conf = new GeometryConfiguration( GeometryConfiguration *conf = new GeometryConfiguration( _nsph, _lm, _in_pol, _npnt, _npntts, _isam, _nsph, _lm, _in_pol, _npnt, _npntts, _isam, Loading Loading @@ -403,9 +391,7 @@ ScattererConfiguration* ScattererConfiguration::from_dedfb(string dedfb_file_nam variable_name = "XIV"; variable_name = "XIV"; if (instpc < 1) { // The variable vector is explicitly defined. if (instpc < 1) { // The variable vector is explicitly defined. double xi; double xi; //int xi_exp; List<double> xi_vector; List<double> xi_vector; //sscanf(file_lines[++last_read_line].c_str(), " %9lE D%d", &xi, &xi_exp); str_target = file_lines[++last_read_line]; str_target = file_lines[++last_read_line]; re = regex("-?[0-9]+\\.[0-9]+([eEdD][-+]?)?[0-9]+"); re = regex("-?[0-9]+\\.[0-9]+([eEdD][-+]?)?[0-9]+"); regex_search(str_target, m, re); regex_search(str_target, m, re); Loading Loading @@ -448,9 +434,7 @@ ScattererConfiguration* ScattererConfiguration::from_dedfb(string dedfb_file_nam variable_vector = new double[nxi](); variable_vector = new double[nxi](); if (instpc == 0) { // The variable vector is explicitly defined if (instpc == 0) { // The variable vector is explicitly defined double vs; double vs; //int vs_exp; for (int jxi_r = 0; jxi_r < nxi; jxi_r++) { for (int jxi_r = 0; jxi_r < nxi; jxi_r++) { //sscanf(file_lines[++last_read_line].c_str(), " %lf D%d", &vs, &vs_exp); str_target = file_lines[++last_read_line]; str_target = file_lines[++last_read_line]; re = regex("-?[0-9]+\\.[0-9]+([eEdD][-+]?)?[0-9]+"); re = regex("-?[0-9]+\\.[0-9]+([eEdD][-+]?)?[0-9]+"); regex_search(str_target, m, re); regex_search(str_target, m, re); Loading Loading @@ -479,8 +463,6 @@ ScattererConfiguration* ScattererConfiguration::from_dedfb(string dedfb_file_nam } } } else { // The variable vector needs to be computed in steps } else { // The variable vector needs to be computed in steps double vs, vs_step; double vs, vs_step; //int vs_exp, vs_step_exp; //sscanf(file_lines[++last_read_line].c_str(), " %lf D%d %lf D%d", &vs, &vs_exp, &vs_step, &vs_step_exp); str_target = file_lines[++last_read_line]; str_target = file_lines[++last_read_line]; re = regex("-?[0-9]+\\.[0-9]+([eEdD][-+]?)?[0-9]+"); re = regex("-?[0-9]+\\.[0-9]+([eEdD][-+]?)?[0-9]+"); regex_search(str_target, m, re); regex_search(str_target, m, re); Loading Loading @@ -516,33 +498,37 @@ ScattererConfiguration* ScattererConfiguration::from_dedfb(string dedfb_file_nam } } } } } } last_read_line++; //last_read_line++; int *iog_vector = new int[nsph](); int *iog_vector = new int[nsph](); double *ros_vector = new double[nsph](); double *ros_vector = new double[nsph](); double **rcf_vector = new double*[nsph]; double **rcf_vector = new double*[nsph]; int *nshl_vector = new int[nsph](); int *nshl_vector = new int[nsph](); //printf("\nDEBUG: reading IOG from %s", file_lines[last_read_line].c_str()); /*for (int i = 0; i < nsph; i++) { //fflush(stdout); for (int i = 0; i < nsph; i++) { string read_format = ""; string read_format = ""; for (int j = 0; j < (i % 15); j++) read_format += " %*d"; for (int j = 0; j < (i % 15); j++) read_format += " %*d"; read_format += " %d"; read_format += " %d"; sscanf(file_lines[last_read_line].c_str(), read_format.c_str(), (iog_vector + i)); sscanf(file_lines[last_read_line].c_str(), read_format.c_str(), (iog_vector + i)); if (i > 0 && i % 15 == 0) { if (i > 0 && i % 15 == 0) { last_read_line++; last_read_line++; //printf("DEBUG: reading IOG from %s", file_lines[last_read_line].c_str()); } //fflush(stdout); }*/ int filled_iogs = 0; re = regex("[0-9]+"); while (filled_iogs < nsph) { string str_target = file_lines[++last_read_line]; while(regex_search(str_target, m, re)) { iog_vector[filled_iogs++] = stoi(m.str()); str_target = m.suffix().str(); if (filled_iogs == nsph) break; } } } } for (int i113 = 1; i113 <= nsph; i113++) { for (int i113 = 1; i113 <= nsph; i113++) { int i_val, nsh; int i_val, nsh; double ros_val; double ros_val; //int ros_val_exp; if (iog_vector[i113 - 1] < i113) { if (iog_vector[i113 - 1] < i113) { rcf_vector[i113 - 1] = new double[1](); rcf_vector[i113 - 1] = new double[1](); continue; continue; } } //sscanf(file_lines[++last_read_line].c_str(), " %d %lf D%d", &i_val, &ros_val, &ros_val_exp); re = regex("[0-9]+"); re = regex("[0-9]+"); str_target = file_lines[++last_read_line]; str_target = file_lines[++last_read_line]; regex_search(str_target, m, re); regex_search(str_target, m, re); Loading