Generic T-matrix generator type

Former-commit-id: 84c3a0a8a1cafe2f1c3ed05cf1528e5f80443b70
This commit is contained in:
Marek Nečada 2019-08-09 17:22:56 +03:00
parent 053c4c0b57
commit d632405b32
2 changed files with 77 additions and 0 deletions

View File

@ -343,6 +343,13 @@ qpms_errno_t qpms_tmatrix_interpolator_eval_fill(qpms_tmatrix_t *t,
return QPMS_SUCCESS;
}
qpms_errno_t qpms_tmatrix_generator_interpolator(qpms_tmatrix_t *t,
complex double omega, const void *interp)
{
return qpms_tmatrix_interpolator_eval_fill(t,
(const qpms_tmatrix_interpolator_t *) interp, omega);
}
double qpms_SU2eV(double e_SU) {
return e_SU * SCUFF_OMEGAUNIT / (ELECTRONVOLT / HBAR);
}
@ -567,6 +574,19 @@ qpms_errno_t qpms_tmatrix_spherical_fill(qpms_tmatrix_t *t, ///< T-matrix whose
return QPMS_SUCCESS;
}
qpms_errno_t qpms_tmatrix_generator_sphere(qpms_tmatrix_t *t,
complex double omega, const void *params)
{
const qpms_tmatrix_generator_sphere_param_t *p = params;
qpms_epsmu_t out = p->outside.function(omega, p->outside.params);
qpms_epsmu_t in = p->inside.function(omega, p->inside.params);
return qpms_tmatrix_spherical_fill(t,
p->radius,
qpms_wavenumber(omega, in),
qpms_wavenumber(omega, out),
in.mu, out.mu);
}
/// Convenience function to calculate T-matrix of a non-magnetic spherical \
particle using the permittivity values, replacing existing T-matrix data.
qpms_errno_t qpms_tmatrix_spherical_mu0_fill(
@ -769,3 +789,11 @@ qpms_errno_t qpms_tmatrix_axialsym_fill(
return QPMS_SUCCESS;
}
qpms_errno_t qpms_tmatrix_generator_axialsym(qpms_tmatrix_t *t, complex double omega, const void *param) {
const qpms_tmatrix_generator_axialsym_param_t *p = param;
return qpms_tmatrix_axialsym_fill(t, omega,
p->outside.function(omega, p->outside.params),
p->inside.function(omega, p->inside.params),
p->shape,
p->lMax_extend);
}

View File

@ -236,6 +236,19 @@ complex double *qpms_apply_tmatrix(
const qpms_tmatrix_t *T
);
/// Generic T-matrix generator function that fills a pre-initialised qpms_tmatrix_t given a frequency.
/** Implemented by:
* qpms_tmatrix_generator_axialsym()
* qpms_tmatrix_generator_interpolator()
* qpms_tmatrix_generator_sphere()
*/
typedef struct qpms_tmatrix_generator_t {
qpms_errno_t (*function) (qpms_tmatrix_t *t, ///< T-matrix to fill.
complex double omega, ///< Angular frequency.
const void *params ///< Implementation dependent parameters.
);
const void *params; ///< Parameter pointer passed to the function.
} qpms_tmatrix_generator_t;
/* Fuck this, include the whole <gsl/gsl_spline.h>
typedef struct gsl_spline gsl_spline; // Forward declaration for the interpolator struct
@ -277,6 +290,15 @@ qpms_tmatrix_interpolator_t *qpms_tmatrix_interpolator_create(size_t n, ///< Num
//, bool copy_bspec ///< if true, copies its own copy of basis spec from the first T-matrix.
/*, ...? */);
/// qpms_tmatrix_interpolator for qpms_tmatrix_generator_t.
/** As in qpms_tmatrix_interpolator_eval(), the imaginary part of frequency is discarded!
*/
qpms_errno_t qpms_tmatrix_generator_interpolator(qpms_tmatrix_t *t, ///< T-matrix to fill.
complex double omega, ///< Angular frequency.
const void *interpolator ///< Parameter of type qpms_tmatrix_interpolator_t *.
);
/// Calculates the reflection Mie-Lorentz coefficients for a spherical particle.
/**
* This function is based on the previous python implementation mie_coefficients() from qpms_p.py,
@ -311,6 +333,19 @@ qpms_errno_t qpms_tmatrix_spherical_fill(qpms_tmatrix_t *t, ///< T-matrix whose
complex double mu_e ///< Relative permeability of the surrounding medium.
);
/// Parameter structure for qpms_tmatrix_generator_sphere().
typedef struct qpms_tmatrix_generator_sphere_param_t {
qpms_epsmu_generator_t outside;
qpms_epsmu_generator_t inside;
double radius;
} qpms_tmatrix_generator_sphere_param_t;
/// T-matrix generator for spherical particles using Lorentz-Mie solution.
qpms_errno_t qpms_tmatrix_generator_sphere(qpms_tmatrix_t *t,
complex double omega,
const void *params ///< Of type qpms_tmatrix_generator_sphere_param_t.
);
/// Creates a new T-matrix of a spherical particle using the Lorentz-Mie theory.
static inline qpms_tmatrix_t *qpms_tmatrix_spherical(
const qpms_vswf_set_spec_t *bspec,
@ -421,6 +456,20 @@ static inline qpms_tmatrix_t *qpms_tmatrix_axialsym(
return t;
}
/// Parameter structure for qpms_tmatrix_generator_axialsym.
typedef struct qpms_tmatrix_generator_axialsym_param_t {
qpms_epsmu_generator_t outside;
qpms_epsmu_generator_t inside;
qpms_arc_function_t shape;
qpms_l_t lMax_extend;
} qpms_tmatrix_generator_axialsym_param_t;
/// qpms_tmatrix_axialsym for qpms_tmatrix_generator_t
qpms_errno_t qpms_tmatrix_generator_axialsym(qpms_tmatrix_t *t, ///< T-matrix to fill.
complex double omega, ///< Angular frequency.
const void *params ///< Parameters of type qpms_tmatrix_generator_axialsym_param_t.
);
#if 0