WcmConfig::WcmConfig() : systemAskOpenExec(true), systemEscPanel(true), systemBackSpaceUpDir(false), systemLang(new_char_str("+")), showToolBar(true), showButtonBar(true), //whiteStyle(false), panelShowHiddenFiles(true), panelShowIcons(true), panelCaseSensitive(false), panelColorMode(0), panelModeLeft(0), panelModeRight(0), editSavePos(true), editAutoIdent(false), editTabSize(3), editColorMode(0), editShl(true), terminalBackspaceKey(0), viewColorMode(0) { leftPanelPath = new_char_str(""); rightPanelPath = new_char_str(""); #ifndef _WIN32 MapBool(sectionSystem, "ask_open_exec", &systemAskOpenExec, systemAskOpenExec); #endif MapBool(sectionSystem, "esc_panel", &systemEscPanel, systemEscPanel); MapBool(sectionSystem, "back_updir", &systemBackSpaceUpDir, systemBackSpaceUpDir); MapStr(sectionSystem, "lang", &systemLang); MapBool(sectionSystem, "show_toolbar", &showToolBar, showToolBar); MapBool(sectionSystem, "show_buttonbar", &showButtonBar, showButtonBar); //MapBool(sectionSystem, "white", &whiteStyle, whiteStyle); MapBool(sectionPanel, "show_hidden_files", &panelShowHiddenFiles, panelShowHiddenFiles); MapBool(sectionPanel, "show_icons", &panelShowIcons, panelShowIcons); MapBool(sectionPanel, "case_sensitive_sort", &panelCaseSensitive, panelCaseSensitive); MapInt(sectionPanel, "color_mode", &panelColorMode, panelColorMode); MapInt(sectionPanel, "mode_left", &panelModeLeft, panelModeLeft); MapInt(sectionPanel, "mode_right", &panelModeRight, panelModeRight); #ifdef _WIN32 const char* defPanelPath="C:\\"; #else const char* defPanelPath="/"; #endif MapStr(sectionPanel, "left_panel_path",&leftPanelPath,defPanelPath); MapStr(sectionPanel, "right_panel_path",&rightPanelPath,defPanelPath); MapBool(sectionEditor, "save_file_position", &editSavePos, editSavePos); MapBool(sectionEditor, "auto_ident", &editAutoIdent, editAutoIdent); MapInt(sectionEditor, "color_mode", &editColorMode, editColorMode); MapInt(sectionEditor, "tab_size", &editTabSize, editTabSize); MapBool(sectionEditor, "highlighting", &editShl, editShl); MapInt(sectionTerminal, "backspace_key", &terminalBackspaceKey, terminalBackspaceKey); MapStr(sectionFonts, "panel_font", &panelFontUri); MapStr(sectionFonts, "viewer_font", &viewerFontUri); MapStr(sectionFonts, "editor_font", &editorFontUri); MapStr(sectionFonts, "dialog_font", &dialogFontUri); MapStr(sectionFonts, "terminal_font", &terminalFontUri); MapStr(sectionFonts, "helptext_font", &helpTextFontUri); MapStr(sectionFonts, "helpbold_font", &helpBoldFontUri); MapStr(sectionFonts, "helphead_font", &helpHeadFontUri); MapInt(sectionViewer, "color_mode", &viewColorMode, viewColorMode); MapInt(sectionSystem, "windowX", &windowX, windowX); MapInt(sectionSystem, "windowY", &windowY, windowY); MapInt(sectionSystem, "windowWidth", &windowWidth, windowWidth); MapInt(sectionSystem, "windowHeight", &windowHeight, windowHeight); }
int main(int argc, char *argv[]) { int ierr = 0; #ifdef EPETRA_MPI // Initialize MPI MPI_Init(&argc,&argv); int rank; // My process ID MPI_Comm_rank(MPI_COMM_WORLD, &rank); Epetra_MpiComm Comm( MPI_COMM_WORLD ); #else int rank = 0; Epetra_SerialComm Comm; #endif bool verbose = false; // Check if we should print results to standard out if (argc>1) if (argv[1][0]=='-' && argv[1][1]=='v') verbose = true; int verbose_int = verbose ? 1 : 0; Comm.Broadcast(&verbose_int, 1, 0); verbose = verbose_int==1 ? true : false; // char tmp; // if (rank==0) cout << "Press any key to continue..."<< std::endl; // if (rank==0) cin >> tmp; // Comm.Barrier(); Comm.SetTracebackMode(0); // This should shut down any error traceback reporting int MyPID = Comm.MyPID(); int NumProc = Comm.NumProc(); if(verbose && MyPID==0) cout << Epetra_Version() << std::endl << std::endl; if (verbose) cout << "Processor "<<MyPID<<" of "<< NumProc << " is alive."<<endl; //bool verbose1 = verbose; // unused // Redefine verbose to only print on PE 0 if(verbose && rank!=0) verbose = false; int NumMyEquations = 1; long long NumGlobalEquations = NumProc; // Get update list and number of local equations from newly created Map long long* MyGlobalElementsLL = new long long[NumMyEquations]; MyGlobalElementsLL[0] = 2000000000+MyPID; // Construct a Map that puts approximately the same Number of equations on each processor Epetra_Map MapLL(NumGlobalEquations, NumMyEquations, MyGlobalElementsLL, 0, Comm); EPETRA_TEST_ERR(MapLL.GlobalIndicesInt(),ierr); EPETRA_TEST_ERR(!(MapLL.GlobalIndicesLongLong()),ierr); // Create an integer vector NumNz that is used to build the Petra Matrix. // NumNz[i] is the Number of OFF-DIAGONAL term for the ith global equation on this processor int* NumNzLL = new int[NumMyEquations]; NumNzLL[0] = 0; // Create int types meant to add to long long matrix for test of failure int* MyIntGlobalElementsLL = new int[NumMyEquations]; MyIntGlobalElementsLL[0] = 20000+MyPID; // Create a long long Epetra_Matrix Epetra_CrsMatrix A_LL(Copy, MapLL, NumNzLL); EPETRA_TEST_ERR(A_LL.IndicesAreGlobal(),ierr); EPETRA_TEST_ERR(A_LL.IndicesAreLocal(),ierr); // Insert values double one = 1.0; #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES // Try to add ints which should fail and be caught as an int try { A_LL.InsertGlobalValues(MyIntGlobalElementsLL[0], 1, &one, MyIntGlobalElementsLL+0); } catch(int i) { EPETRA_TEST_ERR(!(i==-1),ierr); } #endif // Add long longs which should succeed EPETRA_TEST_ERR(!(A_LL.InsertGlobalValues(MyGlobalElementsLL[0], 1, &one, MyGlobalElementsLL+0)==0),ierr); EPETRA_TEST_ERR(!(A_LL.IndicesAreGlobal()),ierr); EPETRA_TEST_ERR(!(A_LL.FillComplete(false)==0),ierr); EPETRA_TEST_ERR(!(A_LL.IndicesAreLocal()),ierr); // Get update list and number of local equations from newly created Map int* MyGlobalElementsInt = new int[NumMyEquations]; MyGlobalElementsInt[0] = 2000+MyPID; // Create an integer vector NumNz that is used to build the Petra Matrix. // NumNz[i] is the Number of OFF-DIAGONAL term for the ith global equation on this processor int* NumNzInt = new int[NumMyEquations]; NumNzInt[0] = 0; // Create int types meant to add to long long matrix for test of failure long long* MyLLGlobalElementsInt = new long long[NumMyEquations]; MyLLGlobalElementsInt[0] = 2000000000+MyPID; #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES // Construct a Map that puts approximately the same Number of equations on each processor Epetra_Map MapInt(NumGlobalEquations, NumMyEquations, MyGlobalElementsInt, 0LL, Comm); EPETRA_TEST_ERR(!(MapInt.GlobalIndicesInt()),ierr); EPETRA_TEST_ERR(MapInt.GlobalIndicesLongLong(),ierr); // Create a int Epetra_Matrix Epetra_CrsMatrix A_Int(Copy, MapInt, NumNzInt); EPETRA_TEST_ERR(A_Int.IndicesAreGlobal(),ierr); EPETRA_TEST_ERR(A_Int.IndicesAreLocal(),ierr); // Insert values try { A_Int.InsertGlobalValues(MyLLGlobalElementsInt[0], 1, &one, MyLLGlobalElementsInt+0); } catch(int i) { EPETRA_TEST_ERR(!(i==-1),ierr); } // Add long longs which should succeed EPETRA_TEST_ERR(!(A_Int.InsertGlobalValues(MyGlobalElementsInt[0], 1, &one, MyGlobalElementsInt+0)==0),ierr); EPETRA_TEST_ERR(!(A_Int.IndicesAreGlobal()),ierr); EPETRA_TEST_ERR(!(A_Int.FillComplete(false)==0),ierr); EPETRA_TEST_ERR(!(A_Int.IndicesAreLocal()),ierr); #endif delete [] MyGlobalElementsLL; delete [] NumNzLL; delete [] MyIntGlobalElementsLL; delete [] MyGlobalElementsInt; delete [] NumNzInt; delete [] MyLLGlobalElementsInt; #ifdef EPETRA_MPI MPI_Finalize() ; #endif /* end main */ return ierr ; }