/*---------- function definitions ---------- */ int main(int argc,char *argv[]) { LALStatus status = blank_status; /* initialize status */ vrbflg = 1; /* verbose error-messages */ /* set LAL error-handler */ lal_errhandler = LAL_ERR_EXIT; /* exit with returned status-code on error */ /* register all user-variables */ LAL_CALL (InitUserVars(&status, &CommandLineArgs), &status); /* read cmdline & cfgfile */ BOOLEAN should_exit = 0; XLAL_CHECK_MAIN (XLALUserVarReadAllInput(&should_exit, argc, argv, lalAppsVCSInfoList) == XLAL_SUCCESS, XLAL_EFUNC); if (should_exit) return EXIT_FAILURE; LAL_CALL ( CheckUserInput (&status, &CommandLineArgs), &status); LAL_CALL ( Initialize (&status, &CommandLineArgs), &status); /*---------- central function: compute F-statistic ---------- */ LAL_CALL ( ComputeF(&status, CommandLineArgs), &status); /* Free remaining memory */ LAL_CALL ( LALSDestroyVector(&status, &(amc.a) ), &status); LAL_CALL ( LALSDestroyVector(&status, &(amc.b) ), &status); XLALDestroyUserVars(); LALCheckMemoryLeaks(); return 0; } /* main() */
void JGuiController::Update(float dt) { for (int i = 0; i < mCount; i++) if (mObjects[i] != NULL) mObjects[i]->Update(dt); for (size_t i = 0; i < mButtons.size(); i++ ) mButtons[i]->Update(dt); if(mEngine) { JButton key = mEngine->ReadButton(); CheckUserInput(key); } }
void SimplePopup::Update(float) { JButton key = mEngine->ReadButton(); CheckUserInput(key); }
// return true if draw is needed bool CGameSubStateOngoing::RunFrame() { if ( iFadeIn ) { iStateController->GUIStateController()->StartFadeIn( iDynData->LevelRuntime()->IngameData()->Palette() ); iFadeIn = false; } iClockval=TimerCounter; if (iClockval>iDynData->LastFrame()) { int frameCount = iDynData->LowFramerate(); for (;frameCount;frameCount--) { CheckUserInput(); iDynData->LevelRuntime()->PerFrameCalc(); iDynData->PushPlayers(); iDynData->CheckBurn(); if (iDynData->GameMode()->CrateRespawn() && iDynData->NetworkMode()!=ENetworkModeClient) iDynData->LevelRuntime()->ChkWakeUps(); for(int a=0; a<iDynData->LocalPlayers().size(); a++) { iDynData->LocalPlayers()[a]->MoveScr(iDynData->PlayerDrawRect(a)); iDynData->LocalPlayers()[a]->LoadWeapons(); } iDynData->AnimatePlayers(); if (iDynData->NetworkMode()!=ENetworkModeClient) { iDynData->LevelRuntime()->EnemyUpdate(); } iDynData->DecHits(); iDynData->ShowSteam(); if (iDynData->iNextLevel) iDynData->iNextLevel++; iDynData->LevelRuntime()->RollEffects(); } // Check if enemies are dead if (iDynData->GameMode()->ObjectiveFulfilled()) if (iDynData->iNextLevel<=0 ) iDynData->iNextLevel=1; /* Are we dead? */ if ( iDynData->AllPlayersDead() ) { iDynData->iCompleteTime = iDynData->LevelRuntime()->Level().iGeneralLevelInfo.iTimeLimit; iDynData->Statistics()->SetLatestLevel( iDynData->CurrentLevel() ); iDynData->NextLevel(); iStateController->GUIStateController()->StartZoomOut(CState(CState::EMainStateGame,EGameStateStatistics)); } /* Next level? */ if (iDynData->iNextLevel>=KLevelCompleteDelay || iDynData->iUserQuit) { iDynData->Statistics()->SetLatestLevel( iDynData->CurrentLevel() ); iDynData->NextLevel(); iStateController->GUIStateController()->StartFadeOut(CState(CState::EMainStateGame,EGameStateStatistics)); } return true; } return false; }
int main() { SceUID video_thid; //int xx, yy, nubspeed; SetupCallbacks(); pspDebugScreenInit(); initGraphics(); SceCtrlData pad, oldpad; oldpad.Buttons = 0xFFFFFFFF; sceCtrlSetSamplingCycle(0); sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG); // Start the video thread to draw objects to screen and manage video input. video_thid = sceKernelCreateThread("video_thread", video_thread, 0x12, 512 * 1024, 0, NULL); if (video_thid > 0) sceKernelStartThread(video_thid, 0, NULL); while (!connected) { sceCtrlReadBufferPositive(&pad, 1); if (pad.Buttons) connected = 1; } // Wait for camera to be aligned to playing area and for game to start. while (running && (!aligned || menu)) { // Uncomment the following lines to include analog stick and button input during alignment. /*sceCtrlPeekBufferPositive(&pad, 1); xx = pad.Lx - 128; yy = pad.Ly - 128; nubspeed = sqrt((xx * xx) + (yy * yy)) / (2 * sqrt(sqrt((xx * xx) + (yy * yy)))); if (xx > 30) cursorx += nubspeed; else if (xx < -30) cursorx -= nubspeed; if (yy > 30) cursory += nubspeed; else if (yy < -30) cursory -= nubspeed; if (cursorx > 480) cursorx = 480; else if (cursorx < 0) cursorx = 0; if (cursory > 272) cursory = 272; else if (cursory < 0) cursory = 0; // Detect changes in button input. if (pad.Buttons != oldpad.Buttons) { } oldpad.Buttons = pad.Buttons;*/ sceKernelDelayThread(50000); } int x; // Initialize global data. _highScore = 0; _score = 0; _ballCount = 0; _resBalls = START_RES_BALLS; _gameState = GAME_RUNNING; _pauseSem = sceKernelCreateSema("PauseSem", 0, 1, 1, 0); // Initialize array used to keep track of balls in play. for (x = 0; x < MAX_BALLS; x++) { _activeBalls[x] = 0; } // Initialize the paddle (&_paddle)->h = 60; (&_paddle)->w = 8; (&_paddle)->xPos = 3; (&_paddle)->yPos = 136; (&_paddle)->xPosOld = 250; (&_paddle)->yPosOld = 250; (&_paddle)->speed = 10; (&_paddle)->dir = 1; (&_paddle)->color = COLOR_LIGHT_BLUE; while (running) { // Uncomment the following lines to include analog stick and button input. // Defeats the purpose as holding the PSP or touching it shakes the camera // and makes the laser pointer input very inaccurate. Could be useful with // the PSP remote control to allow games to be played using the remote // for D-Pad movement and the laser pointer for looking/aiming. /*sceCtrlPeekBufferPositive(&pad, 1); xx = pad.Lx - 128; yy = pad.Ly - 128; nubspeed = sqrt((xx * xx) + (yy * yy)) / (2 * sqrt(sqrt((xx * xx) + (yy * yy)))); if (xx > 30) cursorx += nubspeed; else if (xx < -30) cursorx -= nubspeed; if (yy > 30) cursory += nubspeed; else if (yy < -30) cursory -= nubspeed; if (cursorx > 480) cursorx = 480; else if (cursorx < 0) cursorx = 0; if (cursory > 272) cursory = 272; else if (cursory < 0) cursory = 0; // Detect changes in button input. if (pad.Buttons != oldpad.Buttons) { } oldpad.Buttons = pad.Buttons;*/ // Change sprite speeds, positions and behaviors here. CreateBall(); // Create a ball and put it in play. while (_gameState == GAME_RUNNING) { CheckUserInput(); } while (_gameState == GAME_CONTINUE) { sceKernelDelayThread(2000); } while (_gameState == GAME_OVER) { sceKernelDelayThread(2000); } sceKernelDelayThread(200); //CreateBall(); // Create a ball and put it in play. } StopApp(); sceKernelExitGame(); return 0; }
OpenSMOKE_KPP_DataManager::OpenSMOKE_KPP_DataManager(OpenSMOKE_KPP_Dictionary& dictionary) : dictionary_(dictionary) { // Default values nameFolderOutput_ = "Output"; nameFolderInput_ = "Input"; nameInputBackupFile_ = "Backup"; nameFolderKinetics_ = "Kinetics"; nameTopologyFile_ = "CFDNetwork.bzz"; nameFirstGuessFile_ = "FirstGuess.bzz"; nameInOutFile_ = "InputOutput.out"; nameResidualFile_ = "Residuals.out"; nameResidualFile_ = "ResidualsSpecies.out"; nameResidualReactorStatisticsFile_ = "StatisticsReactors.out"; nameResidualSpeciesStatisticsFile_ = "StatisticsSpecies.out"; networkStatus_ = KPP_NETWORK_STATUS_START; iReactions_ = false; iKineticMaps_ = false; iSymbolicKinetics_ = false; iSaveKineticConstants_ = true; iOpenMP_ = false; iBackup_ = false; nThreads_ = 1; iTraditionalLink_ = false; correction_ = KPP_CORRECTION_NONE; massFlowRate_SparseLinearSolver_ = KPP_SPARSESOLVER_PARDISO; fillInReducingOrdering_ = PARDISO_FILLIN_METIS; // Predictor Corrector predictorCorrector_SparseLinearSolver_ = KPP_SPARSESOLVER_PARDISO; predictorCorrector_TimeStepIncrementFactor_ = 1.50; predictorCorrector_TimeStepReductionFactor_ = 0.80; predictorCorrector_MaxIterations_ = 10000; predictorCorrector_CourantCorrectionCoefficient_ = 0.20; predictorCorrector_MultiTimeSplitting_ = false; predictorCorrector_InitialTimeStep_ = 1.e-5; predictorCorrector_MaxTimeStep_ = 1e5*predictorCorrector_InitialTimeStep_; predictorCorrector_DeferredConvection_ = false; predictorCorrector_AlgebraicConstraint_ = false; // Sequence CSTR sequenceCSTR_MaxIterations_ = 10000; sequenceCSTR_VerboseStatistics_ = false; sequenceCSTR_UpdatingNetwork_ = false; // Single Reactor singleReactor_OdeMaxJacobian_ = 0; singleReactor_OdeStopResiduals_ = 0; singleReactor_IntegrationTime_ = 100.; singleReactor_OdeRelativeTolerance_ = 100.*MachEpsFloat(); singleReactor_OdeAbsoluteTolerance_ = 1.e-10; temperatureMin_ = 0.; temperatureMax_ = 0.; // Global ODE globalODE_SparseLinearSolver_ = KPP_SPARSESOLVER_PARDISO; globalODE_SafetyReductionCoefficient = OpenSMOKE_KPP_ODE_Manager::default_safetyReductionCoefficient_; globalODE_RelativeTolerance_ = OpenSMOKE_KPP_ODE_Manager::default_relativeTolerance_; globalODE_AbsoluteTolerance_ = OpenSMOKE_KPP_ODE_Manager::default_absoluteTolerance_; globalODE_MaxIterations_ = OpenSMOKE_KPP_ODE_Manager::default_maximumIterations_; globalODE_TimeStepIncrementFactor_ = OpenSMOKE_KPP_ODE_Manager::default_timeStepIncrementFactor_; globalODE_TimeStepReductionFactor_ = 1./OpenSMOKE_KPP_ODE_Manager::default_timeStepIncrementFactor_; globalODE_InitialTimeStep_ = OpenSMOKE_KPP_ODE_Manager::default_initialTimeStep_; globalODE_MaxTimeStep_ = OpenSMOKE_KPP_ODE_Manager::default_maxTimeStep_; globalODE_UpdatingFrequencyTimeStep_ = OpenSMOKE_KPP_ODE_Manager::default_updatingFrequencyTimeStep_; // Global NLS globalNLS_SparseLinearSolver_ = KPP_SPARSESOLVER_PARDISO; globalNLS_SafetyReductionCoefficient = OpenSMOKE_KPP_NewtonMethod_Manager::default_safetyReductionCoefficient_; globalNLS_Method_ = OpenSMOKE_KPP_NewtonMethod_Manager::default_method_; globalNLS_RelativeTolerance_ = OpenSMOKE_KPP_NewtonMethod_Manager::default_relativeTolerance_; globalNLS_AbsoluteTolerance_ = OpenSMOKE_KPP_NewtonMethod_Manager::default_absoluteTolerance_; globalNLS_MaxIterations_ = OpenSMOKE_KPP_NewtonMethod_Manager::default_maxit_; globalNLS_MaxArmijioIterations_ = OpenSMOKE_KPP_NewtonMethod_Manager::default_maxarm_; // Check Dictionary CheckDictionary(); CheckUserInput(); }