class Profile1: def __init__(self, cp_s, cp_p, p=3, pitch=0.0, height=0.0): self._p = p self._pitch = pitch self._height = height if height == 0.0 and pitch == 0.0: self._cp_s = cp_s self._cp_p = cp_p else: self._cp_s = self._redefCP(cp_s) self._cp_p = self._redefCP(cp_p) self._prof_s = Bspline(self._cp_s, p=p) self._prof_p = Bspline(self._cp_p, p=p) def _redefCP(self, cp): pitch, height = self._pitch, self._height cp_new = [] for i in xrange(len(cp)): cp_new.append(Point(cp[i].x, cp[i].y + pitch, cp[i].z + height)) return cp_new def getProfS(self, u): return self._prof_s(u) def getProfP(self, u): return self._prof_p(u) def plot(self): self._prof_s.plot() self._prof_p.plot()
class Corner(object): """ we define the needle to be inserted into the divergent part of the nozzle """ def __init__(self, needleDef): """ Constructor l-> lenght A-> inlet Area m-> inlet derivative ncp-> number of Control Point type -> stretching function """ self._needleDef = needleDef self._P = needleDef.getCPc() self._corner = Bspline(self._P, p = 2) def __call__(self, u): return self._corner(u) def plot(self): return self._corner.plot()
class Corner(object): """ we define the needle to be inserted into the divergent part of the nozzle """ def __init__(self, needleDef): """ Constructor l-> lenght A-> inlet Area m-> inlet derivative ncp-> number of Control Point type -> stretching function """ self._needleDef = needleDef self._P = needleDef.getCPc() self._corner = Bspline(self._P, p=2) def __call__(self, u): return self._corner(u) def plot(self): return self._corner.plot()
class NozzleComp: def __init__(self, cdDef, p = 3): self._cdDef = cdDef self._P = cdDef.getCP() self._p = p self._convDiv = Bspline(self._P, p = p) def __call__(self, u): return self._convDiv(u) def plot(self): self._convDiv.plot() def getCP(self): return self._P
class Profile1: def __init__(self, cp_s, cp_p, p = 3, pitch = 0.0, height = 0.0 ): self._p = p self._pitch = pitch self._height = height if height == 0.0 and pitch == 0.0: self._cp_s = cp_s self._cp_p = cp_p else: self._cp_s = self._redefCP(cp_s) self._cp_p = self._redefCP(cp_p) self._prof_s = Bspline(self._cp_s, p = p) self._prof_p = Bspline(self._cp_p, p = p) def _redefCP(self, cp): pitch, height = self._pitch, self._height cp_new = [] for i in xrange(len(cp)): cp_new.append(Point(cp[i].x, cp[i].y + pitch, cp[i].z + height)) return cp_new def getProfS(self, u): return self._prof_s(u) def getProfP(self, u): return self._prof_p(u) def plot(self): self._prof_s.plot() self._prof_p.plot()
class Camberline: def __init__(self, cambCP, p=2): self._cambCP = cambCP self._cambDef = cambCP.getCambDef() self._p = p self._camb = Bspline(cambCP(), p=p) self._derCamb = DerBspline(self._camb, kth=1) def getCamb(self, u): return self._camb(u) def getDerCamb(self, u): return self._derCamb(u) def getCambDef(self): return self._cambDef def plotCamb(self): self._camb.plot() def plotDerCamb(self): self._deramb.plot()
def plotLine(self): normalLine = self._normalLine for i in xrange(len(normalLine)): normalLine[i].plot() # class Camberline(object): # """ # classdocs # """ # # # def __init__(self, beta_in, beta_out, stugger): # # """ # Constructor # # """ if __name__ == '__main__': # prova = Angle(30.0) # print prova.getAngle() # print prova() # prova = CP_camberline() camb = Bspline(prova()) camb.plot() show()