def set_single_property_value(self, mtr_id, property_name, new_value): """ set defined property to new value method is used by mesh tools common method for storativity and dual porosity """ if property_name == "porosity": new_value = solver_utils.round_porosity(new_value) else: new_value = solver_utils.round_storativity(new_value) self[mtr_id][property_name] = str(new_value) return str(new_value)
def multiply_single_property(self, mtr_id, property_name, multiplicator): """ multiply one single property used for storativity and porosity """ x_val = self[mtr_id] temp = float(x_val[property_name]) * float(multiplicator) if property_name == "porosity": x_val[property_name] = solver_utils.round_porosity(temp) elif property_name == "geometry_spec": x_val[property_name] = solver_utils.round_to_positive_zero(temp) else: x_val[property_name] = solver_utils.round_storativity(temp) return x_val[property_name]
def set_material_to_dict(self): ''' in selector is index of material try to get current form values and update data in memory ''' idx = str(self.selector_material.currentText()) try: material_object = self.window().material_dict[idx] material_object['type_spec'] = self.material_specific_val_to_list(material_object) material_object['geometry_type'] = self.non_empty_value(self.edit_geometry_type.text()) material_object['geometry_spec'] = self.non_empty_value(self.edit_geometry_coeficient.text()) material_object['storativity'] = solver_utils.round_storativity(self.edit_storativity.text()) material_object['dualporosity'] = solver_utils.round_porosity(self.editl_dual_porosity.text()) except KeyError: self.window().statusBar.showMessage('ERROR no save', 2000) except ValueError: self.window().statusBar.showMessage('ERROR - Form fields can not be empty!') else: self.window().statusBar.showMessage('MTR changes saved to Memory', 2000)
def set_dualporosity(self): '''sets the new value of dualporosity for selected elements''' new_value = solver_utils.round_porosity(self.edit_nvalue_porosity.text()) self.__set_property('dualporosity', new_value)