def __init__(self, name=None, mshfile=None, bcs=None, cellzone=None, dimension=None, zip_opt=None, scale='1.0',interface=None,items=None): if items:# will be called for opening existing project storage.Storable.__init__(self, items=items) self.runs = {} for k in self.runpaths.keys(): items = storage.load(self.runpaths[k]) self.runs[k] = Run(project=self, items = items) if self.activerun: self.setActiveRun(self.activerun) else: rep = tools.getRepository()#this will be called only for new creation self.name = name self.mshfile = mshfile self.cellzone = cellzone self.dimension = dimension self.projectdir = os.path.join(rep, name) self.bcs = bcs # boundary conditions self.zip_opt=zip_opt self.runs = {} self.runpaths = {} self.activerun = None self.scale = scale self.interface=interface self.pfluid = "[Ff][Ll][Uu][Ii][Dd]" self.pwall = "[Ww][Aa][Ll]{2,2}" self.pinlet = "[Pp][Rr][Ee][Ss][Ss][Uu][Rr][Ee][-_ ][Ii][Nn][Ll][Ee][Tt]" try: os.mkdir(rep) except: pass os.mkdir(self.projectdir)
def openProject(path): path = os.path.abspath(path) name = os.path.basename(path) items = storage.load(os.path.join(path, name)) p = Project(items=items) projectutils.addProject(p)