-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More intelligent Variable Groups (#803)
* implementation, tests, and conversion script (not run on all tests yet) * updated tests * updated docs * fixed print, failing tests
- Loading branch information
1 parent
df5c80a
commit df5efa5
Showing
11 changed files
with
254 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright 2017 Battelle Energy Alliance, LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
import xml.etree.ElementTree as ET | ||
import xml.dom.minidom as pxml | ||
import os | ||
|
||
def convert(tree,fileName=None): | ||
""" | ||
Removes the "base" and "dependencies" from VariableGroups and places them in the text. | ||
@ In, tree, xml.etree.ElementTree.ElementTree object, the contents of a RAVEN input file | ||
@ In, fileName, the name for the raven input file | ||
@Out, tree, xml.etree.ElementTree.ElementTree object, the modified RAVEN input file | ||
""" | ||
simulation = tree.getroot() | ||
groupsNode = simulation.find('VariableGroups') | ||
if groupsNode is not None: | ||
for node in groupsNode: | ||
if 'base' in node.attrib: | ||
node.text = node.attrib['base'] + ',' + node.text | ||
del node.attrib['base'] | ||
del node.attrib['dependencies'] | ||
elif 'dependencies' in node.attrib: | ||
del node.attrib['dependencies'] | ||
return tree | ||
|
||
if __name__=='__main__': | ||
import convert_utils | ||
import sys | ||
convert_utils.standardMain(sys.argv,convert) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?xml version="1.0" ?> | ||
<VariableGroups> | ||
<Group name="x_odd" >x1,x3,x5</Group> | ||
<Group name="x_even" dependencies="" >x2,x4,x6</Group> | ||
<Group name="y_group" dependencies="" >y1,y2</Group> | ||
<Group name="union" dependencies="x_odd,x_even" base="x_odd">+x_even</Group> | ||
<Group name="x_odd" >x1,x3,x5</Group> | ||
<Group name="x_even" >x2,x4,x6</Group> | ||
<Group name="y_group">y1,y2</Group> | ||
<Group name="union" >x_odd, x_even</Group> | ||
</VariableGroups> |
Oops, something went wrong.