def create_common_task_files(self, dir_name):
     '''
     creates files common for both solution methods
     changed ini file in dir_name
     batch scripts
     task identifier
     '''
     ini_file = self.window().output_dir + dir_name + SEPARATOR + dir_name + '_ini.ini'
     self.window().flow_ini.create_changed_copy(ini_file, Material = \
                                    self.window().flow_ini.dict_files['Material'])
     batch.create_launcher_scripts(ini_file, self.local_launcher, self.cluster_launcher)
     solver_utils.create_task_identifier('basic', self.window().output_dir + dir_name)
 def solve_basic_problem(self):
     '''
     calls method from basic_problem module with correct data
     save all changes to material file
     creates launchers
     '''
     app.basic_problem.save_material(\
             self.output_dir, self.flow_ini.dict_files['Material'], self.material_dict)
     
     local_launcher, cluster_launcher = self.get_launchers()
     ini_name = self.output_dir + const.SEPARATOR + path.split(self.flow_ini.file_name)[1]
     batch.create_launcher_scripts(ini_name, local_launcher, cluster_launcher)
     
     self.statusBar.showMessage('All changes was saved to disk')
 def create_master_task(self):
     '''
     creates master tasks using solver_utils
     '''
     
     output_dir = self.window().output_dir + const.SEPARATOR + 'master'
     local_launcher, cluster_launcher = self.get_launchers()
     
     
     ini_name = output_dir + const.SEPARATOR + path.split(self.flow_ini.file_name)[1]
         
     app.helpers.solver_utils.copy_master_files(
                        self.flow_ini,
                        output_dir, const.SEPARATOR)
     app.helpers.solver_utils.create_task_identifier('basic', output_dir)
     
     #save last changes
     app.basic_problem.save_material(\
             output_dir, self.flow_ini.dict_files['Material'], self.material_dict)
     
     batch.create_launcher_scripts(ini_name, local_launcher, cluster_launcher)
 def save_monte_carlo_results(self):    
     '''
     save results from dict computed_conductivity_values if there are any
     '''
     
     if len(self.computed_conductivity_values) == 0:
         msg = "ERROR - nothing to save"           
         self.messenger(msg)
         return
     
     pocet = int(self.edit_monte_tasks.text())
     poc = len(str(pocet+1))
     
     local_launcher, cluster_launcher = self.window().get_launchers()
        
     for loop_nr in range(pocet):
         workcopy = copy.deepcopy(self.material)
         
         for mat in self.computed_conductivity_values.keys():
         
             workcopy[mat]['type_spec'] = []
             for direction_value in self.computed_conductivity_values[mat]:
                 
                 self.monte_logger.log_message(\
                       loop_nr, mat, workcopy[mat]['type_spec'], direction_value[loop_nr])
                 workcopy[mat]['type_spec'].append(direction_value[loop_nr])   
             
         
         for mat in self.computed_storativity_values.iterkeys():
             self.monte_logger.log_message(\
                   loop_nr, mat, workcopy[mat]['storativity'], self.computed_storativity_values[mat][loop_nr])
             workcopy[mat]['storativity'] = self.computed_storativity_values[mat][loop_nr]  
             
         for mat in self.computed_geometry_values.iterkeys():
             self.monte_logger.log_message(\
                   loop_nr, mat, workcopy[mat]['geometry_spec'], self.computed_geometry_values[mat][loop_nr])
             workcopy[mat]['geometry_spec'] = self.computed_geometry_values[mat][loop_nr]      
         
         for mat in self.computed_porosity_values.iterkeys():
             self.monte_logger.log_message(\
                   loop_nr, mat, workcopy[mat]['dualporosity'], self.computed_porosity_values[mat][loop_nr])
             workcopy[mat]['dualporosity'] = self.computed_porosity_values[mat][loop_nr]
             
         for mat in self.computed_sorption_values.iterkeys():
             for subst_nr in workcopy[mat]['sorption'].iterkeys():
                 workcopy[mat]['sorption'][subst_nr] = self.computed_sorption_values[mat][subst_nr][loop_nr]
         
         fdir = '{num:0{width}}'.format(num=loop_nr, width=poc+1)
         fname = self.window().output_dir + fdir + SEPARATOR +  self.window().flow_ini.dict_files['Material']
         
         workcopy.save_changes(fname)
         ffname = self.window().output_dir + fdir + SEPARATOR + fdir + '_ini.ini'
         self.window().flow_ini.create_changed_copy(ffname, Material = self.window().flow_ini.dict_files['Material'])
         
         batch.create_launcher_scripts(ffname, local_launcher, cluster_launcher)
         
         solver_utils.create_task_identifier('basic', self.window().output_dir + fdir)
         workcopy = {}  
     
     if self.window().centralWidget.tab_settings.launcher_check_hydra.isChecked():
         batch.create_cluster_batch(self.window().output_dir)
     
     #self.monte_logger.close()
     msg = "{} new tasks has been created".format(pocet)           
     self.messenger(msg)