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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Giacomo Mulas
NP_TMcode
Commits
6ffd3797
Commit
6ffd3797
authored
1 year ago
by
Giovanni La Mura
Browse files
Options
Downloads
Patches
Plain Diff
Fix bug in writing scale factor to binary
parent
b966ce93
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
+12
-41
12 additions, 41 deletions
src/libnptm/Configuration.cpp
with
12 additions
and
41 deletions
src/libnptm/Configuration.cpp
+
12
−
41
View file @
6ffd3797
...
...
@@ -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
"
,
...
...
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