1 """Works with a polyMesh/boundary-File"""
2
3 from ParsedParameterFile import ParsedBoundaryDict
4 from SolutionDirectory import SolutionDirectory
5 from PyFoam.Error import PyFoamException
6
8 """Handles data in a boundary-File"""
9
10 - def __init__(self,case,backup=False,region=None):
17
19 return self.content[key]
20
22 if not type(value)==dict:
23 raise PyFoamException("Type of boundary element must be dict, is"+str(type(value)))
24 for k in ["type","nFaces","startFace"]:
25 if not value.has_key(k):
26 raise PyFoamException("Required key "+str(k)+" is missing from"+str(value)+"not a valid patch")
27
28 self.content[key]=value
29
31 for p in self.content:
32 yield p
33
35 """Returns a list with the names of the patches
36 @param patchType: If specified only patches of the specific type are returned"""
37
38 if patchType==None:
39 return self.content.keys()
40 else:
41 result=[]
42 for k,v in self.content.iteritems():
43 if v["type"]==patchType:
44 result.append(k)
45 return result
46