[cig-commits] r6333 - short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d

leif at geodynamics.org leif at geodynamics.org
Wed Mar 21 11:37:27 PDT 2007


Author: leif
Date: 2007-03-21 11:37:27 -0700 (Wed, 21 Mar 2007)
New Revision: 6333

Modified:
   short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/Pylith3d_scan.py
Log:
Avoid (r)partition, which is new in Python 2.5.


Modified: short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/Pylith3d_scan.py
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/Pylith3d_scan.py	2007-03-21 17:56:44 UTC (rev 6332)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/Pylith3d_scan.py	2007-03-21 18:37:27 UTC (rev 6333)
@@ -205,30 +205,18 @@
         self._tractionInputFile           = inputFile(Inventory.tractionInputFile,           required)
 
         # Create filenames for each process
-        self._asciiOutputFileSieve = \
-             self._asciiOutputFile.rpartition(".")[0]+ \
-             "."+str(self.rank)+"."+self._asciiOutputFile.rpartition(".")[2]
-        self._plotOutputFileSieve = \
-             self._plotOutputFile.rpartition(".")[0]+ \
-             "."+str(self.rank)+"."+self._plotOutputFile.rpartition(".")[2]
-        self._ucdOutputRootSieve = \
-             self._ucdOutputRoot.partition(".")[0]+ \
-             "."+str(self.rank)+self._ucdOutputRoot.partition(".")[2]
-        self._coordinateInputFileSieve = \
-             self._coordinateInputFile.rpartition(".")[0]+ \
-             "."+str(self.rank)+"."+self._coordinateInputFile.rpartition(".")[2]
-        self._connectivityInputFileSieve = \
-             self._connectivityInputFile.rpartition(".")[0]+ \
-             "."+str(self.rank)+"."+self._connectivityInputFile.rpartition(".")[2]
-        self._bcInputFileSieve = \
-             self._bcInputFile.rpartition(".")[0]+ \
-             "."+str(self.rank)+"."+self._bcInputFile.rpartition(".")[2]
-        self._splitNodeInputFileSieve = \
-             self._splitNodeInputFile.rpartition(".")[0]+ \
-             "."+str(self.rank)+"."+self._splitNodeInputFile.rpartition(".")[2]
-        self._tractionInputFileSieve = \
-             self._tractionInputFile.rpartition(".")[0]+ \
-             "."+str(self.rank)+"."+self._tractionInputFile.rpartition(".")[2]
+        for attr in ['_asciiOutputFile',
+                     '_plotOutputFile',
+                     '_ucdOutputRoot',
+                     '_coordinateInputFile',
+                     '_connectivityInputFile',
+                     '_bcInputFile',
+                     '_splitNodeInputFile',
+                     '_tractionInputFile']:
+            filename = getattr(self, attr)
+            s = filename.split('.')
+            sieveFilename = ".".join(s[0:1] + [str(self.rank)] + s[1:])
+            setattr(self, attr + 'Sieve', sieveFilename)
 
         uparser = pyre.units.parser()
         matinfo = Materials()



More information about the cig-commits mailing list