/*! Calculate the stress on all blocks and determine which block will be the next to fail and when it will fail. Use this to determine the slipDeficit on all blocks at the time of failure. Finally, use the new slipDeficit to recalculate the stress on all blocks at the time of failure. */ SimRequest UpdateBlockStress::run(SimFramework *_sim) { // Put a stress load on all blocks and determine which block will fail first int lid; BlockVal fail_time; quakelib::Conversion convert; // Calculate the current rates of stress change on all blocks stressRecompute(); // Given the rates of change, determine which block will fail next fail_time.block_id = UNDEFINED_BLOCK_ID; nextTimeStep(fail_time); // Increment the simulation year to the next failure time and // update the slip on all other blocks sim->incrementYear(fail_time.val); for(lid=0;lid<sim->numLocalBlocks();++lid) { Block &local_block = sim->getBlock(sim->getGlobalBID(lid)); local_block.state.slipDeficit -= local_block.slip_rate()*convert.year2sec(fail_time.val)*(1.0-local_block.aseismic()); } // Recalculate the stress on all blocks with the new slip deficits stressRecompute(); if (sim->getYear() > sim->getSimDuration()) return SIM_STOP_REQUIRED; else return SIM_CONTINUE; }
void VolumeViewer::initUserInterfaceWidgets() { // Create a toolbar at the top of the window. QToolBar *toolbar = addToolBar("toolbar"); // Add preferences widget and callback. PreferencesDialog *preferencesDialog = new PreferencesDialog(this, boundingBox); QAction *showPreferencesAction = new QAction("Preferences", this); connect(showPreferencesAction, SIGNAL(triggered()), preferencesDialog, SLOT(show())); toolbar->addAction(showPreferencesAction); // Add the "auto rotate" widget and callback. autoRotateAction = new QAction("Auto rotate", this); autoRotateAction->setCheckable(true); connect(autoRotateAction, SIGNAL(toggled(bool)), this, SLOT(autoRotate(bool))); toolbar->addAction(autoRotateAction); // Add the "next timestep" widget and callback. QAction *nextTimeStepAction = new QAction("Next timestep", this); connect(nextTimeStepAction, SIGNAL(triggered()), this, SLOT(nextTimeStep())); toolbar->addAction(nextTimeStepAction); // Add the "play timesteps" widget and callback. QAction *playTimeStepsAction = new QAction("Play timesteps", this); playTimeStepsAction->setCheckable(true); connect(playTimeStepsAction, SIGNAL(toggled(bool)), this, SLOT(playTimeSteps(bool))); toolbar->addAction(playTimeStepsAction); // Connect the "play timesteps" timer. connect(&playTimeStepsTimer, SIGNAL(timeout()), this, SLOT(nextTimeStep())); // Add the "add geometry" widget and callback. QAction *addGeometryAction = new QAction("Add geometry", this); connect(addGeometryAction, SIGNAL(triggered()), this, SLOT(addGeometry())); toolbar->addAction(addGeometryAction); // Add the "screenshot" widget and callback. QAction *screenshotAction = new QAction("Screenshot", this); connect(screenshotAction, SIGNAL(triggered()), this, SLOT(screenshot())); toolbar->addAction(screenshotAction); // Create the transfer function editor dock widget, this widget modifies the transfer function directly. QDockWidget *transferFunctionEditorDockWidget = new QDockWidget("Transfer Function", this); transferFunctionEditor = new TransferFunctionEditor(transferFunction); transferFunctionEditorDockWidget->setWidget(transferFunctionEditor); connect(transferFunctionEditor, SIGNAL(committed()), this, SLOT(commitVolumes())); connect(transferFunctionEditor, SIGNAL(committed()), this, SLOT(render())); addDockWidget(Qt::LeftDockWidgetArea, transferFunctionEditorDockWidget); // Set the transfer function editor widget to its minimum allowed height, to leave room for other dock widgets. transferFunctionEditor->setMaximumHeight(transferFunctionEditor->minimumSize().height()); // Create slice editor dock widget. QDockWidget *sliceEditorDockWidget = new QDockWidget("Slices", this); sliceEditor = new SliceEditor(boundingBox); sliceEditorDockWidget->setWidget(sliceEditor); connect(sliceEditor, SIGNAL(slicesChanged(std::vector<SliceParameters>)), this, SLOT(setSlices(std::vector<SliceParameters>))); addDockWidget(Qt::LeftDockWidgetArea, sliceEditorDockWidget); // Create isosurface editor dock widget. QDockWidget *isosurfaceEditorDockWidget = new QDockWidget("Isosurfaces", this); isosurfaceEditor = new IsosurfaceEditor(); isosurfaceEditorDockWidget->setWidget(isosurfaceEditor); connect(isosurfaceEditor, SIGNAL(isovaluesChanged(std::vector<float>)), this, SLOT(setIsovalues(std::vector<float>))); addDockWidget(Qt::LeftDockWidgetArea, isosurfaceEditorDockWidget); // Create the light editor dock widget, this widget modifies the light directly. QDockWidget *lightEditorDockWidget = new QDockWidget("Lights", this); LightEditor *lightEditor = new LightEditor(ambientLight, directionalLight); lightEditorDockWidget->setWidget(lightEditor); connect(lightEditor, SIGNAL(lightsChanged()), this, SLOT(render())); addDockWidget(Qt::LeftDockWidgetArea, lightEditorDockWidget); // Create the probe dock widget. QDockWidget *probeDockWidget = new QDockWidget("Probe", this); probeWidget = new ProbeWidget(this); probeDockWidget->setWidget(probeWidget); addDockWidget(Qt::LeftDockWidgetArea, probeDockWidget); // Tabify dock widgets. tabifyDockWidget(transferFunctionEditorDockWidget, sliceEditorDockWidget); tabifyDockWidget(transferFunctionEditorDockWidget, isosurfaceEditorDockWidget); tabifyDockWidget(transferFunctionEditorDockWidget, lightEditorDockWidget); tabifyDockWidget(transferFunctionEditorDockWidget, probeDockWidget); // Tabs on top. setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::North); // Default to showing transfer function tab widget. transferFunctionEditorDockWidget->raise(); // Add the current OSPRay object file label to the bottom status bar. statusBar()->addWidget(¤tFilenameInfoLabel); }