void GridMapping::setMappingFromVelocity(StormContGrid * velocity, const Simbox * timeSimbox, int format) { if(simbox_!=NULL) //Allow this to be called to override old mappings. { if(surfaceMode_ == TOPGIVEN) { if(z1Grid_ != NULL) { delete z1Grid_; z1Grid_ = NULL; } } else if(surfaceMode_ == BOTTOMGIVEN) { if(z0Grid_ != NULL) { delete z0Grid_; z0Grid_ = NULL; } } delete simbox_; simbox_ = NULL; } if(mapping_!=NULL) delete mapping_; mapping_ = NULL; //int format = velocity->getOutputFormat(); bool failed = false; std::string errText(""); calculateSurfaceFromVelocity(velocity, timeSimbox); setDepthSimbox(timeSimbox, timeSimbox->getnz(), format, failed, errText); makeTimeDepthMapping(velocity, timeSimbox); if (failed) { LogKit::LogFormatted(LogKit::Error,"\n%s\n",errText.c_str()); exit(1); } }
/** @SYMTestCaseID UIF-CONE-0010 @SYMTestCaseDesc Check use of CCoeEnv::LeaveWithErrorText() to set error text to '' @SYMTestPriority Critical @SYMTestType Component Integration Test @SYMTestStatus Implemented @SYMTestActions Call CCoeEnv::LeaveWithErrorText() to set error text to '' @SYMTestExpectedResults CCoeEnv::iErrorText is set to '' CCoeEnv::iErrorContextText is zero'd Function leaves with KErrExtendedWithText */ void CConeErrorMsgTestAppUi::TestCase03L() { INFO_PRINTF1(_L("UIF-CONE-0010 - test case start")); _LIT(KTestErrMsg, ""); TBuf<20> errText(KTestErrMsg); TestLeaveWithErrorTextL(errText); INFO_PRINTF1(_L("UIF-CONE-0010 - test case end")); }
bool Brewtarget::ensureDirectoriesExist() { bool success; QDir dir; QString errTitle(QObject::tr("Directory Problem")); QString errText(QObject::tr("\"%1\" cannot be read.")); // Check data dir dir.setPath(getDataDir()); if( ! dir.exists() || ! dir.isReadable() ) { QMessageBox::information( 0, errTitle, errText.arg(dir.path()) ); return false; } // Check doc dir dir.setPath(getDocDir()); if( ! dir.exists() || ! dir.isReadable() ) { QMessageBox::information( 0, errTitle, errText.arg(dir.path()) ); return false; } // Check config dir dir.setPath(getConfigDir(&success)); if( !success || ! dir.exists() || ! dir.isReadable() ) { QMessageBox::information( 0, errTitle, errText.arg(dir.path()) ); return false; } // Check/create user data directory dir.setPath(getUserDataDir()); if( !dir.exists() && !dir.mkpath(".") ) { QMessageBox::information( 0, errTitle, errText.arg(dir.path()) ); return false; } return true; }
/** @SYMTestCaseID UIF-CONE-0013 @SYMTestCaseDesc Check use of CCoeEnv::LeaveWithErrorText() to set error text to 'Test Max Error Message' plus, filled to exceed max length of 80 chars, i.e. 81 chars and error context text to 'Test Max Error Message' plus, filled to exceed max length of 80 chars, i.e. 81 chars @SYMTestPriority Critical @SYMTestType Component Integration Test @SYMTestStatus Implemented @SYMTestActions Call CCoeEnv::LeaveWithErrorText() to set error text to 'Test Max Error Message' plus, filled to exceed max length of 80 chars, i.e. 81 chars and error context text to 'Test Max Error Message' plus, filled to exceed max length of 80 chars, i.e. 81 chars @SYMTestExpectedResults CCoeEnv::iErrorText is set to 'Test Max Error Message34567890...' and terminated by KBaflCharTruncation at the 80th char CCoeEnv::iErrorContextText is set to 'Test Max Error Message34567...' and terminated by KBaflCharTruncation at the 80th char Function leaves with KErrExtendedWithText */ void CConeErrorMsgTestAppUi::TestCase06L() { INFO_PRINTF1(_L("UIF-CONE-0013 - test case start")); _LIT(KTestErrMsg, "Test Max Error Message34567890123456789012345678901234567890123456789012345678901"); // 81 chars TBuf<81> errText(KTestErrMsg); _LIT(KTestErrConMsg, "Test Max Error Message34567890123456789012345678901234567890123456789012345678901"); // 81 chars TBuf<81> errConText(KTestErrConMsg); TestLeaveWithErrorTextL(errText, &errConText, ETrue); INFO_PRINTF1(_L("UIF-CONE-0013 - test case end")); }
/** @SYMTestCaseID UIF-CONE-0009 @SYMTestCaseDesc Check use of CCoeEnv::LeaveWithErrorText() to set error text to 'Test Error Message' and error context text to 'Test Context Error Message' @SYMTestPriority Critical @SYMTestType Component Integration Test @SYMTestStatus Implemented @SYMTestActions Call CCoeEnv::LeaveWithErrorText() to set error text to 'Test Error Message' and error context text to 'Test Context Error Message' @SYMTestExpectedResults CCoeEnv::iErrorText is set to 'Test Error Message' CCoeEnv::iErrorContextText is set to 'Test Context Error Message' Function leaves with KErrExtendedWithText */ void CConeErrorMsgTestAppUi::TestCase02L() { INFO_PRINTF1(_L("UIF-CONE-0009 - test case start")); _LIT(KTestErrMsg, "Test Error Message"); TBuf<20> errText(KTestErrMsg); _LIT(KTestErrConMsg, "Test Context Error Message"); TBuf<40> errConText(KTestErrConMsg); TestLeaveWithErrorTextL(errText, &errConText); INFO_PRINTF1(_L("UIF-CONE-0009 - test case end")); }
void FormulaDialog::formulaChanged() { extern Calculator calculator; QString const formula(ui.formulaComboBox->currentText()); if (calculator.setFormula(formula.toAscii().constData())) { ui.okButton->setText("OK"); ui.okButton->setEnabled(true); ui.errorLabel->setText(""); ui.multiGroupBox->setEnabled(calculator.counterUsed()); } else { ui.multiGroupBox->setEnabled(false); ui.okButton->setEnabled(false); int errpos = calculator.errorPos(); QString errText(QString("<b>") + formula.left(errpos)+ "</b>"); if (errpos == formula.length()) errText += tr(" (formula incomplete)"); else errText += "<font color=\"#ff0000\">" + formula.mid(errpos) + tr("</font> (parse failed at start of red text)"); ui.errorLabel->setText(errText); } }
ModelGravityDynamic::ModelGravityDynamic(const ModelSettings * modelSettings, const ModelGeneral * modelGeneral, ModelGravityStatic * modelGravityStatic, const InputFiles * inputFiles, int t, SeismicParametersHolder & seismicParameters) { modelGeneral_ = modelGeneral; failed_ = false; thisTimeLapse_ = t; bool failedLoadingModel = false; bool failedReadingFile = false; std::string errText(""); int nObs = 30; // should this be given in input file int nColumns = 5; // We require data files to have five columns // Check that timeLapse is ok if(thisTimeLapse_ < 1 && thisTimeLapse_ >modelSettings->getNumberOfVintages()){ errText += "Not valid time lapse"; failedLoadingModel = true; } if(failedLoadingModel == false){ LogKit::WriteHeader("Setting up gravimetric time lapse"); // Find first gravity data file std::string fileName = inputFiles->getGravimetricData(thisTimeLapse_); observation_location_utmx_ .resize(nObs); observation_location_utmy_ .resize(nObs); observation_location_depth_.resize(nObs); gravity_response_.resize(nObs); gravity_std_dev_ .resize(nObs); ModelGravityStatic::ReadGravityDataFile(fileName, "gravimetric survey ", nObs, nColumns, observation_location_utmx_, observation_location_utmy_, observation_location_depth_, gravity_response_, gravity_std_dev_, failedReadingFile, errText); failedLoadingModel = failedReadingFile; LogKit::LogFormatted(LogKit::Low, "Setting up forward model matrix ..."); BuildGMatrix(modelGravityStatic, seismicParameters); LogKit::LogFormatted(LogKit::Low, "ok.\n"); } if (failedLoadingModel) { LogKit::WriteHeader("Error(s) with gravimetric surveys."); LogKit::LogFormatted(LogKit::Error,"\n"+errText); LogKit::LogFormatted(LogKit::Error,"\nAborting\n"); } failed_ = failedLoadingModel || failedReadingFile; failed_details_.push_back(failedReadingFile); }
void DSNLEXER::Unexpected( const char* text ) throw( IO_ERROR ) { wxString errText( _("Unexpected") ); errText << wxT(" '") << wxString::FromUTF8( text ) << wxT("'"); THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() ); }
void DSNLEXER::Unexpected( int aTok ) throw( IO_ERROR ) { wxString errText( _("Unexpected") ); errText << wxT(" ") << GetTokenString( aTok ); THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() ); }
ModelGravityStatic::ModelGravityStatic(ModelSettings *& modelSettings, ModelGeneral *& modelGeneral, const InputFiles * inputFiles) { modelGeneral_ = modelGeneral; failed_ = false; before_injection_start_ = false; bool failedLoadingModel = false; bool failedReadingFile = false; std::string errText(""); bool doGravityInversion = true; int numberGravityFiles = 0; for(int i = 0; i<modelSettings->getNumberOfVintages(); i++){ if(modelSettings->getGravityTimeLapse(i)) numberGravityFiles++; } if(numberGravityFiles == 0){ // Everything is ok - we do not need gravity inversion failedLoadingModel = false; doGravityInversion = false; } if(numberGravityFiles == 1){ failedLoadingModel = true; doGravityInversion = false; errText+="Need at least two gravity surveys for inversion."; } // Set up gravimetric baseline if(doGravityInversion){ LogKit::WriteHeader("Setting up gravimetric baseline"); // Find first gravity data file std::string fileName = inputFiles->getGravimetricData(0); int nObs = 30; //user input int nColumns = 5; // We require data files to have five columns observation_location_utmx_.resize(nObs); observation_location_utmy_.resize(nObs); observation_location_depth_.resize(nObs); gravity_response_.resize(nObs); gravity_std_dev_.resize(nObs); ReadGravityDataFile(fileName, "gravimetric base survey", nObs, nColumns, observation_location_utmx_, observation_location_utmy_, observation_location_depth_, gravity_response_, gravity_std_dev_, failedReadingFile, errText); failedLoadingModel = failedReadingFile; Simbox * fullTimeSimbox = modelGeneral->getTimeSimbox(); x_upscaling_factor_ = modelSettings->getNXpad()/5 + 1; // should be user input... y_upscaling_factor_ = modelSettings->getNYpad()/5 + 1; z_upscaling_factor_ = modelSettings->getNZpad()/5 + 1; SetUpscaledPaddingSize(modelSettings); // NB: Changes upscaling factors! dx_upscaled_ = fullTimeSimbox->GetLX()/nx_upscaled_; dy_upscaled_ = fullTimeSimbox->GetLY()/ny_upscaled_; dz_upscaled_ = fullTimeSimbox->GetLZ()/nz_upscaled_; LogKit::LogFormatted(LogKit::Low, "Generating smoothing kernel ..."); MakeUpscalingKernel(modelSettings, fullTimeSimbox); LogKit::LogFormatted(LogKit::Low, "ok.\n"); LogKit::LogFormatted(LogKit::Low, "Generating lag index table (size " + NRLib::ToString(nxp_upscaled_) + " x " + NRLib::ToString(nyp_upscaled_) + " x " + NRLib::ToString(nzp_upscaled_) + ") ..."); MakeLagIndex(nxp_upscaled_, nyp_upscaled_, nzp_upscaled_); // Including padded region! LogKit::LogFormatted(LogKit::Low, "ok.\n"); } if (failedLoadingModel) { LogKit::WriteHeader("Error(s) with gravimetric surveys"); LogKit::LogFormatted(LogKit::Error,"\n"+errText); LogKit::LogFormatted(LogKit::Error,"\nAborting\n"); } failed_ = failedLoadingModel || failedReadingFile; failed_details_.push_back(failedReadingFile); }