//---------------------------------------- double CBratAlgorithmGeosVelAtp::Run(CVectorBratAlgorithmParam& args) { int32_t iRecord = m_callerProduct->GetCurrentRecordNumber(); if (iRecord == m_callerProductRecordPrev) { // Do nothing: data have been already computed return m_velocity; } // Gets the next record regarding to the current product record. // and save previous values. this->GetNextData(); SetParamValues(args); SetGap(); SetEquatorTransition(); ComputeCoriolis(); // Compute geostrophic velocity. ComputeVelocity(); m_callerProductRecordPrev = iRecord; return m_velocity; }
//---------------------------------------- double CBratAlgoFilterLoess2D::Run(CVectorBratAlgorithmParam& args) { int32_t iRecord = m_callerProduct->GetCurrentRecordNumber(); if (iRecord == m_callerProductRecordPrev) { // Do nothing: data have been already computed return m_loess; } m_varValueArray = NULL; setDefaultValue(m_loess); OpenProductFile(); SetParamValues(args); if (GetDataWindowSize() < 1) { PrepareReturn(); return m_loess; } if (GetDataWindowSize() == 1) { m_loess = m_varValue; PrepareReturn(); return m_loess; } if ( m_varValueArray == NULL) { ComputeSingle(); } else { ComputeMean(); } PrepareReturn(); return m_loess; }
//---------------------------------------- double CBratAlgoFilterGaussian1D::Run(CVectorBratAlgorithmParam& args) { int32_t iRecord = m_callerProduct->GetCurrentRecordNumber(); if (iRecord == m_callerProductRecordPrev) { // Do nothing: data have been already computed return m_gaussian; } setDefaultValue(m_gaussian); OpenProductFile(); // Gets the next record regarding to the current product record. // and save previous values. //this->GetNextData(); // Get current parameter values (included expression value) SetParamValues(args); //// Set only the first value, others values will be stored in the 'SetNextValues' //if (m_rawDataWindow.size() <= 0) //{ // m_rawDataWindow.Insert(m_varValue); //} if (m_dataWindowLength > static_cast<uint32_t>(m_nProductRecords)) { throw CAlgorithmException(CTools::Format("'%s' algorithm can't be applied because the window size parameter (%d) is greater than the number of data values (%d) within the data file (%s). " "You have to decrease the window size parameter", this->GetName().c_str(), m_dataWindowLength, m_nProductRecords, m_currentFileName.c_str()), this->GetName(), BRATHL_LOGIC_ERROR); } if (m_dataWindowLength < 1) { PrepareReturn(); return m_gaussian; } if (m_dataWindowLength == 1) { m_gaussian = m_varValue; PrepareReturn(); return m_varValue; } // If 'default value' and no extrapolation then returns if (isDefaultValue(m_varValue) && (m_extrapolate == 0)) { PrepareReturn(); return m_gaussian; } uint32_t shiftSymmetry = 1; PrepareDataValues1D(shiftSymmetry); ComputeGaussian(); PrepareReturn(); return m_gaussian; }
wyBool ImportBatch::ExecuteBatch() { wyString msg; wyUInt32 timetaken; wyUInt32 thdid; HANDLE impthd = NULL; ImportFromSQL import; MDIWindow *wnd = NULL; IMPORTBATCH evt = {0}; IMPORTPARAM param = {0}; // DEBUG_ENTER ( "Executebatch" ); VERIFY(wnd = GetActiveWin()); /* set the yogimport and importparam values */ SetImportValues(&import); SetParamValues(¶m); /* set initial progress bar values */ if(!(param.m_totalfilesize = SetInitProgressValues())) { ShowEmptyFileError(¶m); return wyFalse; } param.m_count = 0; /* disable the button and other windows */ EnableDlgWindows(wyFalse); EnableWindow(GetDlgItem(m_hwnd, IDDONE ), false); SetFocus(GetDlgItem(m_hwnd, IDC_PROGRESS)); /* change text of the ok button */ ChangeOKButtonText(_(L"S&top")); VERIFY(evt.m_impevent = CreateEvent(NULL, TRUE, FALSE, NULL)); evt.m_import = &import; evt.m_lpParam = ¶m; evt.m_stopquery = (wyBool*)&m_stopimport; evt.wnd = wnd; // DEBUG_LOG("%u - created", &evt.m_impevent); timetaken = GetTickCount(); m_importing = wyTrue; // DEBUG_LOG("Creating thread"); impthd = (HANDLE)_beginthreadex(NULL, 0, ImportBatch::ImportThread, &evt, 0, &thdid); if(!impthd) goto cleanup; /* handle all other GUI messages and all in the main thread */ // DEBUG_LOG("Handling messages"); HandleMsgs(evt.m_impevent, wyFalse); timetaken = GetTickCount() - timetaken; VERIFY(CloseHandle(evt.m_impevent)); VERIFY(CloseHandle(impthd)); ImportConclude(&evt, ¶m); return wyTrue; cleanup: if(evt.m_impevent) VERIFY(CloseHandle(evt.m_impevent)); if(impthd) VERIFY(CloseHandle(impthd)); m_importing = m_stopimport = wyFalse; EnableDlgWindows(wyTrue); ChangeOKButtonText(_(L"&Execute")); return wyFalse; }