def run(self): print 'visdaemon listening for files.' vs.launch_visit() self._db = self.track_dir + '/' + 'output*.vtk database' while True: #TODO: Generalize filename (output*.fvtk) new_files = [f for f in os.listdir(self.track_dir) if \ os.path.isfile(self.track_dir + '/' + f) and \ f[:6] == 'output' and \ f[-5:] == '.fvtk' and \ f not in self.processed] new_files.sort() if new_files: next_file = new_files.pop(0) print 'Translating file ' + next_file output_file = self.track_dir + '/' + \ next_file.split('.')[0] + '.vtk' translate_fvtk_to_vtk(self.track_dir + '/' + self._gridfile, \ self.track_dir + '/' + next_file, \ output_file, \ 'ccfd-iitm solver output') self.processed.append(next_file) if not self._database_open and len(self.processed) >= 2: vs.setup_visit(self.plot_variable_data, self._db) self._database_open = True vs.draw_plots() vs.time_slider_next_state() elif self._database_open: print 'Advancing...' vs.check_and_advance_state(self._db) time.sleep(0.1) vs.close_visit()
def visit_plot_mesh(db_name): vs.launch_visit() vs.draw_mesh(db_name) vs.draw_plots() t = raw_input('Any key to terminate')
# -------------------------------------------------------------------- # Usage: # Run this script directly as 'python visit_display_last_iteration.py' # # This script will open visit command line interface and show the last # state in the visit window # -------------------------------------------------------------------- import visitpostprocessing as vs plot_variable_data = vs.get_plot_variable_data() db_name = './output*.vtk database' vs.launch_visit() vs.setup_visit(plot_variable_data, db_name) vs.draw_plots() vs.set_to_last_state() t = raw_input('Any key to terminate')
# -------------------------------------------------------------------- # Usage: # Open visit by typing visit # Go to controls->Launch CLI # In the cli window, type 'execfile('visit_open_database_gui.py' # # This script will open the .vtk databse files and draw the required # plots. This script is used to save the time of opening a database, # adding a plot and displaying the plot. # # The difference between this script and the # visit_display_last_iteration.py fil # is that this is used in a visit # gui instance. Hence a visit control GUI window is also present. # -------------------------------------------------------------------- # import sys # sys.path.append("/usr/local/visit/current/linux-x86_64/lib/site-packages") # import visit import visitpostprocessing as vs plot_variable_data = vs.get_plot_variable_data() db_name = './output*.vtk database' vs.setup_visit(plot_variable_data, db_name) vs.draw_plots()