Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modified interfaces to be agnostics with respect to the sampler type #181

Merged
merged 2 commits into from
May 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion framework/CodeInterfaces/MAAP5/MAAP5Interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def createNewInput(self,currentInputFiles,oriInputFiles,samplerType,**Kwargs):
@ Out, newInputFiles, list, list of newer input files, list of the new input files (modified and not)
"""
self.samplerType=samplerType
if 'DynamicEventTree' in samplerType:
if 'dynamiceventtree' in str(samplerType).lower():
if Kwargs['parentID'] == 'root':
self.oriInput(oriInputFiles) #original input files are checked only the first time
self.stopSimulation(currentInputFiles, Kwargs)
Expand Down
19 changes: 6 additions & 13 deletions framework/CodeInterfaces/MooseBasedApp/MooseBasedAppInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,12 @@ def createNewInput(self,currentInputFiles,oriInputFiles,samplerType,**Kwargs):
@ Out, newInputFiles, list, list of newer input files, list of the new input files (modified and not)
"""
import MOOSEparser
self._samplersDictionary = {}
self._samplersDictionary['MonteCarlo' ] = self.pointSamplerForMooseBasedApp
self._samplersDictionary['Grid' ] = self.pointSamplerForMooseBasedApp
self._samplersDictionary['Stratified' ] = self.pointSamplerForMooseBasedApp
self._samplersDictionary['DynamicEventTree' ] = self.dynamicEventTreeForMooseBasedApp
self._samplersDictionary['StochasticCollocation'] = self.pointSamplerForMooseBasedApp
self._samplersDictionary['FactorialDesign' ] = self.pointSamplerForMooseBasedApp
self._samplersDictionary['ResponseSurfaceDesign'] = self.pointSamplerForMooseBasedApp
self._samplersDictionary['LimitSurfaceSearch' ] = self.pointSamplerForMooseBasedApp
self._samplersDictionary['SparseGridCollocation'] = self.pointSamplerForMooseBasedApp
self._samplersDictionary['EnsembleForward' ] = self.pointSamplerForMooseBasedApp
self._samplersDictionary['CustomSampler' ] = self.pointSamplerForMooseBasedApp
self._samplersDictionary['None' ] = self.pointSamplerForMooseBasedApp #for SingleRun case
self._samplersDictionary = {}
if 'dynamiceventtree' in str(samplerType).lower():
self._samplersDictionary[samplerType] = self.dynamicEventTreeForMooseBasedApp
else:
self._samplersDictionary[samplerType] = self.pointSamplerForMooseBasedApp

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

top!

found = False
for index, inputFile in enumerate(currentInputFiles):
inputFile = inputFile.getAbsFile()
Expand Down
17 changes: 5 additions & 12 deletions framework/CodeInterfaces/RELAP5/Relap5Interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,11 @@ def createNewInput(self,currentInputFiles,oriInputFiles,samplerType,**Kwargs):
@ Out, newInputFiles, list, list of newer input files, list of the new input files (modified and not)
"""
import RELAPparser
self._samplersDictionary = {}
self._samplersDictionary['MonteCarlo' ] = self.pointSamplerForRELAP5
self._samplersDictionary['Grid' ] = self.pointSamplerForRELAP5
self._samplersDictionary['Stratified' ] = self.pointSamplerForRELAP5
self._samplersDictionary['Adaptive' ] = self.pointSamplerForRELAP5
self._samplersDictionary['FactorialDesign' ] = self.pointSamplerForRELAP5
self._samplersDictionary['ResponseSurfaceDesign'] = self.pointSamplerForRELAP5
self._samplersDictionary['DynamicEventTree' ] = self.DynamicEventTreeForRELAP5
self._samplersDictionary['BnBDynamicEventTree' ] = self.DynamicEventTreeForRELAP5
self._samplersDictionary['StochasticCollocation'] = self.pointSamplerForRELAP5
self._samplersDictionary['EnsembleForward' ] = self.pointSamplerForRELAP5
self._samplersDictionary['CustomSampler' ] = self.pointSamplerForRELAP5
self._samplersDictionary = {}
if 'dynamiceventtree' in str(samplerType).lower():
self._samplersDictionary[samplerType] = self.DynamicEventTreeForRELAP5
else:
self._samplersDictionary[samplerType] = self.pointSamplerForRELAP5

found = False
for index, inputFile in enumerate(currentInputFiles):
Expand Down
15 changes: 3 additions & 12 deletions framework/CodeInterfaces/RELAP7/RELAP7Interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,18 @@ def createNewInput(self,currentInputFiles,oriInputFiles,samplerType,**Kwargs):
"""
MOOSEparser = utils.importFromPath(os.path.join(os.path.join(uppath(os.path.dirname(__file__),1),'MooseBasedApp'),'MOOSEparser.py'),False)
self._samplersDictionary = {}
self._samplersDictionary[samplerType] = self.gridForRELAP7
self._samplersDictionary['MonteCarlo' ] = self.monteCarloForRELAP7
self._samplersDictionary['Grid' ] = self.gridForRELAP7
self._samplersDictionary['LimitSurfaceSearch' ] = self.gridForRELAP7 # same Grid Fashion. It forces a dist to give a particular value
self._samplersDictionary['Stratified' ] = self.latinHyperCubeForRELAP7
self._samplersDictionary['DynamicEventTree' ] = self.dynamicEventTreeForRELAP7
self._samplersDictionary['FactorialDesign' ] = self.gridForRELAP7
self._samplersDictionary['ResponseSurfaceDesign' ] = self.gridForRELAP7
self._samplersDictionary['AdaptiveDynamicEventTree'] = self.adaptiveDynamicEventTreeForRELAP7
self._samplersDictionary['AdaptiveDynamicEventTree'] = self.dynamicEventTreeForRELAP7
self._samplersDictionary['StochasticCollocation' ] = self.gridForRELAP7
self._samplersDictionary['CustomSampler' ] = self.gridForRELAP7

found = False
for index, inputFile in enumerate(currentInputFiles):
if inputFile.getExt() in self.getInputExtension():
Expand Down Expand Up @@ -128,17 +130,6 @@ def monteCarloForRELAP7(self,**Kwargs):
listDict.append(modifDict)
return listDict

def adaptiveDynamicEventTreeForRELAP7(self,**Kwargs):
"""
This method is used to create a list of dictionaries that can be interpreted by the input Parser
in order to change the input file based on the information present in the Kwargs dictionary.
This is specific for Adaptive DET sampler
@ In, **Kwargs, dict, kwared dictionary containing the values of the parameters to be changed
@ Out, listDict, list, list of dictionaries used by the parser to change the input file
"""
listDict = self.dynamicEventTreeForRELAP7(**Kwargs)
return listDict

def dynamicEventTreeForRELAP7(self,**Kwargs):
"""
This method is used to create a list of dictionaries that can be interpreted by the input Parser
Expand Down