def addVessel(self, Id=None, dataDict=False): ''' adds vessel to the Network if no id, a random id is choosen if no DataDict, no values are assigned ''' # set id to 1 + highest id of existing vessels if Id == None: try: Id = max(self.vessels.keys()) + 1 except: Id = 0 # check Id if Id not in self.vessels: # create vessel with given variables vessel = Vessel(Id=Id, name=('vessel_' + str(Id))) # set vesselData if available if dataDict: vessel.updateDataDict(dataDict) # add vessel to network self.vessels[vessel.Id] = vessel # raise error if Id is set doubled else: raise ValueError( "vessel Id =%d exists already! Could not add vessel" % vessel.Id)
def __init__(self, vessel, batch, nPointsPerCircle, wallMovement, areaFactor, cLUT, quantityLUT, waveSplit): # init super class Vessel.__init__(self, vessel.Id, vessel.name) #pyglet.window.Screen.__init_(self,size) # apply all variables from super class instance to this class instance self.oldVessel = vessel self.update(vessel.getVariableDict()) self.initialize({}) self.quiet = True # new variables self.areaFactor = areaFactor self.wallMovement = wallMovement self.nPointsPerCircle = nPointsPerCircle self.cosSinZarray = 0 self.verticesInitial = 0 self.normalIndicesField = 0 self.vertexList = 0 self.vertexList2 = 0 self.batch = batch self.viewNormals = False # LUT self.cLUT = cLUT self.quantityLUT = quantityLUT self.waveSplit = waveSplit self.createWaveSplitSolutions() # functions self.createInitial3dVertice() self.waveSplitRange = {'Pressure': [[np.min(self.PsolF),np.max(self.PsolF)], [np.min(self.PsolB),np.max(self.PsolB)]], 'Flow': [[np.min(self.QsolF),np.max(self.QsolF)], [np.min(self.QsolB),np.max(self.QsolB)]]}
def addVessel(self, Id = None, dataDict = False): ''' adds vessel to the Network if no id, a random id is choosen if no DataDict, no values are assigned ''' # set id to 1 + highest id of existing vessels if Id == None: try: Id = max(self.vessels.keys())+1 except: Id = 0 # check Id if Id not in self.vessels: # create vessel with given variables vessel = Vessel(Id = Id , name = ('vessel_'+str(Id))) # set vesselData if available if dataDict: vessel.updateDataDict(dataDict) # add vessel to network self.vessels[vessel.Id] = vessel # raise error if Id is set doubled else: raise ValueError("vessel Id =%d exists already! Could not add vessel" %vessel.Id)