/[escript]/trunk/escript/py_src/util.py
ViewVC logotype

Diff of /trunk/escript/py_src/util.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2598 by jfenwick, Mon Jul 20 06:43:47 2009 UTC revision 2599 by caltinay, Fri Aug 7 00:16:02 2009 UTC
# Line 203  def saveDX(filename,domain=None,**data): Line 203  def saveDX(filename,domain=None,**data):
203          raise ValueError,"saveDX: no domain detected."          raise ValueError,"saveDX: no domain detected."
204      domain.saveDX(filename,new_data)      domain.saveDX(filename,new_data)
205    
206  def saveESD(datasetName, dataDir=".", domain=None, timeStep=0, deltaT=1, **data):  def saveESD(datasetName, dataDir=".", domain=None, timeStep=0, deltaT=1, dynamicMesh=0, **data):
207      """      """
208      Saves L{Data} objects to files and creates an I{escript dataset} (ESD) file      Saves L{Data} objects to files and creates an I{escript dataset} (ESD) file
209      for convenient processing/visualisation.      for convenient processing/visualisation.
# Line 239  def saveESD(datasetName, dataDir=".", do Line 239  def saveESD(datasetName, dataDir=".", do
239      @type timeStep: L{int}      @type timeStep: L{int}
240      @param deltaT: timestep or sequence increment, see example above      @param deltaT: timestep or sequence increment, see example above
241      @type deltaT: L{int}      @type deltaT: L{int}
242        @param dynamicMesh: by default the mesh is assumed to be static and thus
243                            only saved once at timestep 0 to save disk space.
244                            Setting this to 1 changes the behaviour and the mesh
245                            is saved at each timestep.
246        @type dynamicMesh: L{int}
247      @keyword <name>: writes the assigned value to the file using <name> as      @keyword <name>: writes the assigned value to the file using <name> as
248                       identifier                       identifier
249      @type <name>: L{Data} object      @type <name>: L{Data} object
# Line 269  def saveESD(datasetName, dataDir=".", do Line 274  def saveESD(datasetName, dataDir=".", do
274          os.mkdir(dataDir)          os.mkdir(dataDir)
275    
276      meshFile = os.path.join(dataDir, datasetName+"_mesh")      meshFile = os.path.join(dataDir, datasetName+"_mesh")
277        fileNumber = timeStep / deltaT
278    
279      # later timesteps reuse mesh from t=0      if dynamicMesh == 0:
280      if timeStep == 0:          # later timesteps reuse mesh from t=0
281          domain.dump(meshFile + ".nc")          if timeStep == 0:
282                domain.dump(meshFile + ".nc")
283        else:
284            meshFile += ".%04d"
285            domain.dump((meshFile + ".nc") % fileNumber)
286    
287      outputString = ""      outputString = ""
     fileNumber = timeStep / deltaT  
288    
289      if domain.onMasterProcessor():      if domain.onMasterProcessor():
290          outputString += "#escript datafile V1.0\n"          outputString += "#escript datafile V1.0\n"

Legend:
Removed from v.2598  
changed lines
  Added in v.2599

  ViewVC Help
Powered by ViewVC 1.1.26