import math #============================================ class BasicCache( ): # the constructor def __init__( self ): self.data = [ ] # Super classes will assign test to this item self.dataStr = '' # Ditto for the path to where the dataStr will # be written self.dataPath = '' #--> reinitializes the variables so future runs are not corrupted def reset(self): self.data = [ ] self.dataStr = '' #-->adds all particles together def add( self, xyz ): self.data.append(xyz) #-->adds particles and their positions #-->individually so that each curve #-->follows one particle's path def addIndiv(self, index, pos): if len(self.data) > index: xyz = pos[0:3] self.data[index].append(xyz[0]) self.data[index].append(xyz[1]) self.data[index].append(xyz[2]) else: self.data.append(pos[0:3]) def get( self ): return self.data #-->specific to individual particle code def getIndiv(self, index): return self.data[index] def length(self): return len(self.data) #-->sets the data path to the current #-->project and scene def setDataPath(self, fullpath): self.dataPath = fullpath print("set path = %s" % self.dataPath) #-->prints a file based on the information #-->gathered from the particle cache def writeToFile(self): print("write path = %s" % self.dataPath) fileid = open(self.dataPath, 'w') fileid.write(self.dataStr) fileid.close() return self.dataPath