当前位置: 首页>>代码示例>>Python>>正文


Python api.SimulationRoot类代码示例

本文整理汇总了Python中openmdao.main.api.SimulationRoot的典型用法代码示例。如果您正苦于以下问题:Python SimulationRoot类的具体用法?Python SimulationRoot怎么用?Python SimulationRoot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SimulationRoot类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

 def setUp(self):
     """ Called before each test in this class. """
     self.startdir = os.getcwd()
     self.tempdir = tempfile.mkdtemp(prefix='test_file-')
     os.chdir(self.tempdir)
     SimulationRoot.chroot(self.tempdir)
     self.model = set_as_top(Model())
开发者ID:ChanChiChoi,项目名称:OpenMDAO-Framework,代码行数:7,代码来源:test_file.py

示例2: setUp

    def setUp(self):
        # SimulationRoot is static and so some junk can be left
        # over from other tests when running under nose, so
        # set it to cwd here just to be safe
        SimulationRoot.chroot(os.getcwd())
        pcompmod._count = 0
        self.asm = set_as_top(Assembly())
        obj = self.asm.add('scomp1', SimpleComp())
        self.asm.add('scomp2', SimpleComp())
        self.asm.driver.workflow.add(['scomp1', 'scomp2'])

        with self.asm.dir_context:
            filename = 'top.data.vt'
            with open(filename, 'w') as out:
                out.write('vt data\n')
            obj.cont_in.data = FileRef(filename, self.asm)

            filename = 'top.data.vt2'
            with open(filename, 'w') as out:
                out.write('vt2 data\n')
            obj.cont_in.vt2.data = FileRef(filename, self.asm)

            filename = 'top.data.vt3'
            with open(filename, 'w') as out:
                out.write('vt3 data\n')
            obj.cont_in.vt2.vt3.data = FileRef(filename, self.asm)
开发者ID:TwanvdBorgh,项目名称:OpenMDAO-Framework,代码行数:26,代码来源:test_vartree.py

示例3: setUp

 def setUp(self):
     SimulationRoot.chroot(DIRECTORY)
     with open(INP_FILE, 'w') as out:
         out.write(INP_DATA)
     if os.path.exists(ENV_FILE):
         os.remove(ENV_FILE)
     dum = Assembly()  # create this here to prevent any Assemblies in tests to be 'first'
开发者ID:Daiyu506,项目名称:OpenMDAO-Framework,代码行数:7,代码来源:test_extcode.py

示例4: tearDown

    def tearDown(self):
        """ Called after each test in this class. """
        self.model.pre_delete()  # Paranoia.  Only needed by NPSS I think.
        self.model = None
        os.chdir(self.startdir)
        SimulationRoot.chroot(self.startdir)
        if not os.environ.get('OPENMDAO_KEEPDIRS', False):
            try:
                shutil.rmtree(self.tempdir)
            except OSError:
                pass

        # Not always added, but we need to ensure the egg is not in sys.path.
        egg_name = self.egg_name
        paths = sys.path

        if egg_name is not None:
            if sys.platform == "win32":
                egg_name = egg_name.lower()
                paths = [path.lower() for path in sys.path]

            for i, path in enumerate(paths):
                if path.endswith(egg_name) or egg_name in path:
                    del sys.path[i]
                    break
开发者ID:ChanChiChoi,项目名称:OpenMDAO-Framework,代码行数:25,代码来源:test_egg_save.py

示例5: tearDown

 def tearDown(self):
     os.chdir(self.startdir)
     SimulationRoot.chroot(self.startdir)
     if not os.environ.get('OPENMDAO_KEEPDIRS', False):
         try:
             shutil.rmtree(self.tempdir)
         except OSError:
             pass
开发者ID:ChanChiChoi,项目名称:OpenMDAO-Framework,代码行数:8,代码来源:test_vartree.py

示例6: tearDown

 def tearDown(self):
     """ Called after each test in this class. """
     os.chdir(self.startdir)
     SimulationRoot.chroot(self.startdir)
     if not os.environ.get('OPENMDAO_KEEPDIRS', False):
         try:
             shutil.rmtree(self.tempdir)
         except OSError:
             pass
开发者ID:ChanChiChoi,项目名称:OpenMDAO-Framework,代码行数:9,代码来源:test_file.py

示例7: tearDown

 def tearDown(self):
     GridEngineServer._QSUB[:] = self.orig_qsub
     GridEngineAllocator._QHOST[:] = self.orig_qhost
     os.chdir(self.startdir)
     SimulationRoot.chroot(self.startdir)
     if not os.environ.get('OPENMDAO_KEEPDIRS', False):
         try:
             shutil.rmtree(self.tempdir)
         except OSError:
             pass
开发者ID:ChanChiChoi,项目名称:OpenMDAO-Framework,代码行数:10,代码来源:test_gridengine.py

示例8: setUp

    def setUp(self):
        self.tempdir = tempfile.mkdtemp(prefix='test_pbs-')
        self.startdir = os.getcwd()
        os.chdir(self.tempdir)
        SimulationRoot.chroot(self.tempdir)

        # Force use of fake 'qsub'.
        self.orig_qsub = list(PBS_Server._QSUB)
        PBS_Server._QSUB[:] = \
            ['python', os.path.join(TestCase.directory, 'pbs_qsub.py')]
开发者ID:ChanChiChoi,项目名称:OpenMDAO-Framework,代码行数:10,代码来源:test_pbs.py

示例9: setUp

    def setUp(self):

        self.startdir = os.getcwd()
        self.tempdir = tempfile.mkdtemp(prefix='test_stl-')
        os.chdir(self.tempdir)
        SimulationRoot.chroot(self.tempdir)
        
        self.top = set_as_top(Assembly())
        self.top.add('plug_noz', PlugNozzleGeometry())
        self.top.driver.workflow.add('plug_noz')
        self.top.run()
开发者ID:ChanChiChoi,项目名称:OpenMDAO-Framework,代码行数:11,代码来源:test_stl_group_deriv.py

示例10: setUp

    def setUp(self):
        random.seed(10)
        numpy_random.seed(10)

        self.startdir = os.getcwd()
        self.tempdir = tempfile.mkdtemp(prefix='test_caseiter-')
        os.chdir(self.tempdir)
        SimulationRoot.chroot(self.tempdir)

        #os.chdir(self.directory)
        self.model = set_as_top(MyModel())
        self.generate_cases()
开发者ID:ChanChiChoi,项目名称:OpenMDAO-Framework,代码行数:12,代码来源:test_caseiterdriver.py

示例11: setUp

 def setUp(self):
     global TMPDIR
     self.startdir = os.getcwd()
     self.tempdir = tempfile.mkdtemp(prefix='test_extcode-')
     TMPDIR = self.tempdir
     os.chdir(self.tempdir)
     SimulationRoot.chroot(self.tempdir)
     shutil.copy(os.path.join(DIRECTORY, 'sleep.py'), 
                 os.path.join(self.tempdir, 'sleep.py'))
     with open(INP_FILE, 'w') as out:
         out.write(INP_DATA)
     dum = Assembly()  # create this here to prevent any Assemblies in tests to be 'first'
开发者ID:ChanChiChoi,项目名称:OpenMDAO-Framework,代码行数:12,代码来源:test_extcode.py

示例12: setUp

    def setUp(self):
        """ Called before each test in this class. """
        self.startdir = os.getcwd()
        self.tempdir = tempfile.mkdtemp(prefix='test_eggsave-')
        os.chdir(self.tempdir)
        SimulationRoot.chroot(self.tempdir)

        self.model = set_as_top(Model())
        self.model.name = 'Egg_TestModel'
        self.child_objs = [self.model.Source, self.model.Sink,
                           self.model.Oddball, self.model.Oddball.oddcomp,
                           self.model.Oddball.oddcont]
        self.egg_name = None
开发者ID:ChanChiChoi,项目名称:OpenMDAO-Framework,代码行数:13,代码来源:test_egg_save.py

示例13: tearDown

    def tearDown(self):
        for directory in ("a", "b"):
            if os.path.exists(directory):
                shutil.rmtree(directory)
        if os.path.exists("error.out"):
            try:
                os.remove("error.out")

            # Windows processes greedily clutch files. I see no
            # way to delete this file in test_timeout
            except WindowsError:
                pass

        SimulationRoot.chroot(ORIG_DIR)
开发者ID:neevor,项目名称:OpenMDAO-Framework,代码行数:14,代码来源:test_extcode.py

示例14: setUp

    def setUp(self):
        self.tempdir = tempfile.mkdtemp(prefix='test_ge-')
        self.startdir = os.getcwd()
        os.chdir(self.tempdir)
        SimulationRoot.chroot(self.tempdir)

        # Force use of fake 'qsub'.
        self.orig_qsub = list(GridEngineServer._QSUB)
        GridEngineServer._QSUB[:] = \
            ['python', os.path.join(TestCase.directory, 'ge_qsub.py')]

        # Force use of fake 'qhost'.
        self.orig_qhost = list(GridEngineAllocator._QHOST)
        GridEngineAllocator._QHOST[:] = \
            ['python', os.path.join(TestCase.directory, 'ge_qhost.py')]
开发者ID:ChanChiChoi,项目名称:OpenMDAO-Framework,代码行数:15,代码来源:test_gridengine.py

示例15: tearDown

    def tearDown(self):
        for directory in ('a', 'b'):
            if os.path.exists(directory):
                shutil.rmtree(directory, onerror=onerror)
        for name in (ENV_FILE, INP_FILE, 'input', 'output',
                     'sleep.in', 'sleep.out', 'sleep.err'):
            if os.path.exists(name):
                os.remove(name)
        if os.path.exists("error.out"):
            try:
                os.remove("error.out")

            # Windows processes greedily clutch files. I see no
            # way to delete this file in test_timeout
            except WindowsError:
                pass

        SimulationRoot.chroot(ORIG_DIR)
开发者ID:Daiyu506,项目名称:OpenMDAO-Framework,代码行数:18,代码来源:test_extcode.py


注:本文中的openmdao.main.api.SimulationRoot类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。