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):
13
15 return self.content[key]
16
18 if not type(value)==dict:
19 raise PyFoamException("Type of boundary element must be dict, is"+str(type(value)))
20 for k in ["type","nFaces","startFace"]:
21 if not value.has_key(k):
22 raise PyFoamException("Required key "+str(k)+" is missing from"+str(value)+"not a valid patch")
23
24 self.content[key]=value
25
27 for p in self.content:
28 yield p
29
31 """Returns a list with the names of the patches
32 @param patchType: If specified only patches of the specific type are returned"""
33
34 if patchType==None:
35 return self.content.keys()
36 else:
37 result=[]
38 for k,v in self.content.iteritems():
39 if v["type"]==patchType:
40 result.append(k)
41 return result
42