MCPcopy Create free account
hub / github.com/NanoComp/meep / fallback_chi1inv_row

Method fallback_chi1inv_row

scheme/structure.cpp:841–927  ·  view source on GitHub ↗

fallback meaneps using libctl's adaptive cubature routine

Source from the content-addressed store, hash-verified

839
840// fallback meaneps using libctl's adaptive cubature routine
841void geom_epsilon::fallback_chi1inv_row(meep::component c, double chi1inv_row[3],
842 const meep::volume &v, double tol, int maxeval) {
843
844 symmetric_matrix chi1p1, chi1p1_inv;
845 material_type material;
846 bool destroy_material = get_material_pt(material, v.center());
847 material_epsmu(meep::type(c), material, &chi1p1, &chi1p1_inv);
848 if (destroy_material) material_type_destroy(material);
849 if (chi1p1.m01 != 0 || chi1p1.m02 != 0 || chi1p1.m12 != 0 || chi1p1.m00 != chi1p1.m11 ||
850 chi1p1.m11 != chi1p1.m22 || chi1p1.m00 != chi1p1.m22) {
851 int rownum = meep::component_direction(c) % 3;
852 if (rownum == 0) {
853 chi1inv_row[0] = chi1p1_inv.m00;
854 chi1inv_row[1] = chi1p1_inv.m01;
855 chi1inv_row[2] = chi1p1_inv.m02;
856 }
857 else if (rownum == 1) {
858 chi1inv_row[0] = chi1p1_inv.m01;
859 chi1inv_row[1] = chi1p1_inv.m11;
860 chi1inv_row[2] = chi1p1_inv.m12;
861 }
862 else {
863 chi1inv_row[0] = chi1p1_inv.m02;
864 chi1inv_row[1] = chi1p1_inv.m12;
865 chi1inv_row[2] = chi1p1_inv.m22;
866 }
867 return;
868 }
869
870 number esterr;
871 integer errflag, n;
872 number xmin[3], xmax[3];
873 vector3 gvmin, gvmax;
874 gvmin = vec_to_vector3(v.get_min_corner());
875 gvmax = vec_to_vector3(v.get_max_corner());
876 xmin[0] = gvmin.x;
877 xmax[0] = gvmax.x;
878 if (dim == meep::Dcyl) {
879 xmin[1] = gvmin.z;
880 xmin[2] = gvmin.y;
881 xmax[1] = gvmax.z;
882 xmax[2] = gvmax.y;
883 }
884 else {
885 xmin[1] = gvmin.y;
886 xmin[2] = gvmin.z;
887 xmax[1] = gvmax.y;
888 xmax[2] = gvmax.z;
889 }
890 if (xmin[2] == xmax[2])
891 n = xmin[1] == xmax[1] ? 1 : 2;
892 else
893 n = 3;
894 double vol = 1;
895 for (int i = 0; i < n; ++i)
896 vol *= xmax[i] - xmin[i];
897 if (dim == meep::Dcyl) vol *= (xmin[0] + xmax[0]) * 0.5;
898 eps_ever_negative = 0;

Callers

nothing calls this directly

Calls 11

typeFunction · 0.85
component_directionFunction · 0.85
epsFunction · 0.85
absFunction · 0.85
get_min_cornerMethod · 0.80
get_max_cornerMethod · 0.80
material_epsmuFunction · 0.70
vec_to_vector3Function · 0.70
LOOP_OVER_DIRECTIONSFunction · 0.50
centerMethod · 0.45
in_directionMethod · 0.45

Tested by

no test coverage detected