def _run(self): """ Start the simulation. """ self.execConfig.parameterStore.addObj(self) for cellType in self.cellTypes: self.execConfig.parameterStore.addObj(cellType) CompuCellSetup.setSimulationXMLDescription(self._configureSimulation()) CompuCellSetup.initializeSimulationObjects(self.sim, self.simthread) pyAttributeDictionaryAdder, dictAdder = CompuCellSetup.attachDictionaryToCells(self.sim) # Add Python steppables here: steppableRegistry = CompuCellSetup.getSteppableRegistry() for steppable in self._getSteppables(): steppableRegistry.registerSteppable(steppable) CompuCellSetup.mainLoop(self.sim, self.simthread, steppableRegistry)
#PUT YOUR CODE HERE #PUT YOUR CODE HERE #PUT YOUR CODE HERE import XMLUtils steppableList=CompuCellSetup.cc3dXML2ObjConverter.root.getElements("Plugin") steppableListPy=XMLUtils.CC3DXMLListPy(steppableList) for element in steppableListPy: print "Element",element.name # ," name", element.getNumberOfChildren() CompuCellSetup.initializeSimulationObjects(sim,simthread) steppableRegistry=CompuCellSetup.getSteppableRegistry() #Add Python steppables here #PUT YOUR CODE HERE #PUT YOUR CODE HERE #PUT YOUR CODE HERE # sim.ps.steppableCC3DXMLElementVector() CompuCellSetup.mainLoop(sim,simthread,steppableRegistry)#main loop - simulation is invoked inside this function
import sys from os import environ from os import getcwd import string ## sys.path.append(environ["PYTHON_MODULE_PATH"]) import CompuCellSetup # Initialize core CompuCell3D simulation objects sim, simthread = CompuCellSetup.getCoreSimulationObjects() CompuCellSetup.initializeSimulationObjects(sim,simthread) from OscillatingContactEnergiesSteppables import * # Create instances of required steppables oscillatingContactEnergiesSteppable = OscillatingContactEnergiesSteppable( sim ) # Add steppables to the steppable registry steppableRegistry = CompuCellSetup.getSteppableRegistry() steppableRegistry.registerSteppable( oscillatingContactEnergiesSteppable ) CompuCellSetup.mainLoop(sim, simthread, steppableRegistry)
CompuCellSetup.initializeSimulationObjects(sim,simthread) steppableRegistry = CompuCellSetup.getSteppableRegistry() from TissueInvasionSteppables import ConstraintInitializerSteppable ConstraintInitializerSteppableInstance = ConstraintInitializerSteppable(sim,_frequency=1) steppableRegistry.registerSteppable(ConstraintInitializerSteppableInstance) from TissueInvasionSteppables import GrowthSteppable GrowthSteppableInstance = GrowthSteppable(sim,_frequency=1) steppableRegistry.registerSteppable(GrowthSteppableInstance) from TissueInvasionSteppables import MitosisSteppable MitosisSteppableInstance = MitosisSteppable(sim,_frequency=1) steppableRegistry.registerSteppable(MitosisSteppableInstance) from TissueInvasionSteppables import DeathSteppable DeathSteppableInstance = DeathSteppable(sim,_frequency=1) steppableRegistry.registerSteppable(DeathSteppableInstance) from TissueInvasionSteppables import ExtraPlotSteppable ExtraPlotSteppableInstance = ExtraPlotSteppable(sim,_frequency=1) steppableRegistry.registerSteppable(ExtraPlotSteppableInstance) from TissueInvasionSteppables import XMLDataSteppable XMLDataSteppableInstance = XMLDataSteppable(sim,_frequency=1) steppableRegistry.registerSteppable(XMLDataSteppableInstance) CompuCellSetup.mainLoop(sim,simthread,steppableRegistry)
# for single run simulation we copy simulation files to the output directory if singleSimulation: cc3dSimulationDataHandler.copySimulationDataFiles( CompuCellSetup.screenshotDirectoryName) if CompuCellSetup.simulationPaths.simulationPythonScriptName != "": execfile(CompuCellSetup.simulationPaths.simulationPythonScriptName) else: sim, simthread = CompuCellSetup.getCoreSimulationObjects() # CompuCellSetup.cmlFieldHandler.outputFrequency=cmlParser.outputFrequency import CompuCell #notice importing CompuCell to main script has to be done after call to getCoreSimulationObjects() #import CompuCellSetup CompuCellSetup.initializeSimulationObjects(sim, simthread) steppableRegistry = CompuCellSetup.getSteppableRegistry() CompuCellSetup.mainLoop( sim, simthread, steppableRegistry ) # main loop - simulation is invoked inside this function sim.cleanAfterSimulation() sim = None print 'FINISHED MAIN LOOP' # if not allowRelanuch: # break # jumping out of the loop when running single simulation. Will stay in the loop for e.g. parameter scan if singleSimulation: break else: consecutiveRunCounter += 1 if consecutiveRunCounter >= maxNumberOfConsecutiveRuns: relaunch = True
import sys from os import environ from os import getcwd import string sys.path.append(environ["PYTHON_MODULE_PATH"]) import CompuCellSetup sim,simthread = CompuCellSetup.getCoreSimulationObjects() # add extra attributes here pyAttributeDictionaryAdder,dictAdder=CompuCellSetup.attachDictionaryToCells(sim) CompuCellSetup.initializeSimulationObjects(sim,simthread) # Definitions of additional Python-managed fields go here #Add Python steppables here steppableRegistry=CompuCellSetup.getSteppableRegistry() from bistabSwitch2Steppables import EMT_switch1Steppable steppableInstance=EMT_switch1Steppable(sim,_frequency=100) steppableRegistry.registerSteppable(steppableInstance) CompuCellSetup.mainLoop(sim,simthread,steppableRegistry)