def loop_inner(self, operation_inst, item_type, item_case, item_configuration): """ 1. generate (and delete) item instance 2. call write files (for numerics, processing) 3. call operation run function :param operation_inst: (class Building, Simulating, or Plotting) :param item_type: (string) :param item_case: (string) :param item_configuration: (string) :return: """ for index, flow_process_name in enumerate(self.__flow_process_name_list): for element_type_name in self.__element_type_name_list[index]: # take all for remote, building or plotting if location == 'remote' or operation_inst.selected_operation_type == 'b' or \ operation_inst.selected_operation_type == 'p' or\ (str2bool(self.__setting_inst.query_column_entry_for_name( 'flow_processes', flow_process_name, 'active')) and str2bool(self.__setting_inst.query_column_entry_for_name( 'element_types', element_type_name, 'active'))): item_inst = self.generate_item_instance( operation_inst, item_type, item_case, item_configuration, flow_process_name, element_type_name) operation_inst.set_numerics_and_processing_data(item_type, item_case, item_configuration, flow_process_name, element_type_name, self.__setting_inst, self.__subject_inst.location) operation_inst.run(item_inst) del item_inst
def __init__(self, parent = None): super(Main, self).__init__(parent) self.setupUi(self) logger.debug("Application initialized") # create table in database self.dbCursor = self.dbConn.cursor() self.dbCursor.execute('''CREATE TABLE IF NOT EXISTS Main(id INTEGER\ PRIMARY KEY, username TEXT, name TEXT, phone TEXT, address INTEGER, \ status TEXT)''') # save changes to database self.dbConn.commit() # save settings to file self.settings = QSettings(QSettings.IniFormat, QSettings.UserScope, 'PyDataManager', 'PyDataManager') self.addData.clicked.connect(self.add_button_clicked) self.removeRow.clicked.connect(self.remove_row_clicked) self.actionExport.triggered.connect(self.export_action_triggered) self.actionPreferences.triggered.connect(self.preferences_action_triggered) self.actionExit.triggered.connect(self.exit_action_triggered) self.showToolbar = utilities.str2bool(self.settings.value( "showToolbar", True)) self.mainToolbar.setVisible(self.showToolbar) self.load_initial_settings()
def __init__(self, parent=None): super(Main, self).__init__(parent) self.setupUi(self) self.dbCursor = self.dbConn.cursor() self.dbCursor.execute("""CREATE TABLE IF NOT EXISTS Main(id INTEGER PRIMARY KEY, username TEXT, name TEXT, phone TEXT, address TEXT, status TEXT)""") self.dbConn.commit() self.settings = QSettings(QSettings.IniFormat, QSettings.UserScope, "PyDataMan", "PyDataMan") self.addData.clicked.connect(self.add_button_clicked) self.removeRow.clicked.connect(self.removed_row_clicked) menu = self.menuBar() menu.setNativeMenuBar(False) self.actionExport.triggered.connect(self.export_action_triggered) self.actionImport.triggered.connect(self.import_action_triggered) self.actionPreferences.triggered.connect(self.preferences_action_triggered) self.actionExit.triggered.connect(self.exit_action_triggered) self.showToolbar = utilities.str2bool(self.settings.value("showToolbar", True)) self.mainToolbar.setVisible(self.showToolbar) self.load_initial_settings()
def set_numerics_data(self, sim_data, item_case, item_configuration, flow_process_name, element_type_name): """ get mumerics and parallelization data from database and store in sim_data data are used later on to write *.num *.pbs files :param sim_data: (class SimulationData) :param item_case: (string) :param item_configuration: (string) :param flow_process_name: (string) :param element_type_name: (string) :return: """ # numerics global case_id = self.__gateToDatabase.query_id_for_name('cases', item_case) sim_data.numerics_global.processes.flow = flow_process_name sim_data.numerics_global.processes.mass_flag = str2bool(self.__gateToDatabase.query_column_entry( 'cases', case_id, 'mass_flag')) sim_data.numerics_global.processes.heat_flag = str2bool(self.__gateToDatabase.query_column_entry( 'cases', case_id, 'heat_flag')) sim_data.numerics_global.processes.deformation_flag = str2bool(self.__gateToDatabase.query_column_entry( 'cases', case_id, 'deformation_flag')) sim_data.numerics_global.processes.fluid_momentum_flag = str2bool(self.__gateToDatabase.query_column_entry( 'cases', case_id, 'fluid_momentum_flag')) sim_data.numerics_global.processes.overland_flag = str2bool(self.__gateToDatabase.query_column_entry( 'cases', case_id, 'overland_flag')) sim_data.numerics_global.coupled_flag = str2bool(self.__gateToDatabase.query_column_entry( 'cases', case_id, 'coupled_flag')) sim_data.numerics_global.lumping_flag = str2bool(self.__gateToDatabase.query_column_entry( 'numerics', self.__gateToDatabase.query_id_from_numerics_table( item_case, flow_process_name, element_type_name), 'flow_lumping_flag')) sim_data.numerics_global.non_linear_flag = str2bool(self.__gateToDatabase.query_column_entry( 'flow_processes', self.__gateToDatabase.query_id_for_name( 'flow_processes', flow_process_name), 'nonlinear_flag')) # solver, preconditioner, theta self.set_numerics_directories(sim_data, item_case, item_configuration, flow_process_name, element_type_name, 'flow') if sim_data.numerics_global.processes.mass_flag: self.set_numerics_directories(sim_data, item_case, item_configuration, flow_process_name, element_type_name, 'mass') if sim_data.numerics_global.processes.heat_flag: self.set_numerics_directories(sim_data, item_case, item_configuration, flow_process_name, element_type_name, 'heat') if sim_data.numerics_global.processes.deformation_flag: self.set_numerics_directories(sim_data, item_case, item_configuration, flow_process_name, element_type_name, 'deformation') if sim_data.numerics_global.processes.fluid_momentum_flag: self.set_numerics_directories(sim_data, item_case, item_configuration, flow_process_name, element_type_name, 'fluid_momentum') if sim_data.numerics_global.processes.overland_flag: self.set_numerics_directories(sim_data, item_case, item_configuration, flow_process_name, element_type_name, 'overland_flow')
def get_num_data_for_process(self, process_name, id_local_process, directory_temp): module = __import__("numerics_{}_{}".format(process_name, id_local_process)) if process_name == "global": self.__numerics_global.coupled_flag = str2bool(module.coupled_flag) self.__numerics_global.lumping_flag = str2bool(module.lumping_flag) self.__numerics_global.non_linear_flag = str2bool(module.non_linear_flag) self.__numerics_global.processes.flow = module.flow_process self.__numerics_global.processes.mass_flag = str2bool(module.mass_flag) self.__numerics_global.processes.heat_flag = str2bool(module.heat_flag) self.__numerics_global.processes.deformation_flag = str2bool(module.deformation_flag) self.__numerics_global.processes.fluid_momentum_flag = str2bool(module.fluid_momentum_flag) self.__numerics_global.processes.overland_flag = str2bool(module.overland_flag) print("def: " + str(self.__numerics_global.processes.deformation_flag)) else: self.__solver_dir[process_name] = module.solver self.__preconditioner_dir[process_name] = module.precond self.__theta_dir[process_name] = module.theta remove_file("{}numerics_{}_{}.py".format(directory_temp, process_name, id_local_process), False) try: # remove byte code if it exists remove_file(directory_temp + "numerics_{}_{}.pyc".format(process_name, id_local_process), False) except: pass
def __init__(self, parent=None): super(Main, self).__init__(parent) self.setupUi(self) self.dbCursor = self.dbConn.cursor() self.dbCursor.execute("""CREATE TABLE IF NOT EXISTS Main(id INTEGER PRIMARY KEY, username TEXT, name TEXT, phone TEXT, address TEXT, status TEXT)""") self.dbConn.commit() self.settings = QSettings(QSettings.IniFormat, QSettings.UserScope, "PyDataMan", "PyDataMan") self.addData.clicked.connect(self.add_button_clicked) self.removeRow.clicked.connect(self.remove_row_clicked) self.actionExport.triggered.connect(self.export_action_triggered) self.actionPreferences.triggered.connect(self.preferences_action_triggered) self.actionExit.triggered.connect(self.exit_action_triggered) self.showToolbar = utilities.str2bool(self.settings.value("showToolbar", True)) self.mainToolBar.setVisible(self.showToolbar) self.load_initial_settings()
def __init__(self, packageDict, simulator): super(AddContainerCommand, self).__init__(packageDict, simulator) self.maxVolume = float(packageDict['maxvolume']) self.area = float(packageDict['area']) self.static = ('static' in packageDict) and str2bool( packageDict['static'])
def __init__(self, packageDict, simulator): super(QuitCommand, self).__init__(packageDict, simulator) self.globalAction = ('global' in packageDict) and str2bool( packageDict['global'])