diff --git a/src/meepgeom.cpp b/src/meepgeom.cpp index 39813f409..45ce8d50e 100644 --- a/src/meepgeom.cpp +++ b/src/meepgeom.cpp @@ -2714,7 +2714,7 @@ std::complex get_material_gradient( for (int i=0;i<3;i++) dA_du[i] = (row_1[i] - row_2[i])/(2*du); return dA_du[dir_idx] * fields_f * cond_cmp(forward_c,r,freq,geps); - } + } } /* A brute force approach to calculating Aᵤ using finite differences. @@ -2933,6 +2933,7 @@ void material_grids_addgradient(double *v, size_t ng, std::complex adj = GET_FIELDS(fields_a, ci_adjoint, f_i, idx_fields); material_type md; @@ -2946,6 +2947,12 @@ void material_grids_addgradient(double *v, size_t ng, std::complextrivial) adj *= cond_cmp(adjoint_c,p,frequencies[f_i], geps); >>>>>>> Fix adjoint gradient with conductivities (#1830) +======= + std::complex adj = GET_FIELDS(fields_a, ci_adjoint, f_i, idx_fields); + material_type md; + geps->get_material_pt(md, p); + if (!md->trivial) adj *= cond_cmp(adjoint_c,p,frequencies[f_i], geps); +>>>>>>> support for single-precision floating point for fields array functions (#1833) double cyl_scale; int ci_forward = 0; FOR_MY_COMPONENTS(forward_c) { @@ -2988,7 +2995,11 @@ void material_grids_addgradient(double *v, size_t ng, std::complex fwd_avg, fwd1, fwd2; +======= + std::complex fwd_avg, fwd1, fwd2, prod; +>>>>>>> support for single-precision floating point for fields array functions (#1833) ptrdiff_t fwd1_idx, fwd2_idx; //identify the first corner of the forward fields diff --git a/tests/ring-ll.cpp b/tests/ring-ll.cpp index a478d6728..920476897 100644 --- a/tests/ring-ll.cpp +++ b/tests/ring-ll.cpp @@ -132,6 +132,7 @@ int main(int argc, char *argv[]) { imag(amp[nb]), err[nb]); // test comparison with expected values +<<<<<<< HEAD double err_tol = 1.0e-5; int ref_bands = 4; double ref_freq_re[4] = {1.1807e-01, 1.4470e-01, 1.4715e-01, 1.7525e-01}; @@ -141,6 +142,14 @@ int main(int argc, char *argv[]) { std::complex(+3.99e-02,+4.09e-02), std::complex(-1.98e-03,-1.43e-02)}; if (bands != ref_bands) meep::abort("harminv found only %i/%i bands\n", bands, ref_bands); +======= + int ref_bands = 3; + double ref_freq_re[3] = {1.1807e-01, 1.4716e-01, 1.7525e-01}; + double ref_freq_im[3] = {-7.6133e-04, -2.1156e-04, -5.2215e-05}; + std::complex ref_amp[3] = {std::complex(-8.28e-04, -1.34e-03), std::complex(1.23e-03, -1.25e-02), + std::complex(2.83e-03, -6.52e-04)}; + if (bands != 3) meep::abort("harminv found only %i/%i bands\n", bands, ref_bands); +>>>>>>> support for single-precision floating point for fields array functions (#1833) for (int nb = 0; nb < bands; nb++) if ((fabs(freq_re[nb] - ref_freq_re[nb]) > 1.0e-2 * fabs(ref_freq_re[nb]) || fabs(freq_im[nb] - ref_freq_im[nb]) > 1.0e-2 * fabs(ref_freq_im[nb]) ||