7 double GetGravity(
char const *planet,
double pclat) {
11 if (strcmp(planet,
"Jupiter") == 0) {
13 double S = sin(pclat * M_PI / 180.);
15 double CS = S * sqrt(1 - SS);
20 SS * (-0.100513 + SS * (0.0237067 - 0.00305515 * SS))));
24 SS * (0.00533106 + SS * (-0.00647658 + SS * 0.000785945))));
25 g_new = sqrt(GR * GR + GTH * GTH);
26 }
else if (strcmp(planet,
"Saturn")) {
27 double S = sin(pclat * M_PI / 180.);
29 double CS = S * sqrt(1 - SS);
34 SS * (-0.260158 + SS * (0.0923098 - SS * 0.0166287))));
38 SS * (-.0102391 + SS * (-.00714765 + SS * .000865634))));
39 g_new = sqrt(GR * GR + GTH * GTH);
41 msg <<
"### FATAL ERROR in planet_gravity" << std::endl
42 <<
"Name of the planet not recognized" << std::endl
43 <<
"Choose from [Jupiter|Saturn]" << std::endl;
44 throw std::runtime_error(msg.str().c_str());
double GetGravity(char const *planet, double pclat)