def write_data_file(self, file_name, process="global", output_flag=True): """ called by member function writeData to write numerics or parallelization data into a file :param file_name: (string) :param process: (string) used for solver, preconditioner, theta lists with flow, mass heat process :param output_flag: (bool) :return: """ try: file_stream = open(rootDirectory + "\\testingEnvironment\\scripts\\icbc\\temp\\" + file_name, "w") except OSError as err: message(mode="ERROR", text="OS error: {0}".format(err)) else: if output_flag: message(mode="INFO", text="Writing {} {}".format(location, file_name)) if file_name == "numerics_global_{}.py".format(getpid()): # file_stream.write('coupling_iterations_min = \'' + coupling_iterations_min + '\' \n') # file_stream.write('coupling_iterations_max = \'' + coupling_iterations_max + '\' \n') file_stream.write("flow_process = '{}' \n".format(self.__numerics_global.processes.flow)) file_stream.write("mass_flag = '{}' \n".format(bool2str(self.__numerics_global.processes.mass_flag))) file_stream.write("heat_flag = '{}' \n".format(bool2str(self.__numerics_global.processes.heat_flag))) file_stream.write( "deformation_flag = '{}' \n".format(bool2str(self.__numerics_global.processes.deformation_flag)) ) file_stream.write( "fluid_momentum_flag = '{}' \n".format( bool2str(self.__numerics_global.processes.fluid_momentum_flag) ) ) file_stream.write( "overland_flag = '{}' \n\n".format(bool2str(self.__numerics_global.processes.overland_flag)) ) file_stream.write("coupled_flag = '{}' \n".format(bool2str(self.__numerics_global.coupled_flag))) file_stream.write("lumping_flag = '{}' \n".format(bool2str(self.__numerics_global.lumping_flag))) file_stream.write("non_linear_flag = '{}' \n".format(bool2str(self.__numerics_global.non_linear_flag))) elif file_name == "processing_{}.py".format(getpid()): file_stream.write("number_cpus = '{}' \n".format(self.__processing.number_cpus)) file_stream.write("mode = '{}' \n".format(self.__processing.mode)) elif ( file_name == "numerics_flow_{}.py".format(getpid()) or file_name == "numerics_mass_{}.py".format(getpid()) or file_name == "numerics_heat_{}.py".format(getpid()) or file_name == "numerics_deformation_{}.py".format(getpid()) or file_name == "numerics_fluid_momentum_{}.py".format(getpid()) or file_name == "numerics_overland_{}.py".format(getpid()) ): # file_stream.write('maxIterations_linear = \'' + maxIterations_linear + '\' \n') # file_stream.write('maxIterations_nonlinear = \'' + maxIterations_nonlinear + '\' \n') # file_stream.write('norm = \'' + norm + '\' \n') # file_stream.write('tollerance_linear = \'' + tollerance_linear + '\' \n') # file_stream.write('tollerance_nonlinear = \'' + tollerance_nonlinear + '\' \n') file_stream.write("solver = '{}' \n".format(self.__solver_dir[process])) file_stream.write("precond = '{}'\n".format(self.__preconditioner_dir[process])) # file_stream.write('matrixStorage = \'sparse\'\n') # file_stream.write('numberOfGaussPoints = \'' + numberOfGaussPoints + '\'\n') file_stream.write("theta = '{}'\n".format(self.__theta_dir[process])) else: message(mode="ERROR", text="Wrong file name {}".format(file_name)) file_stream.close()
def show_hide_toolbar(self, param): '''Shows / hides main toolbar based on the checkbox value from preferences.''' self.mainToolbar.setVisible(param) self.settings.setValue("showToolbar", utilities.bool2str(param))
def buildDict(maxVolume, area, static): return { 'command': 'add_container', 'area': area, 'maxvolume': maxVolume, 'static': bool2str(static) }
def showHideToolbar(self, param): """Shows/hides main toolbar based on the checkbox value from preferences""" self.mainToolBar.setVisible(param) self.settings.setValue("showToolbar", utilities.bool2str(param))
def showHideToolbar(self, param): self.mainToolbar.setVisible(param) self.settings.setValue("showToolbar", utilities.bool2str(param))
def buildDict(forAll): return {'command': 'quit', 'global': bool2str(forAll)}