[cig-commits] r7924 - short/3D/PyLith/trunk/playpen/euler
willic3 at geodynamics.org
willic3 at geodynamics.org
Tue Sep 4 11:58:14 PDT 2007
Author: willic3
Date: 2007-09-04 11:58:13 -0700 (Tue, 04 Sep 2007)
New Revision: 7924
Modified:
short/3D/PyLith/trunk/playpen/euler/euler.py
short/3D/PyLith/trunk/playpen/euler/grabpoints.py
Log:
Fixed indexing bug in grabpoints and added option to output vertex #.
Increased output precision for both codes.
Modified: short/3D/PyLith/trunk/playpen/euler/euler.py
===================================================================
--- short/3D/PyLith/trunk/playpen/euler/euler.py 2007-08-31 22:50:35 UTC (rev 7923)
+++ short/3D/PyLith/trunk/playpen/euler/euler.py 2007-09-04 18:58:13 UTC (rev 7924)
@@ -255,9 +255,9 @@
velocity[1] = self.defaultValues[1]
velocity[2] = self.defaultValues[2]
for dim in range(self.spaceDim):
- f.write(' %15e' % self.pointsUTM[iCount + dim])
+ f.write(' %.12e' % self.pointsUTM[iCount + dim])
for dim in range(self.dataDim):
- f.write(' %15e' % velocity[dim])
+ f.write(' %.12e' % velocity[dim])
f.write('\n')
iCount += 3
return
Modified: short/3D/PyLith/trunk/playpen/euler/grabpoints.py
===================================================================
--- short/3D/PyLith/trunk/playpen/euler/grabpoints.py 2007-08-31 22:50:35 UTC (rev 7923)
+++ short/3D/PyLith/trunk/playpen/euler/grabpoints.py 2007-09-04 18:58:13 UTC (rev 7924)
@@ -58,7 +58,10 @@
valuesList = pyre.inventory.list("values_list", default=[1, 2, 3])
valuesList.meta['tip'] = "Position of desired values in UCD attributes."
+ outputIndex = pyre.inventory.bool("output_index", default=False)
+ outputIndex.meta['tip'] = "Whether to output vertex indices."
+
# PUBLIC METHODS /////////////////////////////////////////////////////
def __init__(self, name="grabpoints"):
@@ -70,8 +73,8 @@
def main(self):
- import pdb
- pdb.set_trace()
+ # import pdb
+ # pdb.set_trace()
self._readPset()
self._grabPoints()
return
@@ -88,6 +91,7 @@
self.ucdFile = self.inventory.ucdFile
self.pointOutputFile = self.inventory.pointOutputFile
self.valuesList = self.inventory.valuesList
+ self.outputIndex = self.inventory.outputIndex
return
@@ -111,7 +115,7 @@
def _grabPoints(self):
"""
- Reads vertex indices from a pset file.
+ Reads vertex coordinates and vertex attributes from a UCD file.
"""
f = file(self.ucdFile)
lines = f.readlines()
@@ -130,6 +134,7 @@
for dim in range(1,4):
self.pointCoords.append(float(data[dim]))
vertInd += 1
+ vertInd = min([vertInd, len(self.indices) - 1])
ucdInd += 1
# Skip elements and then start reading normals/values and write out
@@ -151,16 +156,20 @@
data = lines[lineCount].split()
normals = [float(data[v0]), float(data[v1]), float(data[v2])]
+ if self.outputIndex:
+ o.write(' %i' % vertex)
+
for dim in range(3):
- o.write(' %15e' % self.pointCoords[coordCount + dim])
+ o.write(' %.12e' % self.pointCoords[coordCount + dim])
for dim in range(3):
- o.write(' %15e' % normals[dim])
+ o.write(' %.12e' % normals[dim])
o.write('\n')
vertInd += 1
coordCount += 3
+ if vertInd == len(self.indices): break
ucdInd += 1
f.close()
More information about the cig-commits
mailing list