示例#1
0
//==============================================================================
int Komplex_LinearProblem::UpdateValues(double c0r, double c0i, const Epetra_RowMatrix & A0,
					     double c1r, double c1i, const Epetra_RowMatrix & A1,
					     const Epetra_MultiVector & Xr, const Epetra_MultiVector & Xi,
					     const Epetra_MultiVector & Br, const Epetra_MultiVector & Bi) {
  bool firstTime = false;
  KomplexMatrix_->PutScalar(0.0);
  TEUCHOS_TEST_FOR_EXCEPT(ProcessValues(c0r, c0i, A0, c1r, c1i, A1, Xr, Xi, Br, Bi, firstTime)!=0);

}
示例#2
0
//==============================================================================
Komplex_LinearProblem::Komplex_LinearProblem(double c0r, double c0i, const Epetra_RowMatrix & A0,
					     double c1r, double c1i, const Epetra_RowMatrix & A1,
					     const Epetra_MultiVector & Xr, const Epetra_MultiVector & Xi,
					     const Epetra_MultiVector & Br, const Epetra_MultiVector & Bi) {
  bool firstTime = true;
  TEUCHOS_TEST_FOR_EXCEPT(ProcessValues(c0r, c0i, A0, c1r, c1i, A1, Xr, Xi, Br, Bi, firstTime)!=0);

  TEUCHOS_TEST_FOR_EXCEPT(KomplexMatrix_->FillComplete(*KomplexMatrixDomainMap_,*KomplexMatrixRangeMap_)!=0);

  KomplexProblem_ = Teuchos::rcp(new Epetra_LinearProblem(KomplexMatrix_.get(), KomplexLHS_.get(), KomplexRHS_.get()));

}
示例#3
0
bool
CScsiDeviceList::ProcessKey(HKEY hKey, int iLevel, DWORD dwDeviceId)
{
#if defined(_DEBUG)
   switch (iLevel)
   {
   case 3:
      _ftprintf(  stderr, 
                  _T("%-64s\n"), 
                  &m_szLastKey[1]);
      break;

   case 2:
      _ftprintf(  stderr, 
                  _T("%-64s%d\n"), 
                  &m_szLastKey[1], 
                  dwDeviceId & 0xFF);
      break;

   case 1:
      _ftprintf(  stderr, 
                  _T("%-64s%d:%d\n"), 
                  &m_szLastKey[1], 
                  (dwDeviceId >>  8) & 0xFF,
                   dwDeviceId        & 0xFF);
      break;

   case 0:
      _ftprintf(  stderr, 
                  _T("%-64s%d:%d:%d\n"), 
                  &m_szLastKey[1], 
                  (dwDeviceId >>  16) & 0xFF,
                  (dwDeviceId >>  8) & 0xFF,
                   dwDeviceId        & 0xFF);
      break;
   }
#endif

   for (int idxSubkey = 0; ; idxSubkey++) {

      TCHAR szSubkeyName[c_MaxSubkeyLength + 1];
      DWORD dwLength;

      dwLength = sizeof(szSubkeyName);

      m_lLastError = RegEnumKeyEx(  hKey, 
                                    idxSubkey, 
                                    szSubkeyName, 
                                    &dwLength, 
                                    NULL, 
                                    NULL, 
                                    NULL, 
                                    NULL);

      if (m_lLastError == ERROR_NO_MORE_ITEMS) {
         break;
      } else  if (m_lLastError == ERROR_MORE_DATA) {
#if defined(_DEBUG)
         _tcscpy(m_szLastOperation, _T("Enumerating subkeys of "));
         PrintLastError();
#endif
         // Subkey name is too long
         continue;
      } else if (m_lLastError != ERROR_SUCCESS) {
         // Unexpected Error
         _tcscpy(m_szLastOperation, _T("Enumerating subkeys of "));
         return false;
      }

      int   iValue;

      if (_stscanf(szSubkeyName, c_lpszFormatList[iLevel], &iValue) != 1) {
         // Ignore this subkey, it is probably Initiator Id n
         continue;
      }

      m_szLastKey[m_dwLastKeyLength++] = _T('\\');

      DWORD dwSubkeyLength = (DWORD)_tcslen(szSubkeyName);
      memcpy(&m_szLastKey[m_dwLastKeyLength], szSubkeyName, (dwSubkeyLength + 1) * sizeof(TCHAR));
      m_dwLastKeyLength += dwSubkeyLength;

      HKEY  hSubkey;

      m_lLastError = RegOpenKeyEx(hKey, szSubkeyName, 0, KEY_READ, &hSubkey);

      if (m_lLastError != ERROR_SUCCESS) {
         _tcscpy(m_szLastOperation, _T("Opening key "));
         return false;
      }

      if (iLevel == 0) {
#if defined(_DEBUG)
         _ftprintf(  stderr, 
                     _T("%-64s%d:%d:%d:%d\n"), 
                     &m_szLastKey[1], 
                     (dwDeviceId >> 16) & 0xFF,
                     (dwDeviceId >>  8) & 0xFF,
                      dwDeviceId        & 0xFF,
                      iValue);
#endif

         ProcessValues(hSubkey, (dwDeviceId << 8) | iValue);
      } else {
         if (!ProcessKey(hSubkey, iLevel - 1, (dwDeviceId << 8) | iValue)) {