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,
11 case,
12 backup=False,
13 region=None,
14 processor=None,
15 time=None):
24
26 return self.content[key]
27
29 if not type(value)==dict:
30 raise PyFoamException("Type of boundary element must be dict, is"+str(type(value)))
31 for k in ["type","nFaces","startFace"]:
32 if not value.has_key(k):
33 raise PyFoamException("Required key "+str(k)+" is missing from"+str(value)+"not a valid patch")
34
35 self.content[key]=value
36
38 for p in self.content:
39 yield p
40
42 """Returns a list with the names of the patches
43 @param patchType: If specified only patches of the specific type are returned"""
44
45 if patchType==None:
46 return self.content.keys()
47 else:
48 result=[]
49 for k,v in self.content.iteritems():
50 if v["type"]==patchType:
51 result.append(k)
52 return result
53