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

Fix to saving lattice map using the Grids GUI #494

Merged
merged 4 commits into from Dec 1, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 16 additions & 11 deletions armi/reactor/blueprints/gridBlueprint.py
Expand Up @@ -580,27 +580,32 @@ def saveToStream(stream, bluep, full=False, tryMap=False):
if gridDesign.readFromLatticeMap or tryMap:
geomType = geometry.GeomType.fromStr(gridDesign.geom)
symmetry = geometry.SymmetryType.fromStr(gridDesign.symmetry)

john-science marked this conversation as resolved.
Show resolved Hide resolved
aMap = asciimaps.asciiMapFromGeomAndDomain(
gridDesign.geom, symmetry.domain
)()
aMap.asciiLabelByIndices = {
(key[0], key[1]): val for key, val in gridDesign.gridContents.items()
}
try:
aMap = asciimaps.asciiMapFromGeomAndDomain(
gridDesign.geom, symmetry.domain
)()
aMap.asciiLabelByIndices = {
(key[0], key[1]): val
for key, val in gridDesign.gridContents.items()
}
aMap.gridContentsToAscii()
except Exception as e:
runLog.warning(
"Cannot write geometry with asciimap. Defaulting to dict. Issue: {}".format(
e
)
f"The `lattice map` for the current assembly arrangement cannot be written. "
f"Defaulting to using the `grid contents` dictionary instead. Exception: {e}"
)
aMap = None

if aMap is not None:
# If there is an ascii map available then use it to fill out
# the contents of the lattice map section of the grid design.
# This also clears out the grid contents so there is not duplicate
# data.
gridDesign.gridContents = None
mapString = StringIO()
aMap.writeAscii(mapString)
gridDesign.latticeMap = scalarstring.LiteralScalarString(
gridDesign.latticeMap
mapString.getvalue()
jakehader marked this conversation as resolved.
Show resolved Hide resolved
)
else:
gridDesign.latticeMap = None
Expand Down