示例#1
0
文件: mainmenu.py 项目: song2001/OOF2
def set_debug(menuitem, state):
    if state:
        debug.set_debug_mode()
    else:
        debug.clear_debug_mode()
示例#2
0
文件: oof.py 项目: creuzige/OOF2
def run(no_interp=None):
    global _rank
    global startupfiles

    process_inline_options()  # execute well-formed oof options

    # Look for .oof2rc in the user's home directory.
    if not no_rc:
        oofrcpath = os.path.join(os.path.expanduser("~"), ".oof2rc")
        if os.path.exists(oofrcpath):
            startupfiles = [StartUpScriptNoLog(oofrcpath)] + startupfiles

    if thread_enable.query() and not (runtimeflags.text_mode
                                      or config.no_gui()):
        # TODO: Is this still necessary?
        garbage.disable()  # work-around for gtk bug?

    start_parallel_machine()  # start parallel suite (if available)

    if _rank == 0:
        if parallel_enable.enabled():
            from ooflib.SWIG.common import mpitools
            _size = mpitools.Size()
            mpitools.Isend_Bool(thread_enable.enabled(), range(1, _size))

        if parallel_enable.enabled():
            from ooflib.common.IO import socket2me

        if config.petsc():
            print "Going to InitPETSc"
            from ooflib.SWIG.engine.PETSc.petsc_solverdriver import InitPETSc
            InitPETSc(sys.argv)
            for s in sys.argv:
                print s

        start_sockets_Front_End()
        # Import mainmenu only *after* processing command line options, so
        # that the options can affect which menus are loaded.
        global mainmenu
        from ooflib.common.IO import mainmenu
        front_end(no_interp)  # all non-parallel menu items are executed here.
    else:
        # parallel back-end
        parallel_enable.set(True)  # notify back-end of its parallel status

        # thread status at the back-ends
        from ooflib.SWIG.common import mpitools
        thread_enable.set(mpitools.Recv_Bool(0))
        if not thread_enable.enabled():
            lock.disable_all()

        if parallel_enable.enabled():
            from ooflib.common.IO import socket2me

        if config.petsc():
            print "Going to InitPETSc"
            from ooflib.SWIG.engine.PETSc.petsc_solverdriver import InitPETSc
            InitPETSc(sys.argv)
            for s in sys.argv:
                print s

        debug.set_debug_mode()  # set for debugging parallel mode
        from ooflib.common import quit
        quit.set_quiet()  ## back-end exits quietly.
        start_sockets_Back_End()  # socket initialization
        from ooflib.common import backEnd  # import back end machine
        # The back end shouldn't run the gui!
        runtimeflags.text_mode = True
        backEnd.back_end()  # back-end awaits for your command
示例#3
0
文件: oof.py 项目: anilkunwar/OOF2
def run(no_interp=None):
    global _rank
    global startupfiles

    process_inline_options()  # execute well-formed oof options

    # Look for .oof2rc in the user's home directory.
    if not no_rc:
        oofrcpath = os.path.join(os.path.expanduser("~"), ".oof2rc")
        if os.path.exists(oofrcpath):
            startupfiles = [StartUpScriptNoLog(oofrcpath)]+startupfiles


    if thread_enable.query() and not (runtimeflags.text_mode or config.no_gui()):
        # TODO: Is this still necessary?
        garbage.disable()               # work-around for gtk bug?

    start_parallel_machine()  # start parallel suite (if available)

    if _rank == 0:
        if parallel_enable.enabled():
            from ooflib.SWIG.common import mpitools
            _size = mpitools.Size()
            mpitools.Isend_Bool(thread_enable.enabled(), range(1,_size))
            
        if parallel_enable.enabled():
            from ooflib.common.IO import socket2me

        if config.petsc():
            print "Going to InitPETSc"
            from ooflib.SWIG.engine.PETSc.petsc_solverdriver import InitPETSc
            InitPETSc(sys.argv)
            for s in sys.argv:
                print s

        start_sockets_Front_End()
        # Import mainmenu only *after* processing command line options, so
        # that the options can affect which menus are loaded.
        global mainmenu
        from ooflib.common.IO import mainmenu
        front_end(no_interp)  # all non-parallel menu items are executed here.
    else:
        # parallel back-end
        parallel_enable.set(True)  # notify back-end of its parallel status

        # thread status at the back-ends
        from ooflib.SWIG.common import mpitools
        thread_enable.set(mpitools.Recv_Bool(0))
        if not thread_enable.enabled():
            lock.disable_all()
        
        if parallel_enable.enabled():
            from ooflib.common.IO import socket2me

        if config.petsc():
            print "Going to InitPETSc"
            from ooflib.SWIG.engine.PETSc.petsc_solverdriver import InitPETSc
            InitPETSc(sys.argv)
            for s in sys.argv:
                print s

        debug.set_debug_mode()  # set for debugging parallel mode
        from ooflib.common import quit
        quit.set_quiet() ## back-end exits quietly.
        start_sockets_Back_End()  # socket initialization
        from ooflib.common import backEnd  # import back end machine
        # The back end shouldn't run the gui!
        runtimeflags.text_mode = True
        backEnd.back_end()  # back-end awaits for your command
示例#4
0
文件: oof.py 项目: creuzige/OOF2
     startupfiles.append(StartUpScript(opt[1]))
     remove_option(opt[0], opt[1])
 elif opt[0] in ('--command', ):
     startupfiles.append(StartUpCommand(opt[1]))
     remove_option(opt[0], opt[1])
 elif opt[0] in ('--image', ):
     startupfiles.append(StartUpImage(opt[1]))
     remove_option(opt[0], opt[1])
 elif opt[0] in ('--data', ):
     startupfiles.append(StartUpData(opt[1]))
     remove_option(opt[0], opt[1])
 elif opt[0] in ('--import', ):
     startupimports.append(opt[1])
     remove_option(opt[0], opt[1])
 elif opt[0] in ('--debug', ):
     debug.set_debug_mode()
     remove_option(opt[0])
 elif opt[0] in ('--record', ):
     startupfiles.append(StartUpRecord(opt[1]))
     remove_option(opt[0], opt[1])
 elif opt[0] in ('--rerecord', ):
     startupfiles.append(StartUpRerecord(opt[1]))
     remove_option(opt[0], opt[1])
 elif opt[0] in ('--replay', ):
     startupfiles.append(StartUpReplay(opt[1]))
     remove_option(opt[0], opt[1])
 elif opt[0] in ('--replaydelay', ):
     replaydelay = opt[1]
     remove_option(opt[0], opt[1])
 elif opt[0] in ('--no-checkpoints', ):
     no_checkpoints = True
示例#5
0
文件: oof.py 项目: anilkunwar/OOF2
     startupfiles.append(StartUpScript(opt[1]))
     remove_option(opt[0],opt[1])
 elif opt[0] in ('--command',):
     startupfiles.append(StartUpCommand(opt[1]))
     remove_option(opt[0], opt[1])
 elif opt[0] in ('--image',):
     startupfiles.append(StartUpImage(opt[1]))
     remove_option(opt[0],opt[1])
 elif opt[0] in ('--data',):
     startupfiles.append(StartUpData(opt[1]))
     remove_option(opt[0],opt[1])
 elif opt[0] in ('--import',):
     startupimports.append(opt[1])
     remove_option(opt[0], opt[1])
 elif opt[0] in ('--debug',):
     debug.set_debug_mode()
     remove_option(opt[0])
 elif opt[0] in ('--record',):
     startupfiles.append(StartUpRecord(opt[1]))
     remove_option(opt[0], opt[1])
 elif opt[0] in ('--rerecord',):
     startupfiles.append(StartUpRerecord(opt[1]))
     remove_option(opt[0], opt[1])
 elif opt[0] in ('--replay',):
     startupfiles.append(StartUpReplay(opt[1]))
     remove_option(opt[0], opt[1])
 elif opt[0] in ('--replaydelay',):
     replaydelay = opt[1]
     remove_option(opt[0], opt[1])
 elif opt[0] in ('--no-checkpoints',):
     no_checkpoints = True