def testLabel(self): grid = grids.HexGrid.fromPitch(1.0) indices = grid.getIndicesFromRingAndPos(12, 5) label1 = grid.getLabel(indices) self.assertEqual(label1, "012-005") self.assertEqual(grids.locatorLabelToIndices(label1), (12, 5, None)) label2 = grid.getLabel(indices + (5, )) self.assertEqual(label2, "012-005-005") self.assertEqual(grids.locatorLabelToIndices(label2), (12, 5, 5))
def addDetailAssembliesBOL(self): """ Find and activate assemblies that the user requested detailed treatment of. """ if self.cs["detailAssemLocationsBOL"]: for locLabel in self.cs["detailAssemLocationsBOL"]: ring, pos, _axial = grids.locatorLabelToIndices(locLabel) i, j = self.r.core.spatialGrid.getIndicesFromRingAndPos( ring, pos) aLoc = self.r.core.spatialGrid[i, j, 0] try: a = self.r.core.childrenByLocator[aLoc] except KeyError: runLog.error( "Detail assembly in location {} (requested via " "`detailAssemLocationsBOL`) is not in core. " "Update settings.".format(locLabel)) raise self.addDetailAssembly(a) if self.cs["detailAllAssems"]: self.addAllFuelAssems() # This also gets called at BOC but we still # do it here for operators that do not call BOC. self.addDetailAssemsByAssemNums()