void Stage::FEMPoint(const int slice, const double t, const double weight, const adoublev &x, adoublev &c, adouble &f0) { SnapShot(x, slice, t); for (vector<DOF *> :: const_iterator p = W->DOFs.begin(); p != W->DOFs.end(); p++) { adouble qC = (*p)->qCurvature; qC += (*p)->QVal; adouble qM = (*p)->qMomentum; # if 0 adouble qDot = (*p)->qDot; adouble qDotContrib = qDot * qDot; f0 += 5 * weight * h * qDotContrib; // completely arbitrary; this is highly experimental speedContribution += 5 * weight * h.value() * qDotContrib.value(); # endif (*p)->DOFReps[sIx]->IntegrateFEM(c, qM, qC, slice, t, weight); } for (vector<Muscle *>::const_iterator m = Muscles.begin(); m != Muscles.end(); m ++) { adouble MVal = (*m)->MVal; adouble MContrib = (*m)->Weight*MVal*MVal; f0 += weight * h * MContrib; torqueContribution += weight * h.value() * MContrib.value(); } }
//Simple Message Pump Proc /////////////////////////////////////////////////////// LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_CREATE: return 0; case WM_CLOSE: PostQuitMessage(0); return 0; case WM_DESTROY: return 0; case WM_KEYDOWN: switch (wParam) { case VK_ESCAPE: PostQuitMessage(0); return 0; case VK_F1: {SnapShot(); return 0; } case VK_F2: {Times->UseKerning(false); Snap->UseKerning(false); Lucida->UseKerning(false); LOG_DEBUG("Times kerning disabled"); return 0; } case VK_F3: {Times->UseKerning(true); Snap->UseKerning(true); Lucida->UseKerning(true); LOG_DEBUG("Times kerning enabled"); return 0; } } return 0; default: return DefWindowProc(hWnd, message, wParam, lParam); } }
/* * Function: AlignmentSnap * * Description: setup and take a 'snapshots' * * Parameters: * void * * Return Values * none * * Discussion: * * get Led 'OnOff' state from TCDLedButton, write the definitions * into dome memory and flash the LED's */ void TCDSti::AlignmentSnap(void) { DomeReset(); GetLeds(); SnapShot(70); DrawCircles(); }
/* * Function: WorkerLoop * * Description: called from the base class (periodically) * * Parameters: * int count * * Return Values * none * * Discussion: * performs the diagnostic */ void TCDSti::WorkerLoop(void) { // if we are are ready working, discontinue; if (m_Continue == TRUE) m_Continue = FALSE; else { m_Continue = TRUE; m_StiButton.SetWindowText("Cancel"); // disable movement m_StiRotateCCButton.EnableWindow(FALSE); m_StiRotateCButton.EnableWindow(FALSE); m_StiMoveUpButton.EnableWindow(FALSE); m_StiMoveLeftButton.EnableWindow(FALSE); m_StiMoveDownButton.EnableWindow(FALSE); m_StiMoveRightButton.EnableWindow(FALSE); m_Slider.EnableWindow(FALSE); EnableLedButtons(FALSE); TestOuterDome(); // if (m_Continue == TRUE) //F404 vc6版中已刪除 // TestSplitter(); // report on overall results CString diag = "Dome LED Tests: Completed: "; m_DiagPF = (m_DomePF == DIAG_PASSED && m_SplitterPF == DIAG_PASSED) ? DIAG_PASSED : DIAG_FAILED; if (m_DiagPF == DIAG_PASSED) DiagReport(diag, DIAG_PASSED); else DiagReport(diag, DIAG_FAILED); } // redraw the screen GetLeds(); SnapShot(150, 100); m_StiButton.SetWindowText("STI Lights"); m_StiRotateCCButton.EnableWindow(TRUE); m_StiRotateCButton.EnableWindow(TRUE); m_StiMoveUpButton.EnableWindow(TRUE); m_StiMoveLeftButton.EnableWindow(TRUE); m_StiMoveDownButton.EnableWindow(TRUE); m_StiMoveRightButton.EnableWindow(TRUE); m_Slider.EnableWindow(TRUE); EnableLedButtons(TRUE); // kill the worker thread KillWorkerThread(); m_Continue = FALSE; }
/* * Function: TestIt * * Description: test the LED at dome position(row, column) * * Parameters: * int row * int column * * Return Values * none * * Discussion: * * create the lighting mode for this LED. snap & * display the camera picture. */ void TCDSti::TestIt(int row, int column) { ClearLightingModeAll(); SetLightingModeRow(row); // if (column >= 42 && column <= 47) //F404 vc6版中已刪除 // { // for (int col = 42; col < 47; col++) // SetLightingModeCol(col); // } // else SetLightingModeCol(column); SnapShot(200, 70); }
void TCDSti::LedSmile(void) { if (m_ControllerType == C51134) m_pPcio->Dome_ioWrite(DIAG_LIGHTDELAY_134, (SHORT) 1); else m_pPcio->Dome_ioWrite(DIAG_LIGHTDELAY_140, (SHORT) 1); ClearLightingModeAll(); SetLightingModeCol(1); SetLightingModeRow(1); SnapShot(150); SetLightingModeCol(9); SetLightingModeRow(9); FlashLights(); DomeReset(); }
// The following is not true at the moment... // This method takes a snapshot of the system's current state and stores // it in memory. If no memory is available or a maximum number of // snapshots has been taken, all snapshots so far are saved to disk The // first snapshot taken (and with no other previous snapshots in a file) // has index 1. void SnapShotManager::takeSnapShot() throw(File::CannotWrite) { if (system_ptr_ == 0) return; // One more snapshot. Add it to the current list of snapshots // The way we do it here should be faster, than filling the // SnapShot with data first and pushing it into the vector afterwards. snapshot_buffer_.push_back(SnapShot()); SnapShot& snapshot = snapshot_buffer_[snapshot_buffer_.size() - 1]; // store all current positions, forces, velocities in the // snapshot object snapshot.takeSnapShot(*system_ptr_); // store the potential energies if (force_field_ptr_ != 0) { snapshot.setPotentialEnergy(force_field_ptr_->getEnergy()); } // store the kinetic energy of all selected atoms in the system // the current value must be calculated as it is not provided by // the force field snapshot.setKineticEnergy(calculateKineticEnergy_()); buffer_counter_++; // We could! use pushback() and size() to determine when to flush the // buffers, but this is faster. if (buffer_counter_ >= flush_to_disk_frequency_) { // write all snapshots to disk in order to prevent memory overflow flushToDisk(); } } // end of SnapShotManager::takeSnapShot()
DynamicVarSnapShot(const char* name, DWORD addr) : BaseVarSnapShot(name, addr) { SnapShot(); }
StaticVarSnapShot(const char* name, DWORD addr, DWORD size) : BaseVarSnapShot(name, addr), mSize(size) { SnapShot(); }