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
49d0ff83
Commit
49d0ff83
authored
3 months ago
by
Giovanni La Mura
Browse files
Options
Downloads
Patches
Plain Diff
Ensure all ScattererConfiguration building methods use max_layers
parent
d6b11123
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
+18
-8
18 additions, 8 deletions
src/libnptm/Configuration.cpp
with
18 additions
and
8 deletions
src/libnptm/Configuration.cpp
+
18
−
8
View file @
49d0ff83
...
@@ -356,14 +356,17 @@ ScattererConfiguration::ScattererConfiguration(
...
@@ -356,14 +356,17 @@ ScattererConfiguration::ScattererConfiguration(
_iog_vec
=
iog_vector
;
_iog_vec
=
iog_vector
;
_radii_of_spheres
=
ros_vector
;
_radii_of_spheres
=
ros_vector
;
_nshl_vec
=
nshl_vector
;
_nshl_vec
=
nshl_vector
;
_use_external_sphere
=
is_external
;
_max_layers
=
0
;
_max_layers
=
0
;
for
(
int
li
=
0
;
li
<
_configurations
;
li
++
)
{
for
(
int
li
=
0
;
li
<
_configurations
;
li
++
)
{
if
(
_max_layers
<
_nshl_vec
[
li
])
_max_layers
=
_nshl_vec
[
li
];
if
(
_max_layers
<
_nshl_vec
[
li
])
{
_max_layers
=
_nshl_vec
[
li
];
if
(
li
==
0
&&
_use_external_sphere
)
_max_layers
+=
1
;
}
}
}
_rcf
=
rcf_vector
;
_rcf
=
rcf_vector
;
_idfc
=
dielectric_func_type
;
_idfc
=
dielectric_func_type
;
_dc0_matrix
=
dc_matrix
;
_dc0_matrix
=
dc_matrix
;
_use_external_sphere
=
is_external
;
_exdc
=
ex
;
_exdc
=
ex
;
_wp
=
w
;
_wp
=
w
;
_xip
=
x
;
_xip
=
x
;
...
@@ -719,8 +722,9 @@ ScattererConfiguration* ScattererConfiguration::from_dedfb(const std::string& de
...
@@ -719,8 +722,9 @@ ScattererConfiguration* ScattererConfiguration::from_dedfb(const std::string& de
re
=
regex
(
"[0-9]+"
);
re
=
regex
(
"[0-9]+"
);
regex_search
(
str_target
,
m
,
re
);
regex_search
(
str_target
,
m
,
re
);
nshl_vector
[
last_configuration
-
1
]
=
stoi
(
m
.
str
());
nshl_vector
[
last_configuration
-
1
]
=
stoi
(
m
.
str
());
if
(
max_layers
<
nshl_vector
[
last_configuration
-
1
]
+
1
)
if
(
max_layers
<
nshl_vector
[
last_configuration
-
1
])
max_layers
=
nshl_vector
[
last_configuration
-
1
]
+
1
;
max_layers
=
nshl_vector
[
last_configuration
-
1
];
if
(
last_configuration
==
1
&&
fies
==
1
)
max_layers
+=
1
;
str_target
=
m
.
suffix
().
str
();
str_target
=
m
.
suffix
().
str
();
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
);
...
@@ -824,12 +828,17 @@ ScattererConfiguration* ScattererConfiguration::from_hdf5(const std::string& fil
...
@@ -824,12 +828,17 @@ ScattererConfiguration* ScattererConfiguration::from_hdf5(const std::string& fil
ros_vector
=
new
double
[
configuration_count
]();
ros_vector
=
new
double
[
configuration_count
]();
rcf_vector
=
new
double
*
[
configuration_count
];
rcf_vector
=
new
double
*
[
configuration_count
];
last_configuration
=
0
;
last_configuration
=
0
;
int
max_layers
=
0
;
for
(
int
i115
=
1
;
i115
<=
configuration_count
;
i115
++
)
{
for
(
int
i115
=
1
;
i115
<=
configuration_count
;
i115
++
)
{
if
(
iog
[
i115
-
1
]
<
i115
)
continue
;
if
(
iog
[
i115
-
1
]
<
i115
)
continue
;
else
last_configuration
++
;
else
last_configuration
++
;
str_name
=
"NSHL_"
+
to_string
(
last_configuration
);
str_name
=
"NSHL_"
+
to_string
(
last_configuration
);
str_type
=
"INT32_(1)"
;
str_type
=
"INT32_(1)"
;
status
=
hdf_file
->
read
(
str_name
,
str_type
,
(
nshl_vector
+
last_configuration
-
1
));
status
=
hdf_file
->
read
(
str_name
,
str_type
,
(
nshl_vector
+
last_configuration
-
1
));
if
(
max_layers
<
nshl_vector
[
last_configuration
-
1
])
{
max_layers
=
nshl_vector
[
last_configuration
-
1
];
if
(
last_configuration
==
1
&&
ies
==
1
)
max_layers
+=
1
;
}
str_name
=
"ROS_"
+
to_string
(
last_configuration
);
str_name
=
"ROS_"
+
to_string
(
last_configuration
);
str_type
=
"FLOAT64_(1)"
;
str_type
=
"FLOAT64_(1)"
;
status
=
hdf_file
->
read
(
str_name
,
str_type
,
(
ros_vector
+
last_configuration
-
1
));
status
=
hdf_file
->
read
(
str_name
,
str_type
,
(
ros_vector
+
last_configuration
-
1
));
...
@@ -845,14 +854,14 @@ ScattererConfiguration* ScattererConfiguration::from_hdf5(const std::string& fil
...
@@ -845,14 +854,14 @@ ScattererConfiguration* ScattererConfiguration::from_hdf5(const std::string& fil
status
=
hdf_file
->
read
(
str_name
,
str_type
,
xi_vec
);
status
=
hdf_file
->
read
(
str_name
,
str_type
,
xi_vec
);
int
dim3
=
(
_idfc
==
0
)
?
nxi
:
1
;
int
dim3
=
(
_idfc
==
0
)
?
nxi
:
1
;
int
element_size
=
2
*
dim3
*
nsph
*
configuration_count
;
int
element_size
=
2
*
dim3
*
nsph
*
max_layers
;
double
*
elements
=
new
double
[
element_size
]();
double
*
elements
=
new
double
[
element_size
]();
str_name
=
"DC0M"
;
str_name
=
"DC0M"
;
str_type
=
"FLOAT64_("
+
to_string
(
element_size
)
+
")"
;
str_type
=
"FLOAT64_("
+
to_string
(
element_size
)
+
")"
;
status
=
hdf_file
->
read
(
str_name
,
str_type
,
elements
);
status
=
hdf_file
->
read
(
str_name
,
str_type
,
elements
);
dc0m
=
new
dcomplex
**
[
configuration_count
];
dc0m
=
new
dcomplex
**
[
max_layers
];
int
dc_index
=
0
;
int
dc_index
=
0
;
for
(
int
di
=
0
;
di
<
configuration_count
;
di
++
)
{
for
(
int
di
=
0
;
di
<
max_layers
;
di
++
)
{
dc0m
[
di
]
=
new
dcomplex
*
[
nsph
];
dc0m
[
di
]
=
new
dcomplex
*
[
nsph
];
for
(
int
dj
=
0
;
dj
<
nsph
;
dj
++
)
{
for
(
int
dj
=
0
;
dj
<
nsph
;
dj
++
)
{
dc0m
[
di
][
dj
]
=
new
dcomplex
[
dim3
]();
dc0m
[
di
][
dj
]
=
new
dcomplex
[
dim3
]();
...
@@ -927,8 +936,9 @@ ScattererConfiguration* ScattererConfiguration::from_legacy(const std::string& f
...
@@ -927,8 +936,9 @@ ScattererConfiguration* ScattererConfiguration::from_legacy(const std::string& f
int
max_layers
=
0
;
int
max_layers
=
0
;
for
(
int
li
=
0
;
li
<
configurations
;
li
++
)
{
for
(
int
li
=
0
;
li
<
configurations
;
li
++
)
{
if
(
max_layers
<
_nshl_vec
[
li
])
max_layers
=
_nshl_vec
[
li
];
if
(
max_layers
<
_nshl_vec
[
li
])
max_layers
=
_nshl_vec
[
li
];
if
(
li
==
0
&&
_ies
==
1
)
max_layers
+=
1
;
}
}
_dc0m
=
new
dcomplex
**
[
configuration
s
];
_dc0m
=
new
dcomplex
**
[
max_layer
s
];
int
dim3
=
(
_idfc
==
0
)
?
_nxi
:
1
;
int
dim3
=
(
_idfc
==
0
)
?
_nxi
:
1
;
for
(
int
di
=
0
;
di
<
max_layers
;
di
++
)
{
for
(
int
di
=
0
;
di
<
max_layers
;
di
++
)
{
_dc0m
[
di
]
=
new
dcomplex
*
[
_nsph
];
_dc0m
[
di
]
=
new
dcomplex
*
[
_nsph
];
...
...
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