/[escript]/trunk/pycad/py_src/gmsh.py
ViewVC logotype

Diff of /trunk/pycad/py_src/gmsh.py

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

revision 5391 by caltinay, Tue Dec 16 01:33:35 2014 UTC revision 5392 by caltinay, Tue Dec 16 07:01:26 2014 UTC
# Line 45  from .transformations import DEG Line 45  from .transformations import DEG
45  class Design(design.AbstractDesign):  class Design(design.AbstractDesign):
46      """      """
47      Design for gmsh.      Design for gmsh.
   
48      """      """
49      DELAUNAY="Delauny"      DELAUNAY="Delauny"
50      MESHADAPT="MeshAdapt"      MESHADAPT="MeshAdapt"
# Line 53  class Design(design.AbstractDesign): Line 52  class Design(design.AbstractDesign):
52      NETGEN="Frontal"      NETGEN="Frontal"
53      TETGEN="Delauny"      TETGEN="Delauny"
54    
55        def __init__(self, dim=3, element_size=1., order=1, keep_files=False):
56            """
57            Initializes the gmsh design.
58    
59            :param dim: spatial dimension
60            :param element_size: global element size
61            :param order: element order
62            :param keep_files: flag to keep work files
63            """
64            design.AbstractDesign.__init__(self,dim=dim,element_size=element_size,order=order,keep_files=keep_files)
65            self.__mshname_set = False
66            self.__scriptname=""
67            self.setScriptFileName()
68            self.setOptions()
69            self.setFileFormat(self.GMSH)
70    
71      def __init__(self,dim=3,element_size=1.,order=1,keep_files=False):      def setScriptFileName(self, name=None):
72         """          """
73         Initializes the gmsh design.          Sets the filename for the gmsh input script. If no name is given a name
74            with extension `geo` is generated.
75         :param dim: spatial dimension          """
76         :param element_size: global element size          if self.__scriptname:
77         :param order: element order              os.unlink(self.__scriptname)
78         :param keep_files: flag to keep work files          if name == None:
79         """              self.__scriptname_set=False
80         design.AbstractDesign.__init__(self,dim=dim,element_size=element_size,order=order,keep_files=keep_files)              tmp_f_id=tempfile.mkstemp(suffix=".geo")
81         self.__mshname_set = False              self.__scriptname=tmp_f_id[1]
82         self.__scriptname=""              os.close(tmp_f_id[0])
83         self.setScriptFileName()          else:
84         self.setOptions()              self.__scriptname=name
85         self.setFileFormat(self.GMSH)              self.__scriptname_set=True
   
     def setScriptFileName(self,name=None):  
        """  
        Sets the filename for the gmsh input script. If no name is given a name  
        with extension `geo` is generated.  
        """  
        if self.__scriptname:  
            os.unlink(self.__scriptname)  
        if name == None:  
            self.__scriptname_set=False  
            tmp_f_id=tempfile.mkstemp(suffix=".geo")  
            self.__scriptname=tmp_f_id[1]  
            os.close(tmp_f_id[0])  
        else:  
            self.__scriptname=name  
            self.__scriptname_set=True  
86    
87      def getScriptFileName(self):      def getScriptFileName(self):
88         """          """
89         Returns the name of the gmsh script file.          Returns the name of the gmsh script file.
90         """          """
91         return self.__scriptname          return self.__scriptname
92    
93      def setOptions(self,algorithm=None, optimize_quality=True, smoothing=1, curvature_based_element_size=False, algorithm2D=None, algorithm3D=None, generate_hexahedra=False, random_factor=None):      def setOptions(self, algorithm=None, optimize_quality=True, smoothing=1,
94                       curvature_based_element_size=False, algorithm2D=None,
95                       algorithm3D=None, generate_hexahedra=False,
96                       random_factor=None):
97          """          """
98          Sets options for the mesh generator.          Sets options for the mesh generator.
99          
100          :param algorithm: selects 2D meshing algorithm          :param algorithm: selects 2D meshing algorithm
101          :type algorithm: in self.DELAUNAY, self.MESHADAPT, self.FRONTAL          :type algorithm: in self.DELAUNAY, self.MESHADAPT, self.FRONTAL
102          :param algorithm2D: must be equal to algorithm          :param algorithm2D: must be equal to algorithm
103          :type algorithm2D: in self.DELAUNAY, self.MESHADAPT, self.FRONTAL          :type algorithm2D: in self.DELAUNAY, self.MESHADAPT, self.FRONTAL
104          :param algorithm3D: selects 3D meshing algorithm          :param algorithm3D: selects 3D meshing algorithm
105          :type algorithm3D: in self.DELAUNAY, self.FRONTAL          :type algorithm3D: in self.DELAUNAY, self.FRONTAL
106          :param curvature_based_element_size: switch for curvature based element size adaption          :param curvature_based_element_size: switch for curvature based element size adaption
107          :type curvature_based_element_size: ```bool```          :type curvature_based_element_size: ```bool```
108          :param smoothing: number of smoothing steps          :param smoothing: number of smoothing steps
# Line 114  class Design(design.AbstractDesign): Line 115  class Design(design.AbstractDesign):
115          :type random_factor: positive ```float```          :type random_factor: positive ```float```
116          """          """
117          if random_factor==None: random_factor=1.e-9          if random_factor==None: random_factor=1.e-9
118          if not random_factor > 0:          if not random_factor > 0:
119                 raise ValueError("random_factor must be positive.")              raise ValueError("random_factor must be positive.")
120          smoothing=int(smoothing)          smoothing=int(smoothing)
121          if not  smoothing > 0:          if not smoothing > 0:
122                 raise ValueError("smoothing must be positive.")              raise ValueError("smoothing must be positive.")
123    
124          if algorithm3D==None: algorithm3D=self.FRONTAL          if algorithm3D is None:
125          if algorithm==None:              algorithm3D=self.FRONTAL
126             if algorithm2D==None: algorithm2D=self.MESHADAPT          if algorithm is None:
127                if algorithm2D is None:
128                    algorithm2D=self.MESHADAPT
129          else:          else:
130             if not algorithm2D==None:              if not algorithm2D is None:
131                if not algorithm == algorithm2D :                  if not algorithm == algorithm2D:
132                    raise ValueError("argument algorithm (=%s) and algorithm2D (=%s) must have the same value if set."%(algorithm, algorithm2D))                      raise ValueError("argument algorithm (=%s) and algorithm2D (=%s) must have the same value if set."%(algorithm, algorithm2D))
133             algorithm2D = algorithm              algorithm2D = algorithm
134          if not algorithm2D in [ self.DELAUNAY, self.MESHADAPT, self.FRONTAL ]:          if not algorithm2D in [ self.DELAUNAY, self.MESHADAPT, self.FRONTAL ]:
135              raise ValueError("illegal 2D meshing algorithm %s."%algorithm2D)              raise ValueError("illegal 2D meshing algorithm %s."%algorithm2D)
136          if not algorithm3D in [ self.DELAUNAY, self.FRONTAL ]:          if not algorithm3D in [ self.DELAUNAY, self.FRONTAL ]:
137              raise ValueError("illegal 3D meshing algorithm %s."%algorithm3D)              raise ValueError("illegal 3D meshing algorithm %s."%algorithm3D)
138                  
139          self.__curvature_based_element_size=curvature_based_element_size          self.__curvature_based_element_size=curvature_based_element_size
140          self.__algo2D=algorithm2D          self.__algo2D=algorithm2D
141          self.__algo3D=algorithm3D          self.__algo3D=algorithm3D
# Line 140  class Design(design.AbstractDesign): Line 143  class Design(design.AbstractDesign):
143          self.__smoothing=smoothing          self.__smoothing=smoothing
144          self.__generate_hexahedra=generate_hexahedra          self.__generate_hexahedra=generate_hexahedra
145          self.__random_factor=random_factor          self.__random_factor=random_factor
146      def getOptions(self,name=None):  
147        def getOptions(self, name=None):
148          """          """
149          Returns the current options for the mesh generator.          Returns the current options for the mesh generator.
150          """          """
151          if name == None:          if name is None:
152             return {"optimize_quality" : self.__optimize_quality ,              return {"optimize_quality" : self.__optimize_quality ,
153                     "smoothing" : self.__smoothing,                      "smoothing" : self.__smoothing,
154                     "curvature_based_element_size" : self.__curvature_based_element_size,                      "curvature_based_element_size" : self.__curvature_based_element_size,
155                     "generate_hexahedra" : self.__generate_hexahedra,                      "generate_hexahedra" : self.__generate_hexahedra,
156                     "algorithm2D" : self.__algo2D,                      "algorithm2D" : self.__algo2D,
157                     "algorithm3D" : self.__algo3D ,                      "algorithm3D" : self.__algo3D ,
158                     "random_factor" : self.__random_factor }                      "random_factor" : self.__random_factor }
159          else:          else:
160             return self.getOption()[name]              return self.getOption()[name]
161    
162      def __del__(self):      def __del__(self):
163          """          """
164          Cleans up.          Cleans up.
165          """          """
166          try:          try:
167            if not self.keepFiles():              if not self.keepFiles():
168              if not self.__scriptname_set: #i.e. it's a tempfile                  if not self.__scriptname_set: #i.e. it's a tempfile
169                  os.unlink(self.getScriptFileName())                      os.unlink(self.getScriptFileName())
170              if not self.__mshname_set: #i.e. it's a tempfile                  if not self.__mshname_set: #i.e. it's a tempfile
171                  os.unlink(self.getMeshFileName())                      os.unlink(self.getMeshFileName())
172          except OSError:          except OSError:
173              pass # The file might not have been created and there is nothing              pass # The file might not have been created and there is nothing
174                   # to do about a "failure" here anyway                   # to do about a "failure" here anyway
# Line 196  class Design(design.AbstractDesign): Line 200  class Design(design.AbstractDesign):
200          import shlex          import shlex
201          args=shlex.split(self.getCommandString())          args=shlex.split(self.getCommandString())
202          args[-1]=args[-1]%self.getScriptHandler()          args[-1]=args[-1]%self.getScriptHandler()
203            
204          try:          try:
205             import gmshpy              import gmshpy
206             havepy=True              havepy=True
207          except ImportError:          except ImportError:
208             havepy=False              havepy=False
209          havepy=False            havepy=False
210          if False: #havepy: # will experiment with this after the release          if havepy:
211             gmshpy.GModel_readGEO(self.getScriptHandler())              gmshpy.GModel_readGEO(self.getScriptHandler())
212             model=gmshpy.GModel_current()              model=gmshpy.GModel_current()
213             linear=False              linear=False
214             incomplete=False              incomplete=False
215             model.setOrderN(self.getElementOrder(), linear, incomplete)              model.setOrderN(self.getElementOrder(), linear, incomplete)
216             gmshpy.Msg_SetVerbosity(3)              gmshpy.Msg_SetVerbosity(3)
217             model.mesh(self.getDim())              model.mesh(self.getDim())
218             model.writeMSH(self.getMeshFileName())              model.writeMSH(self.getMeshFileName())
219             model.writeMSH("Bobgmsh.msh")              return self.getMeshFileName()
            return self.getMeshFileName()  
220          else:          else:
221             ret=runGmsh(args)              ret=runGmsh(args)
222             if ret > 0:              if ret > 0:
223                 self.setKeepFilesOn() #no files to delete, so don't try to                  self.setKeepFilesOn() #no files to delete, so don't try to
224                 raise RuntimeError("Could not build mesh using: " + \                  raise RuntimeError("Could not build mesh using: " + \
225                      "%s"%" ".join(args) + "\nCheck gmsh is available")                      "%s"%" ".join(args) + "\nCheck gmsh is available")
226             return self.getMeshFileName()              return self.getMeshFileName()
227    
           
228      def getScriptString(self):      def getScriptString(self):
229          """          """
230          Returns the gmsh script to generate the mesh.          Returns the gmsh script to generate the mesh.
# Line 231  class Design(design.AbstractDesign): Line 233  class Design(design.AbstractDesign):
233          out='// generated by esys.pycad\nGeneral.Terminal = 1;\nGeneral.ExpertMode = 1;\n'          out='// generated by esys.pycad\nGeneral.Terminal = 1;\nGeneral.ExpertMode = 1;\n'
234          options=self.getOptions()          options=self.getOptions()
235          if options["optimize_quality"]:          if options["optimize_quality"]:
236                 out+="Mesh.Optimize = 1;\n"              out += "Mesh.Optimize = 1;\n"
237          else:          else:
238                 out+="Mesh.Optimize = 0;\n"              out += "Mesh.Optimize = 0;\n"
239    
240          if options["curvature_based_element_size"]:          if options["curvature_based_element_size"]:
241                 out+="Mesh.CharacteristicLengthFromCurvature = 1;\n"              out += "Mesh.CharacteristicLengthFromCurvature = 1;\n"
242          else:          else:
243                 out+="Mesh.CharacteristicLengthFromCurvature = 0;\n"              out += "Mesh.CharacteristicLengthFromCurvature = 0;\n"
244    
245          if options["generate_hexahedra"]:          if options["generate_hexahedra"]:
246                 if self.getDim() == 2:              if self.getDim() == 2:
247                    out+="Mesh.SubdivisionAlgorithm = 1;\n"                  out += "Mesh.SubdivisionAlgorithm = 1;\n"
248                 else:              else:
249                    out+="Mesh.SubdivisionAlgorithm = 2;\n"                  out += "Mesh.SubdivisionAlgorithm = 2;\n"
250          else:          else:
251                 out+="Mesh.SubdivisionAlgorithm = 0;\n"              out += "Mesh.SubdivisionAlgorithm = 0;\n"
252          out+="Mesh.Smoothing = %d;\n"%options["smoothing"]  
253          out+="Mesh.RandomFactor = %.14e;\n"%options["random_factor"]          out += "Mesh.Smoothing = %d;\n"%options["smoothing"]
254          if options["algorithm2D"] == self.MESHADAPT: out+="Mesh.Algorithm = 1; // = MeshAdapt\n"          out += "Mesh.RandomFactor = %.14e;\n"%options["random_factor"]
255          if options["algorithm2D"] == self.DELAUNAY : out+="Mesh.Algorithm = 5; // = Delaunay\n"          if options["algorithm2D"] == self.MESHADAPT:
256          if options["algorithm2D"] == self.FRONTAL: out+="Mesh.Algorithm = 6; // = Frontal\n"              out += "Mesh.Algorithm = 1; // = MeshAdapt\n"
257          if options["algorithm3D"] == self.DELAUNAY : out+="Mesh.Algorithm3D = 1; // = Delaunay\n"          elif options["algorithm2D"] == self.DELAUNAY:
258          if options["algorithm3D"] == self.FRONTAL: out+="Mesh.Algorithm3D = 4; // = Frontal\n"              out += "Mesh.Algorithm = 5; // = Delaunay\n"
259            elif options["algorithm2D"] == self.FRONTAL:
260                out += "Mesh.Algorithm = 6; // = Frontal\n"
261    
262            if options["algorithm3D"] == self.DELAUNAY:
263                out += "Mesh.Algorithm3D = 1; // = Delaunay\n"
264            elif options["algorithm3D"] == self.FRONTAL:
265                out += "Mesh.Algorithm3D = 4; // = Frontal\n"
266    
267          for prim in self.getAllPrimitives():          for prim in self.getAllPrimitives():
268             p=prim.getUnderlyingPrimitive()              p=prim.getUnderlyingPrimitive()
269             if isinstance(p, Point):              if isinstance(p, Point):
270                 c=p.getCoordinates()                  c=p.getCoordinates()
271                 #out+="Point(%s) = {%f , %f, %f , %f };\n"%(p.getID(),c[0],c[1],c[2], p.getLocalScale()*h)                  #out+="Point(%s) = {%f , %f, %f , %f };\n"%(p.getID(),c[0],c[1],c[2], p.getLocalScale()*h)
272                 out+="Point(%s) = {%.14e , %.14e, %.14e , %.14e };\n"%(p.getID(),c[0],c[1],c[2], p.getLocalScale()*h)                  out += "Point(%s) = {%.14e, %.14e, %.14e, %.14e};\n"%(p.getID(),c[0],c[1],c[2], p.getLocalScale()*h)
273    
274             elif isinstance(p, Spline):              elif isinstance(p, Spline):
275                 out+="Spline(%s) = {%s};\n"%(p.getID(),self.__mkArgs(p.getControlPoints()))+self.__mkTransfiniteLine(p)                  out += "Spline(%s) = {%s};\n"%(p.getID(),self.__mkArgs(p.getControlPoints()))+self.__mkTransfiniteLine(p)
276    
277             elif isinstance(p, BezierCurve):              elif isinstance(p, BezierCurve):
278                 out+="Bezier(%s) = {%s};\n"%(p.getID(),self.__mkArgs(p.getControlPoints()))+self.__mkTransfiniteLine(p)                  out += "Bezier(%s) = {%s};\n"%(p.getID(),self.__mkArgs(p.getControlPoints()))+self.__mkTransfiniteLine(p)
279    
280             elif isinstance(p, BSpline):              elif isinstance(p, BSpline):
281                 out+="BSpline(%s) = {%s};\n"%(p.getID(),self.__mkArgs(p.getControlPoints()))+self.__mkTransfiniteLine(p)                  out += "BSpline(%s) = {%s};\n"%(p.getID(),self.__mkArgs(p.getControlPoints()))+self.__mkTransfiniteLine(p)
282    
283             elif isinstance(p, Line):              elif isinstance(p, Line):
284                 out+="Line(%s) = {%s, %s};\n"%(p.getID(),p.getStartPoint().getDirectedID(),p.getEndPoint().getDirectedID())+self.__mkTransfiniteLine(p)                  out += "Line(%s) = {%s, %s};\n"%(p.getID(),p.getStartPoint().getDirectedID(),p.getEndPoint().getDirectedID())+self.__mkTransfiniteLine(p)
285    
286             elif isinstance(p, Arc):              elif isinstance(p, Arc):
287                out+="Circle(%s) = {%s, %s, %s};\n"%(p.getID(),p.getStartPoint().getDirectedID(),p.getCenterPoint().getDirectedID(),p.getEndPoint().getDirectedID())+self.__mkTransfiniteLine(p)                  out += "Circle(%s) = {%s, %s, %s};\n"%(p.getID(),p.getStartPoint().getDirectedID(),p.getCenterPoint().getDirectedID(),p.getEndPoint().getDirectedID())+self.__mkTransfiniteLine(p)
288    
289             elif isinstance(p, Ellipse):              elif isinstance(p, Ellipse):
290                out+="Ellipse(%s) = {%s, %s, %s, %s};\n"%(p.getID(),p.getStartPoint().getDirectedID(),p.getCenterPoint().getDirectedID(),p.getPointOnMainAxis().getDirectedID(), p.getEndPoint().getDirectedID())+self.__mkTransfiniteLine(p)                  out += "Ellipse(%s) = {%s, %s, %s, %s};\n"%(p.getID(),p.getStartPoint().getDirectedID(),p.getCenterPoint().getDirectedID(),p.getPointOnMainAxis().getDirectedID(), p.getEndPoint().getDirectedID())+self.__mkTransfiniteLine(p)
291    
292             elif isinstance(p, CurveLoop):              elif isinstance(p, CurveLoop):
293                 out+="Line Loop(%s) = {%s};\n"%(p.getID(),self.__mkArgs(p.getCurves()))                  out += "Line Loop(%s) = {%s};\n"%(p.getID(),self.__mkArgs(p.getCurves()))
294    
295             elif isinstance(p, RuledSurface):              elif isinstance(p, RuledSurface):
296                 out+="Ruled Surface(%s) = {%s};\n"%(p.getID(),p.getBoundaryLoop().getDirectedID())+self.__mkTransfiniteSurface(p)                  out += "Ruled Surface(%s) = {%s};\n"%(p.getID(),p.getBoundaryLoop().getDirectedID())+self.__mkTransfiniteSurface(p)
297    
298             elif isinstance(p, PlaneSurface):              elif isinstance(p, PlaneSurface):
299                 line=self.__mkArgs(p.getHoles())                  line = self.__mkArgs(p.getHoles())
300                 if len(line)>0:                  if len(line) > 0:
301                   out+="Plane Surface(%s) = {%s, %s};\n"%(p.getID(),p.getBoundaryLoop().getDirectedID(), line)+self.__mkTransfiniteSurface(p)                      out += "Plane Surface(%s) = {%s, %s};\n"%(p.getID(),p.getBoundaryLoop().getDirectedID(), line)+self.__mkTransfiniteSurface(p)
302                 else:                  else:
303                   out+="Plane Surface(%s) = {%s};\n"%(p.getID(),p.getBoundaryLoop().getDirectedID())+self.__mkTransfiniteSurface(p)                      out += "Plane Surface(%s) = {%s};\n"%(p.getID(),p.getBoundaryLoop().getDirectedID())+self.__mkTransfiniteSurface(p)
304    
305             elif isinstance(p, SurfaceLoop):              elif isinstance(p, SurfaceLoop):
306                 out+="Surface Loop(%s) = {%s};\n"%(p.getID(),self.__mkArgs(p.getSurfaces()))                  out += "Surface Loop(%s) = {%s};\n"%(p.getID(),self.__mkArgs(p.getSurfaces()))
307    
308             elif isinstance(p, Volume):              elif isinstance(p, Volume):
309                 line=self.__mkArgs(p.getHoles())                  line = self.__mkArgs(p.getHoles())
310                 if len(line)>0:                  if len(line)>0:
311                   out+="Volume(%s) = {%s, %s};\n"%(p.getID(),p.getSurfaceLoop().getDirectedID(), line)+self.__mkTransfiniteVolume(p)                      out += "Volume(%s) = {%s, %s};\n"%(p.getID(),p.getSurfaceLoop().getDirectedID(), line)+self.__mkTransfiniteVolume(p)
312                 else:                  else:
313                   out+="Volume(%s) = {%s};\n"%(p.getID(),p.getSurfaceLoop().getDirectedID())+self.__mkTransfiniteVolume(p)                      out += "Volume(%s) = {%s};\n"%(p.getID(),p.getSurfaceLoop().getDirectedID())+self.__mkTransfiniteVolume(p)
314    
315             elif isinstance(p, PropertySet):              elif isinstance(p, PropertySet):
316                 if p.getNumItems()>0:                  if p.getNumItems() > 0:
317                    dim=p.getDim()                      dim=p.getDim()
318                    line="Physical "                      line = "Physical "
319                    if dim==0:                      if dim==0:
320                        line+="Point"                          line += "Point"
321                    elif dim==1:                      elif dim==1:
322                        line+="Line"                          line += "Line"
323                    elif dim==2:                      elif dim==2:
324                        line+="Surface"                          line += "Surface"
325                    else:                      else:
326                        line+="Volume"                          line += "Volume"
327                    out+=line+"(" + str(p.getID()) + ") = {"+self.__mkArgs(p.getItems(),useAbs=True)+"};\n"                      out += line+"(" + str(p.getID()) + ") = {"+self.__mkArgs(p.getItems(),useAbs=True)+"};\n"
328    
329             else:              else:
330                 raise TypeError("unable to pass %s object to gmsh."%str(type(p)))                  raise TypeError("unable to pass %s object to gmsh."%str(type(p)))
331          return out          return out
332    
333        def __mkArgs(self, args, useAbs=False):
334      def __mkArgs(self,args, useAbs=False):          line = ""
         line=""  
335          for i in args:          for i in args:
336              id = i.getDirectedID()              id = i.getDirectedID()
337              if useAbs: id=abs(id)              if useAbs: id=abs(id)
338              if len(line)>0:              if len(line) > 0:
339                  line+=", %s"%id                  line += ", %s"%id
340              else:              else:
341                  line="%s"%id                  line = "%s"%id
342          return line          return line
343    
344      def __mkTransfiniteLine(self,p):      def __mkTransfiniteLine(self, p):
345            s=p.getElementDistribution()          s = p.getElementDistribution()
346            if not s == None:          if not s == None:
347                if s[2]:              if s[2]:
348                    out="Transfinite Line{%d} = %d Using Bump %s;\n"%(p.getID(),s[0],s[1])                  out="Transfinite Line{%d} = %d Using Bump %s;\n"%(p.getID(),s[0],s[1])
349                else:              else:
350                    out="Transfinite Line{%d} = %d Using Progression %s;\n"%(p.getID(),s[0],s[1])                  out="Transfinite Line{%d} = %d Using Progression %s;\n"%(p.getID(),s[0],s[1])
351            else:          else:
352                 out=""              out=""
353            return out          return out
354      def __mkTransfiniteSurface(self,p):  
355           out=""      def __mkTransfiniteSurface(self, p):
356           o=p.getRecombination()          out = ""
357           s=p.getTransfiniteMeshing()          o = p.getRecombination()
358           if not s == None:          s = p.getTransfiniteMeshing()
359               out2=""          if not s == None:
360               if not s[0] == None:              out2 = ""
361                 for q in s[0]:              if not s[0] is None:
362                    if len(out2)==0:                  for q in s[0]:
363                        out2="%s"%q.getID()                      if len(out2)==0:
364                    else:                          out2 = "%s"%q.getID()
365                        out2="%s,%s"%(out2,q.getID())                      else:
366               if s[1] == None:                          out2 = "%s,%s"%(out2, q.getID())
367                  out+="Transfinite Surface{%s} = {%s};\n"%(p.getID(),out2)              if s[1] is None:
368               else:                  out += "Transfinite Surface{%s} = {%s};\n"%(p.getID(),out2)
369                  out+="Transfinite Surface{%s} = {%s} %s;\n"%(p.getID(),out2,s[1])              else:
370           if not o == None:                  out += "Transfinite Surface{%s} = {%s} %s;\n"%(p.getID(),out2,s[1])
371             out+="Recombine Surface {%s} = %f;\n"%(p.getID(),o/DEG)          if not o is None:
372           return out              out += "Recombine Surface {%s} = %f;\n"%(p.getID(), o/DEG)
373      def __mkTransfiniteVolume(self,p):          return out
374           out=""  
375           s=p.getTransfiniteMeshing()      def __mkTransfiniteVolume(self, p):
376           if not s == None:          out=""
377               if len(s)>0:          s=p.getTransfiniteMeshing()
378                      out2=""          if not s == None:
379                      for q in s[0]:              if len(s)>0:
380                          if len(out2)==0:                  out2=""
381                              out2="%s"%q.getID()                  for q in s[0]:
382                          else:                      if len(out2)==0:
383                               out2="%s,%s"%(out2,q.getID())                          out2="%s"%q.getID()
384                      out+="Transfinite Volume{%s} = {%s};\n"%(p.getID(),out2)                      else:
385               else:                          out2="%s,%s"%(out2,q.getID())
386                      out+="Transfinite Volume{%s};\n"%(p.getID(),)                  out+="Transfinite Volume{%s} = {%s};\n"%(p.getID(),out2)
387           return out              else:
388                        out+="Transfinite Volume{%s};\n"%(p.getID(),)
389            return out
390    

Legend:
Removed from v.5391  
changed lines
  Added in v.5392

  ViewVC Help
Powered by ViewVC 1.1.26