Skip to content
Snippets Groups Projects
Commit 1a5fc963 authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Use detected number of parameters in first DEDFB line to discriminate application type

parent 167a64a2
No related branches found
No related tags found
No related merge requests found
...@@ -222,13 +222,18 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(const std::string& fil ...@@ -222,13 +222,18 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(const std::string& fil
throw ex; throw ex;
} }
int _nsph = 0, _lm = 0, _in_pol = 0, _npnt = 0, _npntts = 0, _isam = 0; int _nsph = 0, _lm = 0, _in_pol = 0, _npnt = 0, _npntts = 0, _isam = 0;
int _li = 0, _le = 0, _iavm = 0; int _li = 0, _le = 0, _iavm = 0, num_params = 0;
np_int _mxndm = 0; np_int _mxndm = 0;
regex re = regex("-?[0-9]+"); regex re = regex("-?[0-9]+");
str_target = file_lines[last_read_line];
while(regex_search(str_target, m, re)) {
str_target = m.suffix().str();
num_params++;
}
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);
_nsph = stoi(m.str()); _nsph = stoi(m.str());
if (_nsph == 1) { if (num_params == 6) {
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);
...@@ -238,7 +243,7 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(const std::string& fil ...@@ -238,7 +243,7 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(const std::string& fil
if (ri == 3) _npntts = stoi(m.str()); if (ri == 3) _npntts = stoi(m.str());
if (ri == 4) _isam = stoi(m.str()); if (ri == 4) _isam = stoi(m.str());
} }
} else { } else if (num_params == 9) {
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);
...@@ -251,6 +256,9 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(const std::string& fil ...@@ -251,6 +256,9 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(const std::string& fil
if (ri == 6) _iavm = stoi(m.str()); if (ri == 6) _iavm = stoi(m.str());
if (ri == 7) _isam = stoi(m.str()); if (ri == 7) _isam = stoi(m.str());
} }
} else {
OpenConfigurationFileException ex("ERROR: " + file_name + " is not a recognized input file.");
throw ex;
} }
double *x, *y, *z; double *x, *y, *z;
x = new double[_nsph]; x = new double[_nsph];
...@@ -313,8 +321,7 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(const std::string& fil ...@@ -313,8 +321,7 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(const std::string& fil
fjwtm = stoi(m.str()); fjwtm = 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,
_li, _le, _mxndm, _iavm, _li, _le, _mxndm, _iavm, x, y, z,
x, y, z,
in_th_start, in_th_step, in_th_end, in_th_start, in_th_step, in_th_end,
sc_th_start, sc_th_step, sc_th_end, sc_th_start, sc_th_step, sc_th_end,
in_ph_start, in_ph_step, in_ph_end, in_ph_start, in_ph_step, in_ph_end,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment