void stepSolution(char *stepType,GRID *g,SOLN *s,double dt,double *l2norm) { double coef; static int istep=0; int i,k,l; int nsubiter=20; double CFL; // create temp variable for CFL number CFL = g->CFL; if (strcmp(stepType,"euler")==0) { computeRHS(g,s,l2norm); coef = 1.0; updateSoln(s->q,s->q,s->r,s->sigma,dt,CFL,coef,g->ncells); } else if (strcmp(stepType,"rk3") == 0) { // RK step 1 computeRHS(g,s,l2norm); coef=0.25; updateSoln(s->q,s->qt,s->r,s->sigma,dt,CFL,coef,g->ncells); coef=8.0/15; updateSoln(s->q,s->q,s->r,s->sigma,dt,CFL,coef,g->ncells); // RK step 2 computeRHS(g,s,l2norm); coef=5.0/12; updateSoln(s->qt,s->q,s->r,s->sigma,dt,CFL,coef,g->ncells); // RK step 3 computeRHS(g,s,l2norm); coef=3.0/4.0; updateSoln(s->qt,s->q,s->r,s->sigma,dt,CFL,coef,g->ncells); } else if (strcmp(stepType,"ADI")==0) { computeRHSk(g,s,l2norm); ADI(g,s,s->cflnum,dt); } else if (strcmp(stepType,"DADI")==0) { computeRHSk(g,s,l2norm); DADI(g,s,s->cflnum,dt); } else if (strcmp(stepType,"Gauss-Seidel") == 0) { computeRHSkv(g,s,l2norm); gaussSeidel(g,s,s->cflnum,dt); } else if (strcmp(stepType,"line-Gauss-Seidel") == 0) { if (g->visc) computeRHSkv(g,s,l2norm); else computeRHSk(g,s,l2norm); lineGaussSeidel(g,s,s->cflnum,dt); } istep++; }
// --------------------------------------------------------------------------- // CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() // // // --------------------------------------------------------------------------- void CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() { CMMCScBkupArchiveFooter& footer = Driver().DrvArchive().Footer(); CMMCScBkupIndexPublicDataFiles& index = static_cast<CMMCScBkupIndexPublicDataFiles&>( footer.IndexByType( EMMCScBkupOwnerDataTypePublicData ) ); CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); CMMCScBkupFileListCollection& fileList = Driver().DrvFileList(); TInt indexValueCurrent(0); __LOG("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - START"); const TInt ownerCount = dataOwners.Count(); // We can only make a direct comparison for public data for( TInt i=0; i<ownerCount; i++ ) { CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( i ); const CDataOwnerInfo& sbeDataOwner = owner.Owner(); if ( MMCScBkupSBEUtils::HasPublicDataL( sbeDataOwner ) ) { for( TInt i = EDriveA; i<=EDriveZ; i++ ) { const TDriveNumber drive = static_cast< TDriveNumber >( i ); const TInt64 size = owner.OperationalSize( EMMCScBkupOwnerDataTypePublicData, drive ); TMMCScBkupDriveAndSize& entry = iDriveSizes[ drive ]; entry.SetSize(entry.Size() + size); __LOG4("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - DO: 0x%08x has %Ld bytes for drive %c (total %Ld)", owner.SecureId().iId, size, entry.Drive() + 'A', entry.Size()); } } } #if defined(__MMCSCBKUPLOGGING_ENABLED__) for( TInt i = EDriveA; i<=EDriveZ; i++ ) { TMMCScBkupDriveAndSize& entry = iDriveSizes[ i ]; __LOG2("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - Initially %Ld bytes required on drive %c", entry.Size(), entry.Drive() + 'A'); } #endif const TInt count = index.Count(); __LOG1("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - Public files to compare %d", count); // Check needed size by comparing archived public files to files in disk - decrease size if matching file found while( ++indexValueCurrent < count ) { // Get the entry to restore TMMCScBkupArchiveVector entryInfo; //const CMMCScBkupFileInfo& fileInfo = index.At( indexValueCurrent, entryInfo ); const CMMCScBkupFileInfo& fileInfo = fileList.Entry(indexValueCurrent); const TDriveNumber drive = fileInfo.Drive(); __LOG2("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - Archived file: %S, of size %d", &fileInfo.FileName(), fileInfo.Size()); // Check file (if any) size in disk RFile64 restoreFile; TInt64 fileSize = 0; TInt error = restoreFile.Open(ADI().ADIFsSession(), fileInfo.FileName(), EFileShareReadersOnly | EFileRead); if(error == KErrNone) { error = restoreFile.Size(fileSize); if(error == KErrNone) { __LOG1("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - Found matching file of size %d", fileInfo.Size()); // Take into account biggest file already on disk, because reserves that much space temporarily if(iDriveMaxFileSizes[ drive ].Size() < fileSize && KMMCScBkupUseTempFile) { TMMCScBkupDriveAndSize& bigFile = iDriveMaxFileSizes[ drive ]; bigFile.SetSize(fileSize); } } else { fileSize = 0; __LOG1("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - Error % requesting file size", error); } restoreFile.Close(); } TMMCScBkupDriveAndSize& entry = iDriveSizes[ drive ]; entry.SetSize(entry.Size() - fileSize); __LOG2("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - %Ld bytes required now on drive %c", entry.Size(), entry.Drive() + 'A'); } __LOG("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - No estimation for private and system files"); if(Driver().DrvLastCategory()) { TVolumeInfo volInfo; TInt spaceCheck(KErrNone); // Let user interrupt restore if necessary in future. Currently if any of drives cannot be restored, we interrupt restore. for( TInt i = EDriveA; i<=EDriveZ; i++ ) { // Check whether data fits into this drive. const TDriveNumber drive = static_cast< TDriveNumber >( i ); TInt err = ADI().ADIFsSession().Volume( volInfo, drive ); if( err == KErrNone) { // Total compressed size. If this exceeds total size of drive, then restore does not succeed for sure. const TInt64 size = dataOwners.DiskSpaceRequiredForRestore( drive ); __LOG3("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - drive %c requires %Ld + %Ld for temporary file", iDriveSizes[ drive ].Drive() + 'A', iDriveSizes[ drive ].Size(), iDriveMaxFileSizes[ drive ].Size()); if ( (( iDriveSizes[ drive ].Size() + iDriveMaxFileSizes[ drive ].Size() ) > volInfo.iFree ) || ( size > volInfo.iSize ) ) { __LOG2("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - Not enough space (%Ld) on drive %c", TInt(volInfo.iFree), iDriveSizes[ drive ].Drive() + 'A'); spaceCheck = KErrDiskFull; break; } } } User::LeaveIfError(spaceCheck); } else { __LOG("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - Checking next category..."); } __LOG("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - END"); }
void stepSolution(char *stepType,GRID *g,SOLN *s,double dt,double *l2norm, double *linfnorm, int myid) { double coef; static int istep=0; int i,k,l; int nsubiter=20; double CFL; CFL=g->CFL; if (strcmp(stepType,"euler")==0) { communication(g,s,myid); if(g->visc) { computeRHSv(g,s,l2norm,linfnorm,myid); } else { computeRHS(g,s,l2norm,linfnorm,myid); } coef=1.0; updateSoln(s->q,s->q,s->r,s->sigma,dt,CFL,coef,g->ncells); } else if (strcmp(stepType,"rk3") == 0){ /* RK step 1 */ communication(g,s,myid); computeRHS(g,s,l2norm,linfnorm,myid); coef=0.25; updateSoln(s->q,s->qt,s->r,s->sigma,dt,CFL,coef,g->ncells); coef=8.0/15; updateSoln(s->q,s->q,s->r,s->sigma,dt,CFL,coef,g->ncells); /* RK step 2 */ communication(g,s,myid); computeRHS(g,s,l2norm,linfnorm,myid); coef=5.0/12; updateSoln(s->qt,s->q,s->r,s->sigma,dt,CFL,coef,g->ncells); /* RK step 3 */ communication(g,s,myid); computeRHS(g,s,l2norm,linfnorm,myid); coef=3.0/4.0; updateSoln(s->qt,s->q,s->r,s->sigma,dt,CFL,coef,g->ncells); } else if (strcmp(stepType,"ADI")==0){ // communication communication(g,s,myid); computeRHSk(g,s,l2norm,linfnorm,myid); ADI(g,s,s->cflnum,dt,myid); } else if (strcmp(stepType,"DADI")==0){ // communication communication(g,s,myid); computeRHSk(g,s,l2norm,linfnorm,myid); DADI(g,s,s->cflnum,dt,myid); } else if (strcmp(stepType,"Gauss-Seidel") == 0) { // communication communication(g,s,myid); computeRHSkv(g,s,l2norm,myid); gaussSeidel(g,s,s->cflnum,dt,myid); } else if (strcmp(stepType,"line-Gauss-Seidel") == 0) { // communication communication(g,s,myid); if (g->visc) { computeRHSkv(g,s,l2norm,myid); } else { computeRHSk(g,s,l2norm,linfnorm,myid); } lineGaussSeidel(g,s,s->cflnum,dt,myid); } istep++; }
// --------------------------------------------------------------------------- // CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeBackupL() // // // --------------------------------------------------------------------------- void CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeBackupL() { CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); TInt64 uncompressedSize; __LOG("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeBackupL() - START"); // Calculate the total progress required for the entire backup operation uncompressedSize = dataOwners.TotalOperationalSizeL(); __LOG1("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeBackupL() - Total estimated uncompressed size for archive %Ld", uncompressedSize); //const TInt ownerCount = dataOwners.Count(); //for( TInt i=0; i<ownerCount; i++ ) // { // CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( i ); // Reset the size of public data to 0. We update this value // with the compressed size during the compression stage. This // is needed in order to create accurate restore information (since // all of the data owner sizing info is written to disk). // owner.ResetOperationalSize( EMMCScBkupOwnerDataTypePublicData ); // } // Let's check do public files fit in target drive TInt driveNumber; TDriveInfo driveInfo; TVolumeInfo volInfo; TInt8 percentFree(100); // First get the drive number, where archive resides and then get drive's free space. TInt err = ADI().ADIRawArchiveFile().Drive( driveNumber, driveInfo ); if( err == KErrNone) { err = ADI().ADIFsSession().Volume( volInfo, driveNumber ); if( err == KErrNone) { iCumulatedSize += uncompressedSize; if(Driver().DrvLastCategory()) { __LOG3("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeBackupL() - Final cumulated size %Ld, free size on drive %c is %Ld", iCumulatedSize, driveNumber + 'A', volInfo.iFree); if( iCumulatedSize > volInfo.iFree) { percentFree = TInt( (volInfo.iFree * 100 ) / iCumulatedSize ); // accurate enough, no rounding } err = Driver().DrvProgressHandler().MMCScBkupHandleFreeSpace( percentFree ); if( err != KErrNone ) { // Error indicates backup creation no more allowed Driver().DrvProgressHandler().MMCScBkupStartBackuping( EFalse ); User::Leave( err ); } else { Driver().DrvProgressHandler().MMCScBkupStartBackuping( ETrue ); } } else { __LOG3("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeBackupL() - Cumulated size now %Ld, free size on drive %c is %Ld", iCumulatedSize, driveNumber + 'A', volInfo.iFree); } } else { __LOG1("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeBackupL() - Volume info error %d", err); } } __LOG("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeBackupL() - END"); }
// ################################################################## // // step solution // // ################################################################## void SOLVER::stepSolution(void) { double coef; // // Euler explicit // if (strcmp(stepType,"euler") == 0 ) { if (sb->visc) { cout << "Not yet implemented. exit.\n"; exit(1); // computeRHSv; } else computeRHS("explicit"); coef = 1.; updateSolution(sb->q,sb->q,coef); } // // Runge - Kutta 3 // else if (strcmp(stepType,"rk3") == 0 ) { // RK step 1 computeRHS("explicit"); coef=0.25; updateSolution(sb->q,sb->qt,coef); coef=8.0/15; updateSolution(sb->q,sb->q,coef); // RK step 2 computeRHS("explicit"); coef=5.0/12; updateSolution(sb->qt,sb->q,coef); // RK step 3 computeRHS("explicit"); coef=3.0/4.0; updateSolution(sb->qt,sb->q,coef); } // // ADI ( Alternating Direction Implicit) // else if (strcmp(stepType,"ADI")==0) { // if(sb->idual==0) // { computeRHS("implicit"); ADI(); // } // else //dual time stepping // { // printf("Error. Dual Time stepping not yet implemented.\n"); // exit(1); // // for (i = 0; i < NQ*mb->nCell; i++) sb->pq[i] = sb->q[i]; // // for(k = 0; k < sb->ndual; k++) // // { // // DualcomputeRHSk(g,s,l2norm,s->cflnum); // // DualADI(g,s,s->cflnum,dt); // // } // // for (i=0;i<NVAR*g->ncells;i++) s->q[i] = s->pq[i]; // } } }