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
47bc1c8c
Commit
47bc1c8c
authored
2 months ago
by
Giovanni La Mura
Browse files
Options
Downloads
Patches
Plain Diff
Implement run-time configuration options in GeometryConfiguration
parent
78ed6f5f
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/include/Configuration.h
+41
-33
41 additions, 33 deletions
src/include/Configuration.h
src/libnptm/Configuration.cpp
+36
-9
36 additions, 9 deletions
src/libnptm/Configuration.cpp
with
77 additions
and
42 deletions
src/include/Configuration.h
+
41
−
33
View file @
47bc1c8c
...
...
@@ -109,54 +109,62 @@ protected:
double
*
_sph_y
;
//! \brief Vector of spherical components Z coordinates.
double
*
_sph_z
;
//! \brief Flag for matrix inversion refinement.
short
_refine_flag
;
//! \brief Flag for dynamic order management.
short
_dyn_order_flag
;
public:
//! \brief Read
only view on number of spherical components.
//! \brief Read
-
only view on number of spherical components.
const
int
&
number_of_spheres
=
_number_of_spheres
;
//! \brief Read
only view on maximum field expansion order.
//! \brief Read
-
only view on maximum field expansion order.
const
int
&
l_max
=
_l_max
;
//! \brief Read
only view on maximum internal field expansion order.
//! \brief Read
-
only view on maximum internal field expansion order.
const
int
&
li
=
_li
;
//! \brief Read
only view on maximum external field expansion order.
//! \brief Read
-
only view on maximum external field expansion order.
const
int
&
le
=
_le
;
//! \brief Read
only view on maximum dimension of allocated matrix allowance (deprecated).
//! \brief Read
-
only view on maximum dimension of allocated matrix allowance (deprecated).
const
np_int
&
mxndm
=
_mxndm
;
//! \brief Read
only view on the intensity mode flag.
//! \brief Read
-
only view on the intensity mode flag.
const
int
&
iavm
=
_iavm
;
//! \brief Read
only view on incident field polarization status (0 - linear, 1 - circular).
//! \brief Read
-
only view on incident field polarization status (0 - linear, 1 - circular).
const
int
&
in_pol
=
_in_pol
;
//! \brief Read
only view on number of points for transition layer integration.
//! \brief Read
-
only view on number of points for transition layer integration.
const
int
&
npnt
=
_npnt
;
//! \brief Read
only view on number of points for non-transition layer integration.
//! \brief Read
-
only view on number of points for non-transition layer integration.
const
int
&
npntts
=
_npntts
;
//! \brief Read
only view on type of meridional plane definition.
//! \brief Read
-
only view on type of meridional plane definition.
const
int
&
isam
=
_isam
;
//! \brief Read
only view on scale index for T-matrix output.
//! \brief Read
-
only view on scale index for T-matrix output.
const
int
&
jwtm
=
_jwtm
;
//! \brief Read
only view on incident field initial azimuth.
//! \brief Read
-
only view on incident field initial azimuth.
const
double
&
in_theta_start
=
_in_theta_start
;
//! \brief Read
only view on incident field azimuth step.
//! \brief Read
-
only view on incident field azimuth step.
const
double
&
in_theta_step
=
_in_theta_step
;
//! \brief Read
only view on incident field final azimuth.
//! \brief Read
-
only view on incident field final azimuth.
const
double
&
in_theta_end
=
_in_theta_end
;
//! \brief Read
only view on scattered field initial azimuth.
//! \brief Read
-
only view on scattered field initial azimuth.
const
double
&
sc_theta_start
=
_sc_theta_start
;
//! \brief Read
only view on scattered field azimuth step.
//! \brief Read
-
only view on scattered field azimuth step.
const
double
&
sc_theta_step
=
_sc_theta_step
;
//! \brief Read
only view on scattered field final azimuth.
//! \brief Read
-
only view on scattered field final azimuth.
const
double
&
sc_theta_end
=
_sc_theta_end
;
//! \brief Read
only view on incident field initial elevation.
//! \brief Read
-
only view on incident field initial elevation.
const
double
&
in_phi_start
=
_in_phi_start
;
//! \brief Read
only view on incident field elevation step.
//! \brief Read
-
only view on incident field elevation step.
const
double
&
in_phi_step
=
_in_phi_step
;
//! \brief Read
only view on incident field final elevation.
//! \brief Read
-
only view on incident field final elevation.
const
double
&
in_phi_end
=
_in_phi_end
;
//! \brief Read
only view on scattered field initial elevation.
//! \brief Read
-
only view on scattered field initial elevation.
const
double
&
sc_phi_start
=
_sc_phi_start
;
//! \brief Read
only view on scattered field elevation step.
//! \brief Read
-
only view on scattered field elevation step.
const
double
&
sc_phi_step
=
_sc_phi_step
;
//! \brief Read
only view on scattered field final elevation.
//! \brief Read
-
only view on scattered field final elevation.
const
double
&
sc_phi_end
=
_sc_phi_end
;
//! \brief Read-only view on flag for matrix inversion refinement.
const
short
&
refine_flag
=
_refine_flag
;
//! \brief Read-only view on flag for dynamic order management.
const
short
&
dyn_order_flag
=
_dyn_order_flag
;
/*! \brief Build a scattering geometry configuration structure.
*
...
...
@@ -361,25 +369,25 @@ protected:
*/
void
write_legacy
(
const
std
::
string
&
file_name
);
public:
//! \brief Read
only view on name of the reference variable type.
//! \brief Read
-
only view on name of the reference variable type.
const
std
::
string
&
reference_variable_name
=
_reference_variable_name
;
//! \brief Read
only view on number of spherical components.
//! \brief Read
-
only view on number of spherical components.
const
int
&
number_of_spheres
=
_number_of_spheres
;
//! \brief Read
only view on number of configurations.
//! \brief Read
-
only view on number of configurations.
const
int
&
configurations
=
_configurations
;
//! \brief Read
only view on number of scales to use in calculation.
//! \brief Read
-
only view on number of scales to use in calculation.
const
int
&
number_of_scales
=
_number_of_scales
;
//! \brief Read
only view on type of dielectric functions.
//! \brief Read
-
only view on type of dielectric functions.
const
int
&
idfc
=
_idfc
;
//! \brief Read
only view on external medium dielectric constant.
//! \brief Read
-
only view on external medium dielectric constant.
const
double
&
exdc
=
_exdc
;
//! \brief Read
only view on WP.
//! \brief Read
-
only view on WP.
const
double
&
wp
=
_wp
;
//! \brief Read
only view on peak XI.
//! \brief Read
-
only view on peak XI.
const
double
&
xip
=
_xip
;
//! \brief Read
only view on the maximum number of layers for the particle components.
//! \brief Read
-
only view on the maximum number of layers for the particle components.
const
int
&
max_layers
=
_max_layers
;
//! \brief Read
only view on flag to control whether to add an external layer.
//! \brief Read
-
only view on flag to control whether to add an external layer.
const
bool
&
use_external_sphere
=
_use_external_sphere
;
//! \brief Matrix of fractional transition radii with size [CONFIGURATIONS x LAYERS].
double
**
_rcf
;
...
...
This diff is collapsed.
Click to expand it.
src/libnptm/Configuration.cpp
+
36
−
9
View file @
47bc1c8c
...
...
@@ -65,13 +65,11 @@ using namespace std;
GeometryConfiguration
::
GeometryConfiguration
(
int
nsph
,
int
lm
,
int
in_pol
,
int
npnt
,
int
npntts
,
int
isam
,
int
li
,
int
le
,
np_int
mxndm
,
int
iavm
,
double
*
x
,
double
*
y
,
double
*
z
,
double
in_th_start
,
double
in_th_step
,
double
in_th_end
,
int
li
,
int
le
,
np_int
mxndm
,
int
iavm
,
double
*
x
,
double
*
y
,
double
*
z
,
double
in_th_start
,
double
in_th_step
,
double
in_th_end
,
double
sc_th_start
,
double
sc_th_step
,
double
sc_th_end
,
double
in_ph_start
,
double
in_ph_step
,
double
in_ph_end
,
double
sc_ph_start
,
double
sc_ph_step
,
double
sc_ph_end
,
int
jwtm
double
sc_ph_start
,
double
sc_ph_step
,
double
sc_ph_end
,
int
jwtm
)
{
_number_of_spheres
=
nsph
;
_l_max
=
lm
;
...
...
@@ -99,6 +97,8 @@ GeometryConfiguration::GeometryConfiguration(
_sph_x
=
x
;
_sph_y
=
y
;
_sph_z
=
z
;
_refine_flag
=
0
;
_dyn_order_flag
=
1
;
}
GeometryConfiguration
::
GeometryConfiguration
(
const
GeometryConfiguration
&
rhs
)
...
...
@@ -134,6 +134,8 @@ GeometryConfiguration::GeometryConfiguration(const GeometryConfiguration& rhs)
_sph_y
[
ni
]
=
rhs
.
_sph_y
[
ni
];
_sph_z
[
ni
]
=
rhs
.
_sph_z
[
ni
];
}
_refine_flag
=
rhs
.
_refine_flag
;
_dyn_order_flag
=
rhs
.
_dyn_order_flag
;
}
#ifdef MPI_VERSION
...
...
@@ -169,6 +171,8 @@ GeometryConfiguration::GeometryConfiguration(const mixMPI *mpidata) {
MPI_Bcast
(
_sph_x
,
_number_of_spheres
,
MPI_DOUBLE
,
0
,
MPI_COMM_WORLD
);
MPI_Bcast
(
_sph_y
,
_number_of_spheres
,
MPI_DOUBLE
,
0
,
MPI_COMM_WORLD
);
MPI_Bcast
(
_sph_z
,
_number_of_spheres
,
MPI_DOUBLE
,
0
,
MPI_COMM_WORLD
);
MPI_Bcast
(
&
_refine_flag
,
1
,
MPI_SHORT
,
0
,
MPI_COMM_WORLD
);
MPI_Bcast
(
&
_dyn_order_flag
,
1
,
MPI_SHORT
,
0
,
MPI_COMM_WORLD
);
}
void
GeometryConfiguration
::
mpibcast
(
const
mixMPI
*
mpidata
)
{
...
...
@@ -200,6 +204,8 @@ void GeometryConfiguration::mpibcast(const mixMPI *mpidata) {
MPI_Bcast
(
_sph_x
,
_number_of_spheres
,
MPI_DOUBLE
,
0
,
MPI_COMM_WORLD
);
MPI_Bcast
(
_sph_y
,
_number_of_spheres
,
MPI_DOUBLE
,
0
,
MPI_COMM_WORLD
);
MPI_Bcast
(
_sph_z
,
_number_of_spheres
,
MPI_DOUBLE
,
0
,
MPI_COMM_WORLD
);
MPI_Bcast
(
&
_refine_flag
,
1
,
MPI_SHORT
,
0
,
MPI_COMM_WORLD
);
MPI_Bcast
(
&
_dyn_order_flag
,
1
,
MPI_SHORT
,
0
,
MPI_COMM_WORLD
);
}
#endif
...
...
@@ -221,6 +227,7 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(const std::string& fil
OpenConfigurationFileException
ex
(
file_name
);
throw
ex
;
}
// Read the legacy FORTRAN mandatory configuration data
int
_nsph
=
0
,
_lm
=
0
,
_in_pol
=
0
,
_npnt
=
0
,
_npntts
=
0
,
_isam
=
0
;
int
_li
=
0
,
_le
=
0
,
_iavm
=
0
,
num_params
=
0
;
np_int
_mxndm
=
0
;
...
...
@@ -319,6 +326,7 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(const std::string& fil
str_target
=
file_lines
[
last_read_line
++
];
regex_search
(
str_target
,
m
,
re
);
fjwtm
=
stoi
(
m
.
str
());
// Mandatory configuration data were read. Create the configuration object.
GeometryConfiguration
*
conf
=
new
GeometryConfiguration
(
_nsph
,
_lm
,
_in_pol
,
_npnt
,
_npntts
,
_isam
,
_li
,
_le
,
_mxndm
,
_iavm
,
x
,
y
,
z
,
...
...
@@ -328,6 +336,25 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(const std::string& fil
sc_ph_start
,
sc_ph_step
,
sc_ph_end
,
fjwtm
);
// Read optional configuration data used only by the C++ code.
while
(
num_lines
>
last_read_line
)
{
str_target
=
file_lines
[
last_read_line
++
];
if
(
str_target
.
size
()
>
0
)
{
if
(
str_target
.
substr
(
0
,
15
).
compare
(
"USE_REFINEMENT="
)
==
0
)
{
regex_search
(
str_target
,
m
,
re
);
short
refine_flag
=
(
short
)
stoi
(
m
.
str
());
conf
->
_refine_flag
=
refine_flag
;
}
else
if
(
str_target
.
substr
(
0
,
14
).
compare
(
"USE_DYN_ORDER="
)
==
0
)
{
regex_search
(
str_target
,
m
,
re
);
short
dyn_order_flag
=
(
short
)
stoi
(
m
.
str
());
conf
->
_dyn_order_flag
=
dyn_order_flag
;
}
}
}
// Clean up memory and return configuration object.
delete
[]
file_lines
;
return
conf
;
}
...
...
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