static char * test_tess2sphere_gzz() { SPHERE sphere; TESSEROID tess; double radius, dist, restess, ressphere; GLQ *glqlon, *glqlat, *glqr; tess.density = 1000.; tess.w = 44; tess.e = 46; tess.s = -1; tess.n = 1; tess.r1 = MEAN_EARTH_RADIUS - 100000; tess.r2 = MEAN_EARTH_RADIUS; glqlon = glq_new(8, tess.w, tess.e); if(glqlon == NULL) mu_assert(0, "GLQ allocation error"); glqlat = glq_new(8, tess.s, tess.n); if(glqlat == NULL) mu_assert(0, "GLQ allocation error"); glqr = glq_new(8, tess.r1, tess.r2); if(glqr == NULL) mu_assert(0, "GLQ allocation error"); glq_precompute_sincos(glqlat); radius = tess.r2; /* Make a sphere with the same mass as the tesseroid */ tess2sphere(tess, &sphere); for(dist=1500000; dist <= 2000000; dist += 1000) { restess = tess_gzz(tess,0,45,radius+dist,*glqlon,*glqlat,*glqr); ressphere = sphere_gzz(sphere,0,45,radius+dist); sprintf(msg, "(distance %g m) tess = %.5f sphere = %.5f", dist, restess, ressphere); mu_assert_almost_equals(restess, ressphere, 0.001, msg); } return 0; }
static char * test_prism2sphere_gzz() { SPHERE sphere; PRISM prism = {3000,-5000,5000,-5000,5000,-5000,5000,0,0,0}; double dist, resprism, ressphere; /* Make a sphere with the same mass as the prism and put it at the origin */ prism2sphere(prism, 0, 0, 0, &sphere); for(dist=60000; dist <= 500000; dist += 500) { resprism = prism_gzz(prism,0,0,-dist); ressphere = sphere_gzz(sphere,0,90,dist); sprintf(msg, "(distance %g m) prism = %.5f sphere = %.5f", dist, resprism, ressphere); mu_assert_almost_equals(resprism, ressphere, 0.001, msg); } return 0; }