Changeset 730 for trunk/src/common.py
- Timestamp:
- 03/12/10 10:14:48 (2 years ago)
- Files:
-
- 1 modified
-
trunk/src/common.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/common.py
r720 r730 898 898 raise NotImplementedError() 899 899 900 def savePositions(self, filename, gather=True, compatible_output=True): 901 """ 902 Save positions to file. The output format is id x y z 903 """ 904 fmt = "%s\t%s\t%s\t%s\n" % ("%d", "%g", "%g", "%g") 905 lines = [] 906 for cell in self.all(): 907 x,y,z = cell.position 908 line = fmt % (cell, x, y, z) 909 lines.append(line) 910 if rank() == 0: 911 f = open(filename, 'w') 912 f.writelines(lines) 913 f.close() 914 900 915 # ============================================================================== 901 916
