int processInventoryRdr(SaHpiSessionIdT sessionId, SaHpiResourceIdT resourceId, SaHpiRdrT * rdr, SaHpiInventoryRecT * inventoryRec) { SaErrorT status; int retval = SAF_TEST_NOTSUPPORT; SaHpiEntryIdT AreaId, NextAreaId; SaHpiIdrAreaHeaderT Header; NextAreaId = SAHPI_FIRST_ENTRY; while ((retval == SAF_TEST_NOTSUPPORT) && (NextAreaId != SAHPI_LAST_ENTRY)) { AreaId = NextAreaId; status = saHpiIdrAreaHeaderGet(sessionId, resourceId, inventoryRec->IdrId, SAHPI_IDR_AREATYPE_UNSPECIFIED, AreaId, &NextAreaId, &Header); if (status != SA_OK) { retval = SAF_TEST_UNRESOLVED; e_print(saHpiIdrAreaHeaderGet, SA_OK, status); } else { retval = deleteField(sessionId, resourceId, inventoryRec->IdrId, Header.AreaId); } } return retval; }
MainForm::MainForm( QWidget* parent, const char* name, WFlags fl ) : QMainWindow( parent, name, fl ) { (void)statusBar(); if ( !name ) setName( "MainForm" ); setCentralWidget( new QWidget( this, "qt_central_widget" ) ); MainFormLayout = new QVBoxLayout( centralWidget(), 11, 6, "MainFormLayout"); listView = new QListView( centralWidget(), "listView" ); listView->addColumn( tr( "Type" ) ); listView->addColumn( tr( "Name" ) ); listView->addColumn( tr( "Login" ) ); listView->addColumn( tr( "Password" ) ); listView->addColumn( tr( "Description" ) ); listView->setResizeMode( QListView::AllColumns ); listView->setSorting(-1); MainFormLayout->addWidget( listView ); // actions createProfileAction = new QAction( this, "createProfileAction" ); createProfileAction->setIconSet( QPixmap::fromMimeSource("new.png") ); openProfileAction = new QAction(this, "openProfileAction" ); openProfileAction->setIconSet( QPixmap::fromMimeSource("open.png") ); tb_openProfileAction = new QAction(this, "tb_openProfileAction"); tb_openProfileAction->setIconSet( QPixmap::fromMimeSource("tb_open.png") ); closeProfileAction = new QAction( this, "closeProfileAction" ); closeProfileAction->setIconSet( QPixmap::fromMimeSource("close.png") ); tb_closeProfileAction = new QAction( this, "tb_closeProfileAction" ); tb_closeProfileAction->setIconSet( QPixmap::fromMimeSource("tb_close.png") ); deleteProfileAction = new QAction( this, "deleteProfileAction" ); deleteProfileAction->setIconSet( QPixmap::fromMimeSource("delete_all.png") ); changeProfileAction = new QAction( this, "changeProfileAction" ); fileQuitAction = new QAction( this, "fileQuitAction" ); fileSaveAction = new QAction( this, "fileSaveAction" ); fileSaveAction->setIconSet( QPixmap::fromMimeSource("save.png") ); tb_fileSaveAction = new QAction( this, "tb_fileSaveAction" ); tb_fileSaveAction->setIconSet( QPixmap::fromMimeSource("tb_save.png") ); editUndoAction = new QAction( this, "editUndoAction" ); editUndoAction->setIconSet( QPixmap::fromMimeSource("undo.png") ); tb_editUndoAction = new QAction( this, "editUndoAction" ); tb_editUndoAction->setIconSet( QPixmap::fromMimeSource("tb_undo.png") ); editRedoAction = new QAction( this, "editRedoAction" ); editRedoAction->setIconSet( QPixmap::fromMimeSource("redo.png") ); tb_editRedoAction = new QAction( this, "tb_editRedoAction" ); tb_editRedoAction->setIconSet( QPixmap::fromMimeSource("tb_redo.png") ); editNewField = new QAction( this, "editNewField" ); editNewField->setIconSet( QPixmap::fromMimeSource("new.png") ); editEditField = new QAction( this, "editEditField" ); editEditField->setIconSet( QPixmap::fromMimeSource("edit.png") ); tb_editEditField = new QAction( this, "tb_editEditField" ); tb_editEditField->setIconSet( QPixmap::fromMimeSource("tb_edit.png") ); tb_editNewField = new QAction( this, "tb_editNewField" ); tb_editNewField->setIconSet( QPixmap::fromMimeSource("tb_new.png") ); editDeleteField = new QAction( this, "editDeleteField" ); editDeleteField->setIconSet( QPixmap::fromMimeSource("delete.png") ); tb_editDeleteField = new QAction( this, "tb_editDeleteField" ); tb_editDeleteField->setIconSet( QPixmap::fromMimeSource("tb_delete.png") ); editDeleteAll = new QAction( this, "editDeleteAll" ); editDeleteAll->setIconSet( QPixmap::fromMimeSource("delete_all.png") ); helpAboutAction = new QAction( this, "helpAboutAction" ); // toolbars fileToolbar = new QToolBar( tr("File"), this, DockTop ); tb_openProfileAction->addTo( fileToolbar); tb_fileSaveAction->addTo( fileToolbar); tb_closeProfileAction->addTo( fileToolbar ); editToolbar = new QToolBar( tr("Edit"), this, DockTop ); tb_editUndoAction->addTo( editToolbar ); tb_editRedoAction->addTo( editToolbar ); editToolbar->addSeparator(); tb_editNewField->addTo( editToolbar ); tb_editEditField->addTo( editToolbar ); tb_editDeleteField->addTo( editToolbar ); // menubar MenuBarEditor = new QMenuBar( this, "MenuBarEditor" ); File = new QPopupMenu( this ); createProfileAction->addTo( File ); openProfileAction->addTo( File ); fileSaveAction->addTo( File ); closeProfileAction->addTo( File ); deleteProfileAction->addTo( File ); changeProfileAction->addTo( File ); File->insertSeparator(); fileQuitAction->addTo( File ); MenuBarEditor->insertItem( QString(""), File, 1 ); Edit = new QPopupMenu( this ); editUndoAction->addTo( Edit ); editRedoAction->addTo( Edit ); Edit->insertSeparator(); editNewField->addTo( Edit ); editEditField->addTo( Edit ); editDeleteField->addTo( Edit ); editDeleteAll->addTo(Edit); MenuBarEditor->insertItem( QString(""), Edit, 2 ); Help = new QPopupMenu( this ); helpAboutAction->addTo( Help ); MenuBarEditor->insertItem( QString(""), Help, 3 ); rmbMenu = new QPopupMenu( this ); editUndoAction->addTo( rmbMenu ); editRedoAction->addTo( rmbMenu ); rmbMenu->insertSeparator(); editNewField->addTo( rmbMenu ); editEditField->addTo( rmbMenu ); editDeleteField->addTo( rmbMenu ); languageChange(); resize( QSize(700, 400).expandedTo(minimumSizeHint()) ); clearWState( WState_Polished ); connect(createProfileAction, SIGNAL( activated() ), this, SLOT( createProfile() ) ); connect(openProfileAction, SIGNAL( activated() ), this, SLOT( openProfile() ) ); connect(tb_openProfileAction, SIGNAL( activated() ), this, SLOT( openProfile() ) ); connect(closeProfileAction, SIGNAL( activated() ), this, SLOT( closeProfile() ) ); connect(tb_closeProfileAction, SIGNAL( activated() ), this, SLOT( closeProfile() ) ); connect(deleteProfileAction, SIGNAL( activated() ), this, SLOT( deleteProfile() ) ); connect(changeProfileAction, SIGNAL( activated() ), this, SLOT( changeProfile() ) ); connect(fileSaveAction, SIGNAL( activated() ), this, SLOT( save() ) ); connect(tb_fileSaveAction, SIGNAL( activated() ), this, SLOT( save() ) ); connect(fileQuitAction, SIGNAL( activated() ), this, SLOT( close() ) ); connect(editUndoAction, SIGNAL( activated() ), this, SLOT( undo() ) ); connect(tb_editUndoAction, SIGNAL( activated() ), this, SLOT( undo() ) ); connect(editRedoAction, SIGNAL( activated() ), this, SLOT( redo() ) ); connect(tb_editRedoAction, SIGNAL( activated() ), this, SLOT( redo() ) ); connect(editNewField, SIGNAL( activated() ), this, SLOT( newField() ) ); connect(tb_editNewField, SIGNAL( activated() ), this, SLOT( newField() ) ); connect(editEditField, SIGNAL(activated() ), this, SLOT( editField() ) ); connect(tb_editEditField, SIGNAL(activated() ), this, SLOT( editField() ) ); connect(editDeleteField, SIGNAL( activated() ), this, SLOT( deleteField() ) ); connect(tb_editDeleteField, SIGNAL( activated() ), this, SLOT( deleteField() ) ); connect(editDeleteAll, SIGNAL( activated() ), this, SLOT( deleteAll() ) ); connect(helpAboutAction, SIGNAL( activated() ), this, SLOT( about() ) ); connect(listView, SIGNAL( doubleClicked(QListViewItem *) ), this, SLOT( edit(QListViewItem *) ) ); connect(listView, SIGNAL( contextMenuRequested( QListViewItem *, const QPoint&, int) ), this, SLOT( slotRMB( QListViewItem*, const QPoint &, int ) ) ); modified = false; Caption(); if(!ifProfileExists()) createProfile(); else setEnabledActions(1); }
int main(int argc, char **argv) { struct timespec start, finish; start_time if (argc<8) { printf("Usage: %s x y iteration INCREMENT_TIME, INCREMENT threads EPSILON\n", argv[0]); } sscanf(argv[1], "%d", &x); sscanf(argv[2], "%d", &y); sscanf(argv[3], "%d", &iteration); sscanf(argv[4], "%d", &INCREMENT_TIME); sscanf(argv[5], "%lf", &INCREMENT); sscanf(argv[6], "%d", &threads); sscanf(argv[7], "%lf", &EPSILON); omp_set_num_threads(threads); field = malloc(sizeof(TemperatureField)); tempField = malloc(sizeof(TemperatureField)); field->x = y; field->y = x; #ifdef DISPLAY XWindow_Init(field); #endif int iter, inc; int *X_Size = malloc(sizeof(int)*INCREMENT_TIME); int *Y_Size = malloc(sizeof(int)*INCREMENT_TIME); X_Size[INCREMENT_TIME-1] = x; Y_Size[INCREMENT_TIME-1] = y; for (inc=INCREMENT_TIME-2; inc>=0; --inc) { X_Size[inc] = X_Size[inc+1] / INCREMENT; Y_Size[inc] = Y_Size[inc+1] / INCREMENT; } for (inc=0; inc<INCREMENT_TIME; ++inc) { if (!inc) { newField(field, X_Size[inc], Y_Size[inc], 0, 0); newField(tempField, X_Size[inc], Y_Size[inc], 0, 0); initField(field); } else { newField(field, X_Size[inc], Y_Size[inc], X_Size[inc-1], Y_Size[inc-1]); newField(tempField, X_Size[inc], Y_Size[inc], X_Size[inc-1], Y_Size[inc-1]); } #ifdef DISPLAY XResize(field); #endif for (iter=0; iter<iteration; iter++) { double error = temperature_iterate(field); if (error<EPSILON) { printf("Finished. iteration=%d, error=%lf\n", iter, error); break; } swapField = field; field = tempField; tempField = swapField; #ifdef DISPLAY end_time if (time_elapsed_ns > FRAME_INTERVAL*1000000) { start_time; XRedraw(field); } // puts("Field:"); // int i, j; // for (i=0; i<field->x; ++i) // { // for (j=0; j<field->y; ++j) // printf("%lf ", field->t[i][j]); // puts(""); // } #endif } } deleteField(field); deleteField(tempField); free(X_Size); free(Y_Size); printf("Finished in %d iterations.\n", iter_cnt); end_time; printf("%lf\n", time_elapsed_s); return 0; }