[cig-commits] r7916 - short/3D/PyLith/trunk/playpen/euler

willic3 at geodynamics.org willic3 at geodynamics.org
Thu Aug 30 13:35:05 PDT 2007


Author: willic3
Date: 2007-08-30 13:35:05 -0700 (Thu, 30 Aug 2007)
New Revision: 7916

Modified:
   short/3D/PyLith/trunk/playpen/euler/euler.py
Log:
Added coordinate ranges over which to apply rotations.


Modified: short/3D/PyLith/trunk/playpen/euler/euler.py
===================================================================
--- short/3D/PyLith/trunk/playpen/euler/euler.py	2007-08-30 17:26:46 UTC (rev 7915)
+++ short/3D/PyLith/trunk/playpen/euler/euler.py	2007-08-30 20:35:05 UTC (rev 7916)
@@ -97,7 +97,29 @@
     dipCutoff = pyre.inventory.dimensional("dip_cutoff", default=75.0*deg)
     dipCutoff.meta['tip'] = "Cutoff dip below which dip-slip movement is allowed."
 
+    xMin = pyre.inventory.dimensional("x_min", default=-1.0e6*m)
+    xMin.meta['tip'] = "Minimum x-value for which to apply rotation."
 
+    xMax = pyre.inventory.dimensional("x_max", default=1.0e6*m)
+    xMax.meta['tip'] = "Maximum x-value for which to apply rotation."
+
+    yMin = pyre.inventory.dimensional("y_min", default=-1.0e6*m)
+    yMin.meta['tip'] = "Minimum y-value for which to apply rotation."
+
+    yMax = pyre.inventory.dimensional("y_max", default=1.0e6*m)
+    yMax.meta['tip'] = "Maximum y-value for which to apply rotation."
+
+    zMin = pyre.inventory.dimensional("z_min", default=-1.0e6*m)
+    zMin.meta['tip'] = "Minimum z-value for which to apply rotation."
+
+    zMax = pyre.inventory.dimensional("z_max", default=1.0e6*m)
+    zMax.meta['tip'] = "Maximum z-value for which to apply rotation."
+
+    defaultValues = pyre.inventory.list("default_values",
+                                        default=[ 0.0, 0.0, 0.0])
+    defaultValues.meta['tip'] = "Values used for out-of-range points."
+
+
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def __init__(self, name="euler"):
@@ -143,6 +165,13 @@
     self.spaceDim = self.srcCoordSys.spaceDim
     self.dipSlip = self.inventory.dipSlip
     self.dipCutoff = self.inventory.dipCutoff
+    self.xMinVal = self.inventory.xMin.value
+    self.xMaxVal = self.inventory.xMax.value
+    self.yMinVal = self.inventory.yMin.value
+    self.yMaxVal = self.inventory.yMax.value
+    self.zMinVal = self.inventory.zMin.value
+    self.zMaxVal = self.inventory.zMax.value
+    self.defaultValues = self.inventory.defaultValues
 
     lat = self.eulerLat.value
     lon = self.eulerLon.value
@@ -205,11 +234,18 @@
                                                                 self.spaceDim)
     
     iCount = 0
+    velocity = [0.0, 0.0, 0.0]
     for point in range(self.numPoints):
-      velocity = self._euler2Velocity(pointsLL[point])
-      if self.bcType == 'dislocation':
-        vlocal = self._localTrans(velocity, normalsArr[point])
-        velocity = vlocal
+      inRange = self._testRange(self.pointsUTM[iCount:iCount+3])
+      if inRange:
+        velocity = self._euler2Velocity(pointsLL[point])
+        if self.bcType == 'dislocation':
+          vlocal = self._localTrans(velocity, normalsArr[point])
+          velocity = vlocal
+      else:
+        velocity[0] = self.defaultValues[0]
+        velocity[1] = self.defaultValues[1]
+        velocity[2] = self.defaultValues[2]
       for dim in range(self.spaceDim):
         f.write(' %15e' % self.pointsUTM[iCount + dim])
       for dim in range(self.dataDim):
@@ -219,6 +255,16 @@
     return
 
 
+  def _testRange(self, point):
+    """
+    Checks to see if point is in range.
+    """
+    inRange = point[0] >= self.xMinVal and point[0] <= self.xMaxVal and \
+              point[1] >= self.yMinVal and point[1] <= self.yMaxVal and \
+              point[2] >= self.zMinVal and point[2] <= self.zMaxVal
+    return inRange
+  
+
   def _localTrans(self, velocity, normalsArr):
     """
     Performs a transformation on velocity vector to local coords.



More information about the cig-commits mailing list