tAdded legacy read mode for old data files - 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 5f80feadeeb6d2409daf56d63ee53a442b82e44f
 (DIR) parent 0ae0f4649f84b60f1d8f195594629b346ca4f7af
 (HTM) Author: Anders Damsgaard <adc@geo.au.dk>
       Date:   Tue, 12 Mar 2013 22:09:14 +0100
       
       Added legacy read mode for old data files
       
       Diffstat:
         M python/sphere.py                    |      37 ++++++++++++++++---------------
       
       1 file changed, 19 insertions(+), 18 deletions(-)
       ---
 (DIR) diff --git a/python/sphere.py b/python/sphere.py
       t@@ -179,7 +179,7 @@ class Spherebin:
        
        
        
       -    def readbin(self, targetbin, verbose = True):
       +    def readbin(self, targetbin, verbose = True, bonds = True):
                'Reads a target SPHERE binary file'
        
                fh = None
       t@@ -286,23 +286,24 @@ class Spherebin:
                        self.w_force[i] = numpy.fromfile(fh, dtype=numpy.float64, count=1)
                        self.w_devs[i]  = numpy.fromfile(fh, dtype=numpy.float64, count=1)
        
       -            # Inter-particle bonds
       -            self.lambda_bar = numpy.fromfile(fh, dtype=numpy.float64, count=1)
       -            self.nb0 = numpy.fromfile(fh, dtype=numpy.uint32, count=1)
       -            self.sigma_b = numpy.fromfile(fh, dtype=numpy.float64, count=1)
       -            self.tau_b = numpy.fromfile(fh, dtype=numpy.float64, count=1)
       -            self.bonds = numpy.zeros((self.nb0, 2), dtype=numpy.uint32)
       -            for i in range(self.nb0):
       -                self.bonds[i,0] = numpy.fromfile(fh, dtype=numpy.uint32, count=1)
       -                self.bonds[i,1] = numpy.fromfile(fh, dtype=numpy.uint32, count=1)
       -            #self.bonds_delta_n = numpy.zeros(self.nb0, dtype=numpy.float64)
       -            #self.bonds_delta_t = numpy.zeros((self.nb0, seld.nd), dtype=numpy.float64)
       -            #self.bonds_omega_n = numpy.zeros(self.nb0, dtype=numpy.float64)
       -            #self.bonds_omega_t = numpy.zeros((self.nb0, seld.nd), dtype=numpy.float64)
       -            self.bonds_delta_n = numpy.fromfile(fh, dtype=numpy.float64, count=self.nb0)
       -            self.bonds_delta_t = numpy.fromfile(fh, dtype=numpy.float64, count=self.nb0*self.nd).reshape(self.nb0*self.nd)
       -            self.bonds_omega_n = numpy.fromfile(fh, dtype=numpy.float64, count=self.nb0)
       -            self.bonds_omega_t = numpy.fromfile(fh, dtype=numpy.float64, count=self.nb0*self.nd).reshape(self.nb0*self.nd)
       +            if (bonds == True):
       +                # Inter-particle bonds
       +                self.lambda_bar = numpy.fromfile(fh, dtype=numpy.float64, count=1)
       +                self.nb0 = numpy.fromfile(fh, dtype=numpy.uint32, count=1)
       +                self.sigma_b = numpy.fromfile(fh, dtype=numpy.float64, count=1)
       +                self.tau_b = numpy.fromfile(fh, dtype=numpy.float64, count=1)
       +                self.bonds = numpy.zeros((self.nb0, 2), dtype=numpy.uint32)
       +                for i in range(self.nb0):
       +                    self.bonds[i,0] = numpy.fromfile(fh, dtype=numpy.uint32, count=1)
       +                    self.bonds[i,1] = numpy.fromfile(fh, dtype=numpy.uint32, count=1)
       +                #self.bonds_delta_n = numpy.zeros(self.nb0, dtype=numpy.float64)
       +                #self.bonds_delta_t = numpy.zeros((self.nb0, seld.nd), dtype=numpy.float64)
       +                #self.bonds_omega_n = numpy.zeros(self.nb0, dtype=numpy.float64)
       +                #self.bonds_omega_t = numpy.zeros((self.nb0, seld.nd), dtype=numpy.float64)
       +                self.bonds_delta_n = numpy.fromfile(fh, dtype=numpy.float64, count=self.nb0)
       +                self.bonds_delta_t = numpy.fromfile(fh, dtype=numpy.float64, count=self.nb0*self.nd).reshape(self.nb0*self.nd)
       +                self.bonds_omega_n = numpy.fromfile(fh, dtype=numpy.float64, count=self.nb0)
       +                self.bonds_omega_t = numpy.fromfile(fh, dtype=numpy.float64, count=self.nb0*self.nd).reshape(self.nb0*self.nd)
        
                finally:
                    if fh is not None: