Skip to content

Instantly share code, notes, and snippets.

@gcasey
Created February 10, 2015 23:22
Show Gist options
  • Save gcasey/576af9225ae5f85e6ae1 to your computer and use it in GitHub Desktop.
Save gcasey/576af9225ae5f85e6ae1 to your computer and use it in GitHub Desktop.
set timesteps for port
def setOutputTimesteps ( algorithm , timesteps ):
"helper routine to set timestep information"
executive = algorithm . GetExecutive ()
outInfo = executive . GetOutputInformation (0)
outInfo.Remove ( executive.TIME_STEPS () )
for timestep in timesteps :
outInfo . Append ( executive . TIME_STEPS () , timestep )
outInfo . Remove ( executive . TIME_RANGE () )
outInfo . Append ( executive . TIME_RANGE () , timesteps [0])
outInfo . Append ( executive . TIME_RANGE () , timesteps [ -1])
def getInputTimesteps( algorithm, portindex):
"helper routine to set timestep information"
executive = algorithm . GetExecutive ()
inInfo = executive . GetInputInformation (0, portindex)
return inInfo.Get(executive.TIME_STEPS())
myrange = getInputTimesteps(self, pcport)
setOutputTimesteps(self, myrange)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment