def PerFrameUpdate(datadescription): phactori.PerRendersetInitialization(datadescription) phactori.UpdateAllOperationsWhichMayChangeWithData() phactori.UpdateAllImagesetViewsWhichMayChangeWithData() #we are now updating color range stuff right before WriteImage #phactori.UpdateDataRangesForColorValues() phactori.myDebugPrint3('PerFrameUpdate entered\n') #GetAndReduceViewControl() global tearListPersistent global deathListPersistent global gDoNewScatterPlotsC if gDoNewScatterPlotsC: phactori.myDebugPrint3('doing phactori.UpdateAllScatterPlots (C)\n') phactori.UpdateAllScatterPlots() phactori.myDebugPrint3('doing phactori.UpdateAllPlotsOverTime\n') phactori.UpdateAllPlotsOverTime() phactori.myDebugPrint3('did plot updates\n') #currentFrameTearList = phactori.CollectCells1('TEAR_DOUBLE', 0.01, 1) #tearListPersistent = mergeCurrentIntoPersistent(tearListPersistent, # currentFrameTearList) #currentFrameDeathList = phactori.CollectCells1('STATUS', 0.8, -1) #deathListPersistent = mergeCurrentIntoPersistent(deathListPersistent, # currentFrameDeathList) #compareTearDeath(tearListPersistent, deathListPersistent) phactori.myDebugPrint3('PerFrameUpdate exiting\n')
def DoCoProcessingSub(datadescription): "Callback to do co-processing for current timestep" global gDoCoProcessingCount phactori.myDebugPrint3("PhactoriDriver.DoCoProcessingSub entered: " + str(gDoCoProcessingCount) + "\n") gDoCoProcessingCount += 1 fd = datadescription.GetUserData() if phactori.GetBypassUserDataFlag() == False: if fd == None: phactori.myDebugPrint2("no user data, returning {}\n") returnViewMapC = {} return returnViewMapC global coprocessor global gFirstTimeInDoCoProcessing global gSkipCountdown if gFirstTimeInDoCoProcessing == True: phactori.myDebugPrint2( "DoCoProcessing doing gFirstTimeInDoCoProcessing\n") phactori.myDebugPrint2(" skip countdown is " + str(gSkipCountdown) + "\n") if gSkipCountdown > 0: return coprocessor = CreateCoProcessor() coprocessor.EnableLiveVisualization(False) gFirstTimeInDoCoProcessing = False #import pdb #pdb.set_trace() phactori.InitializePerPipeRoot(datadescription, coprocessor) "Callback to do co-processing for current timestep" timestep = datadescription.GetTimeStep() phactori.myDebugPrint("timestep is: " + str(timestep) + "\n") phactori.SmartGetLocalProcessId() # Load the Pipeline if not created yet #if not pipeline: # phactori.myDebugPrint("PhactoriDriver.DoCoProcessing creating pipeline\n"); # pipeline = CreatePipeline(datadescription) #else: # phactori.myDebugPrint("PhactoriDriver.DoCoProcessing updating pipeline\n"); # # update to the new input and time # UpdateProducers(datadescription) # PerFrameUpdate(datadescription) # Update the coprocessor by providing it the newly generated simulation data. # If the pipeline hasn't been setup yet, this will setup the pipeline. coprocessor.UpdateProducers(datadescription) PerFrameUpdate(datadescription) # check for simulation-data-based i/o filtering--skip image creation # and writing if criteria has been set up to determine whether to # create images, such as 'maximum of variable X above 80.0' result = phactori.WriteOutImagesTest(datadescription, coprocessor) if result == False: #don't write images return # Write output data, if appropriate. #coprocessor.WriteData(datadescription); # Write output data #WriteAllData(datadescription, cp_writers, timestep); # Write image capture (Last arg: rescale lookup table) #phactori.myDebugPrint("PhactoriDriver.DoCoProcessing writing images\n"); #LocalWriteAllImages(datadescription, cp_views, timestep, False) #WriteAllImages(datadescription, cp_views, timestep, False) # Live Visualization #if (len(cp_views) == 0) and live_visu_active: # DoLiveInsitu(timestep, pv_host, pv_port) # Write output data, if appropriate. coprocessor.WriteData(datadescription) # Write image capture (Last arg: rescale lookup table), if appropriate. coprocessor.LocalWriteImages3(datadescription, rescale_lookuptable=False) #test and allow for looping when doing user vis interaction while #pausing simulation continueWriteAndInteractionCheckLoop = True while continueWriteAndInteractionCheckLoop: interactionTestResult = \ phactori.DoUserInteractionWithSimulationPausedIfEnabled() if interactionTestResult == 0: #looping interaction is not or is no longer on; allow simulation to #continue continueWriteAndInteractionCheckLoop = False elif interactionTestResult == 1: #looping interaction is on, but there were no changes to the vis #(i.e. no trigger was given to update vis). Therefore do not write #images, but continue looping and waiting for vis change trigger continueWriteAndInteractionCheckLoop = True elif interactionTestResult == 2: #there was a vis change triggered; update the images for the new #vis, write out the images, and continue looping continueWriteAndInteractionCheckLoop = True imagesNeedWriting = True if imagesNeedWriting: phactori.UpdateAllImagesetViewsWhichMayChangeWithData() coprocessor.LocalWriteImages3(datadescription, rescale_lookuptable=False) #coprocessor.WriteImages(datadescription, rescale_lookuptable=True) # Live Visualization, if enabled. coprocessor.DoLiveVisualization(datadescription, "localhost", 22222)