void MastersLoop(int startupflags) { int i; double energy; long daytime, newtinc; Entity et; Vector sunpos; const ParCommand timestep = DO_TIME_STEP; while (plausible && actime < tend) { daytime = ((int)(timeofday*3600.)+actime) % 86400; printf("Now at %li seconds = %02li:%02li:%02li ", actime, daytime / 3600, (daytime % 3600)/60, daytime % 60); pvm_initsend(PvmDataRaw); pvm_pkint((int *)×tep, 1, 1); SendCommand(); ActualiseValuesInTime(actime); for (et = maxentity; et--; ) CalculateLayerAverage(g[et], pstat, avg+et*nz); CalcMeanHydrostaticPressure(); CheckTimeStep(&tinc, &chemtinc, 0.8); if (pressuretype == NONHYDROSTATIC) { /* Calc wind acceleration */ SolveForPressure(tinc); } CheckTimeStep(&newtinc, &chemtinc, 1.); chemtinc = (chemtime <= actime ? chemtinc : 0); if (nsubs) printf("chemtinc = %3ld ", chemtinc); if (newtinc < tinc) { fprintf(stderr, "Warning: Time step had to be changed in the middle of iteration\n"); tinc = newtinc; } // Call ModuleManager McInterface::modmanager.DoCalc(actime+tinc); actime += tinc; chemtime += chemtinc; if (dumpnow || (dumptime && (actime % dumptime == 0))) { MakeAFullDump(); dumpnow = 0; } plausible = IsPlausible(&energy); printf("Energy = %lf\n", energy); if (!(startupflags & NO_OUTPUT)) { WriteOutData(actime, FALSE); WriteToDomainFiles(actime); } if (mailtime) { mailtime = 0; MailTheTime(); } /* if (nt != tinc) { tinc = nt; printf("Changing \"tinc\"; now %ld seconds\n", tinc); } */ } }
void BFTaskDlg::OnButton_Ok (wxCommandEvent& rEvent) { // check if the data in the dialog is plausible if ( !(IsPlausible()) ) return; // set the data from dialog to the data object // and append the data object to the rootObject if needed SetData(); // close the dialog Close(); }
int64_t BrokenDateTime::ToUnixTimeUTC() const { assert(IsPlausible()); struct tm tm; tm.tm_year = year - 1900; tm.tm_mon = month - 1; tm.tm_mday = day; tm.tm_hour = hour; tm.tm_min = minute; tm.tm_sec = second; tm.tm_isdst = 0; return ::timegm(&tm); }
BrokenDateTime BrokenDateTime::operator+(int seconds) const { assert(IsPlausible()); #ifdef HAVE_POSIX return FromUnixTimeUTC(ToUnixTimeUTC() + seconds); #else FILETIME ft = ToFileTime(*this); ULARGE_INTEGER uli; uli.u.HighPart = ft.dwHighDateTime; uli.u.LowPart = ft.dwLowDateTime; uli.QuadPart += (LONGLONG)seconds * 10000000; ft.dwHighDateTime = uli.u.HighPart; ft.dwLowDateTime = uli.u.LowPart; return ToBrokenDateTime(ft); #endif }