/[escript]/trunk/doc/examples/cookbook/example10c_0.py
ViewVC logotype

Diff of /trunk/doc/examples/cookbook/example10c_0.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3891 by gross, Fri Jan 14 00:04:01 2011 UTC revision 3892 by jfenwick, Tue Apr 10 08:57:23 2012 UTC
# Line 72  def setVerticalPositionsFromDip(layers, Line 72  def setVerticalPositionsFromDip(layers,
72    
73  def setBackLayers(layers, slop, dip):  def setBackLayers(layers, slop, dip):
74        if layers[0][3]-tan(slop)*length <=0:        if layers[0][3]-tan(slop)*length <=0:
75            raise ValueError,"negative thickness in %s at back"%(layers[0][0],)            raise ValueError("negative thickness in %s at back"%(layers[0][0],))
76        out=[[ layers[0][0], layers[0][3]-tan(slop)*length ]]        out=[[ layers[0][0], layers[0][3]-tan(slop)*length ]]
77        for i in range(1,len(layers)-1): out.append([layers[i][0], layers[i][3] ])        for i in range(1,len(layers)-1): out.append([layers[i][0], layers[i][3] ])
78        out.append([ layers[-1][0] ])        out.append([ layers[-1][0] ])
# Line 123  def addVolume(front_left, back_left, fro Line 123  def addVolume(front_left, back_left, fro
123          face_right=PlaneSurface(CurveLoop(front_right[i], front_to_back_right[i+1], -back_right[i], -front_to_back_right[i]))          face_right=PlaneSurface(CurveLoop(front_right[i], front_to_back_right[i+1], -back_right[i], -front_to_back_right[i]))
124                    
125          v=Volume(SurfaceLoop(topface,-face2, face_front, -face_back, -face_left, face_right))          v=Volume(SurfaceLoop(topface,-face2, face_front, -face_back, -face_left, face_right))
126          print v          print(v)
127          topface=face2          topface=face2
128          if filter_left:          if filter_left:
129              FF.append(face_right)              FF.append(face_right)
130          else:          else:
131              FF.append(-face_right)              FF.append(-face_right)
132          if not PS.has_key(name): PS[name]=PropertySet(name)          if name not in PS: PS[name]=PropertySet(name)
133          PS[name].addItem(v)          PS[name].addItem(v)
134      return out1, out2, PS, FF      return out1, out2, PS, FF
135            

Legend:
Removed from v.3891  
changed lines
  Added in v.3892

  ViewVC Help
Powered by ViewVC 1.1.26