[cig-commits] [commit] master: py: Move global index generation into config. (08c9448)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Wed Jan 7 16:50:52 PST 2015


Repository : https://github.com/geodynamics/specfem1d

On branch  : master
Link       : https://github.com/geodynamics/specfem1d/compare/c63d455e0ff0075e43cb487147ab0bc101d4019c...81ba23d88e3baad884dd78c47c7581ffe856f7b2

>---------------------------------------------------------------

commit 08c9448c5753ea441aedc48834f8ac60e2360f12
Author: Elliott Sales de Andrade <quantum.analyst at gmail.com>
Date:   Wed Jan 7 04:38:55 2015 -0500

    py: Move global index generation into config.
    
    It's only used in this one file.


>---------------------------------------------------------------

08c9448c5753ea441aedc48834f8ac60e2360f12
 Python_version/config.py    | 12 +++++++++++-
 Python_version/functions.py | 10 ----------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/Python_version/config.py b/Python_version/config.py
index d2ae85b..d4b7a24 100644
--- a/Python_version/config.py
+++ b/Python_version/config.py
@@ -110,7 +110,7 @@ class Parameter(object):
         self.nGLL = self.N + 1              # Number of GLL points per elements
         self.nGLJ = self.NGLJ + 1           # Number of GLJ in the first element
         self.nGlob = (self.nSpec - 1) * self.N + self.NGLJ + 1  # Number of points in the array
-        self.ibool = functions.globalArray(self.nSpec, self.nGLL)  # Global array TODO add GLJ
+        self.ibool = self.make_global_index()  # TODO: add GLJ
         self.dt = 0                       # Time step (will be updated)
 
         # Gauss Lobatto Legendre points and integration weights :
@@ -133,6 +133,16 @@ class Parameter(object):
         self.deriv = gll.lagrange_derivative(self.ksiGLL)
         self.derivGLJ = gll.glj_derivative(self.ksiGLJ)
 
+    def make_global_index(self):
+        """Returns a matrix A. A[element_number,GLL_considered] -> index in the
+        global array, if we work in axisym and that the element number is 0 the points
+        are GLJ points"""
+        ibool = np.zeros((self.nSpec, self.nGLL), dtype='d')
+        for e in np.arange(self.nSpec):
+            for i in np.arange(self.nGLL):
+                ibool[e,i] = (self.nGLL - 1) * e + i
+        return ibool
+
 
 class Source(object):
     """Contains the source properties"""
diff --git a/Python_version/functions.py b/Python_version/functions.py
index 7034f29..6adced7 100644
--- a/Python_version/functions.py
+++ b/Python_version/functions.py
@@ -11,16 +11,6 @@ elements simulations.
 import numpy as np
 
 
-def globalArray(nSpec,nGLL):
-    """Returns a matrix A. A[element_number,GLL_considered] -> index in the
-    global array, if we work in axisym and that the element number is 0 the points
-    are GLJ points"""
-    ibool = np.zeros((nSpec,nGLL),dtype='d')
-    for e in np.arange(nSpec):
-        for i in np.arange(nGLL):
-            ibool[e,i] = (nGLL-1)*e+i
-    return ibool
-
 def estimateDt(grid,param):
     dzMin=(grid.z[1:]-grid.z[:len(grid.z)-1]).min()
     dh=param.length/(len(grid.z)-1)



More information about the CIG-COMMITS mailing list