def createNewInput(self, currentInputFiles, origInputFiles, samplerType, **Kwargs): """ Generates new perturbed input files for Scale sequences @ In, currentInputFiles, list, list of current input files @ In, origInputFiles, list, list of the original input files @ In, samplerType, string, Sampler type (e.g. MonteCarlo, Adaptive, etc. see manual Samplers section) @ In, Kwargs, dict, dictionary of parameters. In this dictionary there is another dictionary called "SampledVars" where RAVEN stores the variables that got sampled (e.g. Kwargs['SampledVars'] => {'var1':10,'var2':40}) @ Out, newInputFiles, list, list of new input files (modified or not) """ if 'dynamiceventtree' in str(samplerType).lower(): raise IOError( "Dynamic Event Tree-based samplers not supported by CTF interface yet!" ) currentInputsToPerturb = [ item for subList in self.findInps(currentInputFiles).values() for item in subList ] originalInputs = [ item for subList in self.findInps(origInputFiles).values() for item in subList ] parser = GenericParser.GenericParser(currentInputsToPerturb) parser.modifyInternalDictionary(**Kwargs) parser.writeNewInput(currentInputsToPerturb, originalInputs) return currentInputFiles
def createNewInput(self, currentInputFiles, origInputFiles, samplerType, **Kwargs): indexes=[] infiles=[] origfiles=[] #FIXME possible danger here from reading binary files for index,inputFile in enumerate(currentInputFiles): if inputFile.getExt() in self.getInputExtension(): indexes.append(index) infiles.append(inputFile) for index,inputFile in enumerate(origInputFiles): if inputFile.getExt() in self.getInputExtension(): origfiles.append(inputFile) parser = GenericParser.GenericParser(infiles) parser.modifyInternalDictionary(**Kwargs) parser.writeNewInput(infiles,origfiles) return currentInputFiles
def createNewInput(self, currentInputFiles, oriInputFiles, samplerType, **Kwargs): """ Generate a new AccelerateCFD input file (txt format) from the original, changing parameters as specified in Kwargs['SampledVars']. @ In, currentInputFiles, list, list of current input files (input files from last this method call) @ In, oriInputFiles, list, list of the original input files @ In, samplerType, string, Sampler type (e.g. MonteCarlo, Adaptive, etc. see manual Samplers section) @ In, Kwargs, dictionary, kwarded dictionary of parameters. In this dictionary there is another dictionary called "SampledVars" where RAVEN stores the variables that got sampled (e.g. Kwargs['SampledVars'] => {'var1':10,'var2':40}) @ Out, newInputFiles, list, list of newer input files, list of the new input files (modified and not) """ if 'dynamiceventtree' in str(samplerType).lower(): raise IOError("Dynamic Event Tree-based samplers not supported by AccelerateCFD interface yet!") currentInputsToPerturb = self.findInps(currentInputFiles,"input") originalInputs = self.findInps(oriInputFiles,"input") parser = GenericParser.GenericParser(currentInputsToPerturb) parser.modifyInternalDictionary(**Kwargs) parser.writeNewInput(currentInputsToPerturb,originalInputs) return currentInputFiles