예제 #1
0
파일: presharpy.py 프로젝트: wong-hl/sharpy
    def __init__(self, in_settings=None):
        self._settings = True
        if in_settings is None:
            # call for documentation only
            self._settings = False

        self.ts = 0

        self.settings_types['log_file'] = 'str'
        self.settings_default['log_file'] = 'log'

        if self._settings:
            self.settings = in_settings
            self.settings['SHARPy']['flow'] = self.settings['SHARPy']['flow']

            settings.to_custom_types(self.settings['SHARPy'],
                                     self.settings_types,
                                     self.settings_default)

            cout.cout_wrap.initialise(self.settings['SHARPy']['write_screen'],
                                      self.settings['SHARPy']['write_log'],
                                      self.settings['SHARPy']['log_folder'],
                                      self.settings['SHARPy']['log_file'])

            self.case_route = in_settings['SHARPy']['route'] + '/'
            self.case_name = in_settings['SHARPy']['case']
            for solver_name in in_settings['SHARPy']['flow']:
                try:
                    dict_of_solvers[solver_name]
                except KeyError:
                    exceptions.NotImplementedSolver(solver_name)
예제 #2
0
파일: presharpy.py 프로젝트: ljnpu/sharpy-1
    def __init__(self, in_settings):
        self.ts = 0

        self.settings_types = dict()
        self.settings_default = dict()

        self.settings_types['flow'] = 'list(str)'
        self.settings_default['flow'] = None

        self.settings_types['case'] = 'str'
        self.settings_default['case'] = 'default_case_name'

        self.settings_types['route'] = 'str'
        self.settings_default['route'] = None

        self.settings_types['write_screen'] = 'bool'
        self.settings_default['write_screen'] = True

        self.settings_types['write_log'] = 'bool'
        self.settings_default['write_log'] = False

        self.settings_types['log_folder'] = 'str'
        self.settings_default['log_folder'] = ''

        self.settings_types['log_file'] = 'str'
        self.settings_default['log_file'] = 'log'

        self.settings = in_settings
        self.settings['SHARPy']['flow'] = self.settings['SHARPy']['flow']
        settings.to_custom_types(self.settings['SHARPy'], self.settings_types,
                                 self.settings_default)

        cout.cout_wrap.initialise(self.settings['SHARPy']['write_screen'],
                                  self.settings['SHARPy']['write_log'],
                                  self.settings['SHARPy']['log_folder'],
                                  self.settings['SHARPy']['log_file'])

        self.case_route = in_settings['SHARPy']['route'] + '/'
        self.case_name = in_settings['SHARPy']['case']
        for solver_name in in_settings['SHARPy']['flow']:
            try:
                dict_of_solvers[solver_name]
            except KeyError:
                exceptions.NotImplementedSolver(solver_name)