59 double trap[maxits+1];
70 for(
int i = 0; i < maxits; i++) {
75 interp.AddData(5, &h[i-4], &trap[i-4]);
77 dss = interp.PolynomialNevilleErrorEstimate()[0];
80 if(fabs(dss) <= epsilon * fabs(ss))
return ss;
81 if(fabs(dss) <= epsilon2)
return ss;
95 "NumericalAtmosApprox::RombergsMethod() - Caught the following error: ",
99 "NumericalAtmosApprox::RombergsMethod() - Failed to converge in "
100 +
IString(maxits) +
" iterations.",
264 ema = acos(mu) * (180.0 /
PI);
265 sine = sin(ema * (
PI / 180.0));
266 if((am->p_atmosAtmSwitch == 0) || (am->p_atmosAtmSwitch == 2)) {
267 alpha = am->p_atmosSini * sine * am->p_atmosCosphi +
268 am->p_atmosMunot * mu;
271 alpha = am->p_atmosSini * sine * am->p_atmosCosphi -
272 am->p_atmosMunot * mu;
274 phase = acos(alpha) * (180.0 /
PI);
277 if(am->p_atmosAtmSwitch == 0) {
279 result = mu * am->p_atmosPM->CalcSurfAlbedo(phase, am->p_atmosInc, ema);
282 phasefn = (1.0 - am->AtmosHga() * am->AtmosHga()) / pow((1.0 + 2.0 * am->AtmosHga() * alpha + am->AtmosHga() * am->AtmosHga()), 1.5);
283 xx = -am->AtmosTau() / max(am->p_atmosMunot, 1.0e-30);
293 xx = -am->AtmosTau() / max(mu, 1.0e-30);
304 if(mu == am->p_atmosMunot) {
305 tfac = am->AtmosTau() * emunot / (am->p_atmosMunot * am->p_atmosMunot);
308 tfac = (emunot - emu) / (am->p_atmosMunot - mu);
310 if(am->p_atmosAtmSwitch == 1) {
311 result = mu * (phasefn - 1.0) * tfac;
313 else if(am->p_atmosAtmSwitch == 2) {
314 result = am->p_atmosMunot * mu * (phasefn - 1.0) * (1.0 - emunot * emu) / (am->p_atmosMunot + mu);
316 else if(am->p_atmosAtmSwitch == 3) {
317 result = -sine * am->p_atmosCosphi * (phasefn - 1.0) * tfac;
320 string msg =
"NumericalAtmosApprox::InrFunc2Bint() - Invalid value of atmospheric ";
321 msg +=
"switch used as argument to this function";
double RombergsMethod(AtmosModel *am, IntegFunc sub, double a, double b)
This variation on the NumericalApproximation method integrates a specified AtmosModel function rather...
double RefineExtendedTrap(AtmosModel *am, IntegFunc sub, double a, double b, double s, unsigned int n)
This variation on the NumericalApproximation method integrates a specified AtmosModel function rather...