Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NP_TMcode
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Giacomo Mulas
NP_TMcode
Commits
ae8572af
Commit
ae8572af
authored
Dec 15, 2023
by
Giovanni La Mura
Browse files
Options
Downloads
Patches
Plain Diff
Fix bug in reading IOG vector
parent
ca8c9b3a
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/libnptm/Configuration.cpp
+864
-878
864 additions, 878 deletions
src/libnptm/Configuration.cpp
with
864 additions
and
878 deletions
src/libnptm/Configuration.cpp
+
864
−
878
View file @
ae8572af
...
...
@@ -72,14 +72,8 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(string file_name) {
regex
re
=
regex
(
"-?[0-9]+"
);
str_target
=
file_lines
[
last_read_line
++
];
regex_search
(
str_target
,
m
,
re
);
//sscanf(file_lines[last_read_line].c_str(), " %d", &_nsph);
_nsph
=
stoi
(
m
.
str
());
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
++
)
{
str_target
=
m
.
suffix
().
str
();
regex_search
(
str_target
,
m
,
re
);
...
...
@@ -90,11 +84,6 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(string file_name) {
if
(
ri
==
4
)
_isam
=
stoi
(
m
.
str
());
}
}
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
++
)
{
str_target
=
m
.
suffix
().
str
();
regex_search
(
str_target
,
m
,
re
);
...
...
@@ -166,7 +155,6 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(string file_name) {
re
=
regex
(
"[0-9]+"
);
str_target
=
file_lines
[
last_read_line
++
];
regex_search
(
str_target
,
m
,
re
);
//sscanf(file_lines[last_read_line].c_str(), " %d", &_nsph);
_jwtm
=
stoi
(
m
.
str
());
GeometryConfiguration
*
conf
=
new
GeometryConfiguration
(
_nsph
,
_lm
,
_in_pol
,
_npnt
,
_npntts
,
_isam
,
...
...
@@ -403,9 +391,7 @@ ScattererConfiguration* ScattererConfiguration::from_dedfb(string dedfb_file_nam
variable_name
=
"XIV"
;
if
(
instpc
<
1
)
{
// The variable vector is explicitly defined.
double
xi
;
//int xi_exp;
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
];
re
=
regex
(
"-?[0-9]+
\\
.[0-9]+([eEdD][-+]?)?[0-9]+"
);
regex_search
(
str_target
,
m
,
re
);
...
...
@@ -448,9 +434,7 @@ ScattererConfiguration* ScattererConfiguration::from_dedfb(string dedfb_file_nam
variable_vector
=
new
double
[
nxi
]();
if
(
instpc
==
0
)
{
// The variable vector is explicitly defined
double
vs
;
//int vs_exp;
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
];
re
=
regex
(
"-?[0-9]+
\\
.[0-9]+([eEdD][-+]?)?[0-9]+"
);
regex_search
(
str_target
,
m
,
re
);
...
...
@@ -479,8 +463,6 @@ ScattererConfiguration* ScattererConfiguration::from_dedfb(string dedfb_file_nam
}
}
else
{
// The variable vector needs to be computed in steps
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
];
re
=
regex
(
"-?[0-9]+
\\
.[0-9]+([eEdD][-+]?)?[0-9]+"
);
regex_search
(
str_target
,
m
,
re
);
...
...
@@ -516,33 +498,37 @@ ScattererConfiguration* ScattererConfiguration::from_dedfb(string dedfb_file_nam
}
}
}
last_read_line
++
;
//
last_read_line++;
int
*
iog_vector
=
new
int
[
nsph
]();
double
*
ros_vector
=
new
double
[
nsph
]();
double
**
rcf_vector
=
new
double
*
[
nsph
];
int
*
nshl_vector
=
new
int
[
nsph
]();
//printf("\nDEBUG: reading IOG from %s", file_lines[last_read_line].c_str());
//fflush(stdout);
for
(
int
i
=
0
;
i
<
nsph
;
i
++
)
{
/*for (int i = 0; i < nsph; i++) {
string read_format = "";
for (int j = 0; j < (i % 15); j++) read_format += " %*d";
read_format += " %d";
sscanf(file_lines[last_read_line].c_str(), read_format.c_str(), (iog_vector + i));
if (i > 0 && i % 15 == 0) {
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
++
)
{
int
i_val
,
nsh
;
double
ros_val
;
//int ros_val_exp;
if
(
iog_vector
[
i113
-
1
]
<
i113
)
{
rcf_vector
[
i113
-
1
]
=
new
double
[
1
]();
continue
;
}
//sscanf(file_lines[++last_read_line].c_str(), " %d %lf D%d", &i_val, &ros_val, &ros_val_exp);
re
=
regex
(
"[0-9]+"
);
str_target
=
file_lines
[
++
last_read_line
];
regex_search
(
str_target
,
m
,
re
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment