Commit 679a97be authored by Andreas Freise's avatar Andreas Freise
Browse files

trying to fix bug with pitch eom reported by paul, needs testing

parent 969ae67d
......@@ -2782,40 +2782,41 @@ int set_k_modulator(int modulator_index) {
int tn=0, tm=0;
get_tem_modes_from_field_index(&tn, &tm, i);
u = -1;
d = -1;
if(mod->type == MODTYPE_YAW) {
if(tn+1 + tm <= inter.tem) {
u = get_field_index_from_tem(tn+1, tm);
if(!node1.gnd_node) mod->ktm21[i][u] = z_by_xphr(complex_1, w1 * sqrt(tn+1)/2.0, gouy_1);
if(!node2.gnd_node) mod->ktm12[i][u] = z_by_xphr(complex_1, w2 * sqrt(tn+1)/2.0, gouy_2);
if(!node1.gnd_node) mod->ktm21[i][u] = z_by_xphr(complex_1, w1 * sqrt(tn+1)/2.0, -gouy_1);
if(!node2.gnd_node) mod->ktm12[i][u] = z_by_xphr(complex_1, w2 * sqrt(tn+1)/2.0, -gouy_2);
}
if(tn-1 >= 0) {
d = get_field_index_from_tem(tn-1, tm);
if(!node1.gnd_node) mod->ktm21[i][d] = z_by_xphr(complex_1, w1 * sqrt(tn)/4.0, -gouy_1);
if(!node2.gnd_node) mod->ktm12[i][d] = z_by_xphr(complex_1, w2 * sqrt(tn)/4.0, -gouy_2);
if(!node1.gnd_node) mod->ktm21[i][d] = z_by_xphr(complex_1, w1 * sqrt(tn)/4.0, gouy_1);
if(!node2.gnd_node) mod->ktm12[i][d] = z_by_xphr(complex_1, w2 * sqrt(tn)/4.0, gouy_2);
}
} else {
if(tn+1 + tm <= inter.tem) {
if(tn + tm+1 <= inter.tem) {
u = get_field_index_from_tem(tn, tm+1);
if(!node1.gnd_node) mod->ktm21[i][u] = z_by_xphr(complex_1, w1 * sqrt(tm+1)/2.0, gouy_1);
if(!node2.gnd_node) mod->ktm12[i][u] = z_by_xphr(complex_1, w2 * sqrt(tm+1)/2.0, gouy_2);
if(!node1.gnd_node) mod->ktm21[i][u] = z_by_xphr(complex_1, w1 * sqrt(tm+1)/2.0, -gouy_1);
if(!node2.gnd_node) mod->ktm12[i][u] = z_by_xphr(complex_1, w2 * sqrt(tm+1)/2.0, -gouy_2);
}
if(tm-1 >= 0) {
d = get_field_index_from_tem(tn, tm-1);
if(!node1.gnd_node) mod->ktm21[i][d] = z_by_xphr(complex_1, w1 * sqrt(tm)/4.0, -gouy_1);
if(!node2.gnd_node) mod->ktm12[i][d] = z_by_xphr(complex_1, w2 * sqrt(tm)/4.0, -gouy_2);
if(!node1.gnd_node) mod->ktm21[i][d] = z_by_xphr(complex_1, w1 * sqrt(tm)/4.0, gouy_1);
if(!node2.gnd_node) mod->ktm12[i][d] = z_by_xphr(complex_1, w2 * sqrt(tm)/4.0, gouy_2);
}
}
if(tn+1 + tm <= inter.tem) {
if(u >= 0) {
// Set the transpose elements and scaling
mod->ktm12[u][i] = z_by_zc(factor12, mod->ktm12[i][u]);
mod->ktm21[u][i] = z_by_zc(factor21, mod->ktm21[i][u]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment