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

Enable configuration of clusters of spheres

parent cd28a78e
No related branches found
No related tags found
No related merge requests found
......@@ -64,13 +64,22 @@ public:
* fields and their polarization properties.
*/
class GeometryConfiguration {
//! Temporary work-around to allow sphere() peeking in.
//! Temporary work-around to allow cluster() and sphere() peeking in.
friend void cluster();
friend void sphere();
protected:
//! \brief Number of spherical components.
int number_of_spheres;
//! \brief Maximum expansion order of angular momentum.
int l_max;
//! \brief QUESTION: definition?
int li;
//! \brief QUESTION: definition?
int le;
//! \brief QUESTION: definition?
int mxndm;
//! \brief QUESTION: definition?
int iavm;
//! \brief Incident field polarization status (0 - linear, 1 - circular).
int in_pol;
//! \brief Number of transition points. QUESTION: correct?
......@@ -124,6 +133,10 @@ public:
* for incident angles, 0 if determined by incidence and observation, =1
* accross z-axis for incidence and observation, >1 across z-axis as a
* function of incidence angles for fixed scattering).
* \param li: `int`
* \param le: `int`
* \param mxndm: `int`
* \param iavm: `int`
* \param x: `double*` Vector of spherical components X coordinates.
* \param y: `double*` Vector of spherical components Y coordinates.
* \param z: `double*` Vector of spherical components Z coordinates.
......@@ -143,6 +156,7 @@ public:
*/
GeometryConfiguration(
int nsph, int lm, int in_pol, int npnt, int npntts, int meridional_type,
int li, int le, 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,
......@@ -176,7 +190,8 @@ public:
* data to describe the scatterer properties.
*/
class ScattererConfiguration {
//! Temporary work-around to allow sphere() peeking in.
//! Temporary work-around to allow cluster() and sphere() peeking in.
friend void cluster();
friend void sphere();
protected:
//! \brief Matrix of dielectric parameters with size [NON_TRANS_LAYERS x N_SPHERES x LAYERS].
......
......@@ -12,7 +12,8 @@
using namespace std;
GeometryConfiguration::GeometryConfiguration(
int nsph, int lm, int _in_pol, int _npnt, int _npntts, int isam,
int _nsph, int _lm, int _in_pol, int _npnt, int _npntts, int _isam,
int _li, int _le, 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,
......@@ -20,12 +21,16 @@ GeometryConfiguration::GeometryConfiguration(
double sc_ph_start, double sc_ph_step, double sc_ph_end,
int _jwtm
) {
number_of_spheres = nsph;
l_max = lm;
number_of_spheres = _nsph;
l_max = _lm;
in_pol = _in_pol;
npnt = _npnt;
npntts = _npntts;
meridional_type = isam;
meridional_type = _isam;
li = _li;
le = _le;
mxndm = _mxndm;
iavm = _iavm;
in_theta_start = in_th_start;
in_theta_step = in_th_step;
in_theta_end = in_th_end;
......@@ -59,22 +64,32 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(string file_name) {
} catch (exception &ex) {
throw OpenConfigurationFileException(file_name);
}
int nsph, lm, _in_pol, _npnt, _npntts, isam;
int _nsph = 0, _lm = 0, _in_pol = 0, _npnt = 0, _npntts = 0, _isam = 0;
int _li = 0, _le = 0, _mxndm = 0, _iavm = 0;
sscanf(file_lines[last_read_line].c_str(), " %d", &_nsph);
if (_nsph == 1) {
sscanf(
file_lines[last_read_line++].c_str(),
" %d %d %d %d %d %d",
&nsph, &lm, &_in_pol, &_npnt, &_npntts, &isam
" %*d %d %d %d %d %d",
&_lm, &_in_pol, &_npnt, &_npntts, &_isam
);
} 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
);
}
double *x, *y, *z;
x = new double[nsph];
y = new double[nsph];
z = new double[nsph];
if (nsph == 1) {
x = new double[_nsph];
y = new double[_nsph];
z = new double[_nsph];
if (_nsph == 1) {
x[0] = 0.0;
y[0] = 0.0;
z[0] = 0.0;
} else {
for (int i = 0; i < nsph; i++) {
for (int i = 0; i < _nsph; i++) {
double sph_x, sph_y, sph_z;
int sph_x_exp, sph_y_exp, sph_z_exp;
sscanf(
......@@ -126,7 +141,8 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(string file_name) {
int _jwtm;
sscanf(file_lines[last_read_line++].c_str(), " %d", &_jwtm);
GeometryConfiguration *conf = new GeometryConfiguration(
nsph, lm, _in_pol, _npnt, _npntts, isam,
_nsph, _lm, _in_pol, _npnt, _npntts, _isam,
_li, _le, _mxndm, _iavm,
x, y, z,
in_th_start, in_th_step, in_th_end,
sc_th_start, sc_th_step, sc_th_end,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment