Ejemplo n.º 1
0
 def test_readAsciimap(self):
     geom = SystemLayoutInput()
     geom._readYaml(io.StringIO(GEOM_INPUT_YAML))
     self.assertEqual(geom.assemTypeByIndices[(1, 1)], "IC")
     self.assertEqual(geom.assemTypeByIndices[(4, 1)], "US")
     # check top edge since it's complicated.
     self.assertEqual(geom.assemTypeByIndices[(10, 10)], "SH")
     self.assertEqual(geom.assemTypeByIndices[(11, 13)], "SH")
Ejemplo n.º 2
0
 def test_TRZyamlIO(self):
     geom = SystemLayoutInput()
     geom.readGeomFromFile(os.path.join(TEST_ROOT, "trz_geom.xml"))
     fName = "testTRZYamlIO.yaml"
     with open(fName, "w") as f:
         geom._writeYaml(f)  # pylint: disable=protected-access
     with open(fName) as f:
         geom2 = SystemLayoutInput()
         geom2._readYaml(f)  # pylint: disable=protected-access
     self.assertEqual(geom2.assemTypeByIndices[2.0, 3.0, 0.0, 180.0, 1, 1], "MC")
     os.remove(fName)
Ejemplo n.º 3
0
 def test_yamlIO(self):
     """Ensure we can read and write to YAML formatted streams."""
     geom = SystemLayoutInput()
     geom.readGeomFromStream(io.StringIO(GEOM_INPUT))
     fName = "testYamlIO.yaml"
     with open(fName, "w") as f:
         geom._writeYaml(f)  # pylint: disable=protected-access
     with open(fName) as f:
         geom2 = SystemLayoutInput()
         geom2._readYaml(f)  # pylint: disable=protected-access
     self.assertEqual(geom2.assemTypeByIndices[2, 2], "A2")
     os.remove(fName)
Ejemplo n.º 4
0
 def testReadReactor(self):
     reactor = test_reactors.buildOperatorOfEmptyHexBlocks().r
     reactor.core.symmetry = geometry.SymmetryType(
         geometry.DomainType.THIRD_CORE, geometry.BoundaryType.PERIODIC)
     geom = SystemLayoutInput.fromReactor(reactor)
     self.assertEqual(geom.assemTypeByIndices[(2, 1)], "fuel")
     self.assertEqual(str(geom.geomType), geometry.HEX)
Ejemplo n.º 5
0
 def testReadHexGeomXML(self):
     geom = SystemLayoutInput()
     geom.readGeomFromFile(os.path.join(TEST_ROOT, "geom.xml"))
     self.assertEqual(str(geom.geomType), geometry.HEX)
     self.assertEqual(geom.assemTypeByIndices[(1, 1)], "IC")
     out = os.path.join(TEST_ROOT, "geom-output.xml")
     geom.writeGeom(out)
     os.remove(out)
Ejemplo n.º 6
0
 def test_growToFullCore(self):
     geom = SystemLayoutInput()
     geom.readGeomFromStream(io.StringIO(GEOM_INPUT))
     self.assertNotIn((2, 3), geom.assemTypeByIndices)
     self.assertEqual(8, len(geom.assemTypeByIndices))
     geom.growToFullCore()
     self.assertEqual(geometry.FULL_CORE, str(geom.symmetry.domain))
     self.assertIn((2, 3), geom.assemTypeByIndices)
     self.assertIn(
         geom.assemTypeByIndices[2, 3],  # perodic repeat
         geom.assemTypeByIndices[2, 1],
     )  # from input
     self.assertEqual(1 + 6 + 12, len(geom.assemTypeByIndices))
Ejemplo n.º 7
0
 def testReadTRZGeomXML(self):
     geom = SystemLayoutInput()
     geom.readGeomFromFile(os.path.join(TEST_ROOT, "trz_geom.xml"))
     self.assertEqual(str(geom.geomType), geometry.RZT)
     self.assertEqual(geom.assemTypeByIndices[(0.0, 2.0, 0.0, 360.0, 1, 1)],
                      "IC")
Ejemplo n.º 8
0
 def test_asciimap(self):  # pylint: disable=no-self-use
     """Ensure this can write ascii maps"""
     geom = SystemLayoutInput()
     geom.readGeomFromStream(io.StringIO(GEOM_INPUT))
     geom._writeAsciiMap()
Ejemplo n.º 9
0
 def testReadReactor(self):
     reactor = test_reactors.buildOperatorOfEmptyHexBlocks().r
     reactor.core.symmetry = geometry.THIRD_CORE + geometry.PERIODIC
     geom = SystemLayoutInput.fromReactor(reactor)
     self.assertEqual(geom.assemTypeByIndices[(2, 1)], "fuel")
     self.assertEqual(geom.geomType, "hex")