def save(self): os.mkdir(self.path) treepath = resource.getResource("resource:run.tree") runTree = common.parseTree(treepath, root=self.name) bctree = self.project._getBCTree() runTree.append(bctree) cm = configuration.ConfigurationManager(savespace=self.path) cm.getConfiguration("__wall__") def write(cm, originalconfid, confid): def isCellzoneSet(): l = [item[0] for item in self.cellzone] return confid in l def check(cellzonetype): if isCellzoneSet(): index = [item[0] for item in self.cellzone].index(confid) if self.cellzone[index][1]: return cellzonetype in self.cellzone[index][1] else: return None confdata = cm.getConfiguration(originalconfid) confdata['id'] = confid path = cm._getSavedFilePath(confid) quickidmap = {} for i in confdata['ITEMS']: quickidmap[i['quickid']] = "_".join([i['quickid'], confid]) for i in confdata['ITEMS']: if i['quickid'] == "por_zone" and check("Porous Zone"): i['value'] = True elif i['quickid'] == "rotating_zone" and check("Rotating Zone"): i['value'] = True i['quickid'] = quickidmap[i['quickid']] if 'hideon' in i: hideon = i['hideon'] for k,v in quickidmap.items(): hideon = hideon.replace(k, v) i['hideon'] = hideon print i['quickid'] cm._writeConfiguration(confdata, path) [write(cm, "__fluid__", fluidid) for fluidid in self.project._getBoundaries(self.project.pfluid)] [write(cm, "__wall__", wallid) for wallid in self.project._getBoundaries(self.project.pwall)] [write(cm, "__pressure_inlet__", prinlet) for prinlet in self.project._getBoundaries(self.project.pinlet)] treepath = os.path.join(self.path, "run.tree") common.writeTree(runTree, treepath) filepath = os.path.join(self.path, self.name) storage.save(self, filepath)
def save(self): path = os.path.join(self.projectdir, self.name) storage.save(self, path)