Ejemplo n.º 1
0
    def resync(self,region):
        """Update the master case from a region case
        @param region: Name of the region"""
        rCase=SolutionDirectory(self.master.name+"."+region)
        rTimes=rCase.getTimes()
        for t in rTimes+["constant"]:
            if path.exists(path.join(rCase.name,t)):
                if not path.exists(path.join(self.master.name,t,region)):
                    self._rename(self.master.name,region,t)
            for p in rCase.processorDirs():
                pDir=path.join(self.master.name,p)
                if not path.exists(pDir):
                    mkdir(pDir)
                    symlink(path.join(path.pardir,"system"),path.join(pDir,"system"))

                if path.exists(path.join(rCase.name,p,t)):
                    if not path.exists(path.join(pDir,region,t)):
                        self._rename(self.master.name,region,t,processor=p,prefix=path.pardir)
                if t=="constant":
                    for f in listdir(path.join(self.master.name,t,region)):
                        if f!="polyMesh":
                            #                            print path.join(pDir,"constant",region,f),"->",path.join(path.pardir,path.pardir,path.pardir,"constant",region,f)
                            #                            print path.exists(path.join(path.join(pDir,"constant",region),path.join(path.pardir,path.pardir,path.pardir,"constant",region,f)))
                            dest=path.join(pDir,"constant",region,f)
                            src=path.join(path.pardir,path.pardir,path.pardir,"constant",region,f)
                            if not path.exists(dest):
                                symlink(src,dest)