WIP scatsys translation booster.

Former-commit-id: 2909ff20c1805a9c4a16f0fcd8a82f4c54e1a84a
This commit is contained in:
Marek Nečada 2020-01-22 14:45:31 +02:00
parent a0acdfdc5d
commit af12f2301f
3 changed files with 42 additions and 2 deletions

View File

@ -0,0 +1,38 @@
#include "scatsystem.h"
#define SQ(x) ((x)*(x))
typedef size_t ppid_t;
typedef size_t uoppid_t;
// Unordered pair ID. TODO get rid of redundancies
static inline uoppid_t uopairid(qpms_ss_pi_t pn_total, qpms_ss_pi_t p1, qpms_ss_pi_t p2) {
return pn_total * p1 + p2;
}
// Unordered pair ID count. TODO get rid of redundancies.
static inline uoppid_t uopairarr_len(qpms_ss_pi_t pn_total) {
return SQ(pn_total);
}
// Ordered pair ID.
static inline uoppid_t pairid(qpms_ss_pi_t pn_total, qpms_ss_pi_t p1, qpms_ss_pi_t p2) {
return pn_total * p1 + p2;
}
// Ordered pair ID count.
static inline uoppid_t pairarr_len(qpms_ss_pi_t pn_total) {
return SQ(pn_total);
}
typedef struct qpms_scatsys_translation_booster {
double *r; // Unique distances array, indices are ppid_t
ppid_t *r_map; // FIXME
} qpms_scatsys_translation_booster_t;
struct qpms_scatsys_translation_booster *qpms_scatsys_translation_booster_create(
const qpms_scatsys_ss *ss) {
const qpms_ss_pi_t np = ss->p_count;
TODO;
}

View File

@ -143,7 +143,6 @@ static void add_orbit_type(qpms_scatsys_t *ss, const qpms_ss_orbit_type_t *ot_cu
ss->orbit_type_count++;
}
// Almost 200 lines. This whole thing deserves a rewrite!
qpms_scatsys_at_omega_t *qpms_scatsys_apply_symmetry(const qpms_scatsys_t *orig,
const qpms_finite_group_t *sym, complex double omega,

View File

@ -133,7 +133,7 @@ typedef struct qpms_ss_derived_tmatrix_t {
struct qpms_trans_calculator;
struct qpms_epsmu_generator_t;
struct qpms_scatsys_translation_booster;
typedef struct qpms_scatsys_t {
struct qpms_epsmu_generator_t medium; ///< Optical properties of the background medium.
@ -188,6 +188,9 @@ typedef struct qpms_scatsys_t {
char *otspace_end;
double lenscale; // radius of the array, used as a relative tolerance measure
struct qpms_trans_calculator *c;
// Internal metadata for faster translation matrix evaluation
struct qpms_scatsys_translation_booster *tbooster;
} qpms_scatsys_t;
/// Retrieve the bspec of \a tmi'th element of \a ss->tm.