tadd functions to calculate coordination numbers - sphere - GPU-based 3D discrete element method algorithm with optional fluid coupling
 (HTM) git clone git://src.adamsgaard.dk/sphere
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 718127d5b6ce77aaade7ce88291cfbaad35dc1a0
 (DIR) parent 5d2500342b74ad102c08fcea14092dcea82d466e
 (HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
       Date:   Fri, 20 Feb 2015 15:50:50 +0100
       
       add functions to calculate coordination numbers
       
       Diffstat:
         M python/sphere.py                    |      21 +++++++++++++++++++++
       
       1 file changed, 21 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/python/sphere.py b/python/sphere.py
       t@@ -4453,6 +4453,27 @@ class sim:
                        dtype=numpy.int32)
                self.overlaps = numpy.array(contactdata[:,2])
        
       +    def findCoordinationNumber(self):
       +        '''
       +        Finds the coordination number (the average number of contacts per
       +        particle). Requires a previous call to :func:`findOverlaps()`. Values
       +        are stored in ``self.coordinationnumber``.
       +        '''
       +        self.coordinationnumber = numpy.zeros(self.np, dtype=numpy.int)
       +        for i in numpy.arange(self.overlaps.size):
       +            self.coordinationnumber[self.pairs[0,i]] += 1
       +            self.coordinationnumber[self.pairs[1,i]] += 1
       +
       +    def findMeanCoordinationNumber(self):
       +        '''
       +        Returns the coordination number (the average number of contacts per
       +        particle). Requires a previous call to :func:`findOverlaps()`
       +
       +        :returns: The mean particle coordination number
       +        :return type: float
       +        '''
       +        return numpy.mean(self.coordinationnumber)
       +
            def findNormalForces(self):
                '''
                Finds all particle-particle overlaps (by first calling