def test_growToFullCoreFromThirdCore(self): """Test that a hex core can be converted from a third core to a full core geometry.""" # Check the initialization of the third core model self.assertFalse(self.r.core.isFullCore) self.assertEqual( self.r.core.symmetry, geometry.SymmetryType(geometry.DomainType.THIRD_CORE, geometry.BoundaryType.PERIODIC), ) initialNumBlocks = len(self.r.core.getBlocks()) # Perform reactor conversion changer = geometryConverters.ThirdCoreHexToFullCoreChanger(self.o.cs) changer.convert(self.r) # Check the full core conversion is successful self.assertGreater(len(self.r.core.getBlocks()), initialNumBlocks) self.assertEqual(self.r.core.symmetry.domain, geometry.DomainType.FULL_CORE) # Check that the geometry can be restored to a third core changer.restorePreviousGeometry(self.o.cs, self.r) self.assertEqual(initialNumBlocks, len(self.r.core.getBlocks())) self.assertEqual( self.r.core.symmetry, geometry.SymmetryType(geometry.DomainType.THIRD_CORE, geometry.BoundaryType.PERIODIC), )
def test_skipGrowToFullCoreWhenAlreadyFullCore(self): """Test that hex core is not modified when third core to full core changer is called on an already full core geometry.""" # Check the initialization of the third core model and convert to a full core self.assertFalse(self.r.core.isFullCore) self.assertEqual(self.r.core.symmetry, geometry.THIRD_CORE + geometry.PERIODIC) changer = geometryConverters.ThirdCoreHexToFullCoreChanger(self.o.cs) changer.convert(self.r) # Check that the changer does not affect the full core model on converting and restoring initialNumBlocks = len(self.r.core.getBlocks()) self.assertEqual(self.r.core.symmetry, geometry.FULL_CORE) changer = geometryConverters.ThirdCoreHexToFullCoreChanger(self.o.cs) changer.convert(self.r) self.assertEqual(self.r.core.symmetry, geometry.FULL_CORE) self.assertEqual(initialNumBlocks, len(self.r.core.getBlocks())) changer.restorePreviousGeometry(self.o.cs, self.r) self.assertEqual(initialNumBlocks, len(self.r.core.getBlocks())) self.assertEqual(self.r.core.symmetry, geometry.FULL_CORE)