Esempio n. 1
0
 def test_cube_normals(self, tmpdir):
     """Generate a gmy from a simple cubic profile and check the computed 
     normals.
     """
     cube = fixtures.cube(tmpdir)
     cube.VoxelSize = 0.23
     cube.StlFileUnitId = 0
     
     """The default VTK cube has 1m edges and it is centred at the origin 
     of coordinates. We place the inlet and the outlet at the faces 
     perpendicular to the z axis.
     """
     inlet = Iolet(Name='inlet',
                   Centre=Vector(0., 0., -0.5),
                   Normal=Vector(0., 0., -1.),
                   Radius=np.sqrt(2) / 2)
     outlet = Iolet(Name='outlet',
                    Centre=Vector(0., 0., 0.5),
                    Normal=Vector(0., 0., 1.),
                    Radius=np.sqrt(2) / 2)
     cube.Iolets = [inlet, outlet]
      
     generator = OutputGeneration.PolyDataGenerator(cube)
     generator.skipNonIntersectingBlocks = True
     generator.Execute()
     
     """Load back the resulting geometry file and assert things are as 
     expected
     """
     checker = CubeNormalsTestingGmyParser(cube.OutputGeometryFile, 
                                           cube.VoxelSize)
     checker.Load()
 def test_cube_normals(self, tmpdir):
     """Generate a gmy from a simple cubic profile and check the computed 
     normals.
     """
     cube = fixtures.cube(tmpdir)
     cube.VoxelSize = 0.23
     cube.StlFileUnitId = 0
     
     """The default VTK cube has 1m edges and it is centred at the origin 
     of coordinates. We place the inlet and the outlet at the faces 
     perpendicular to the z axis.
     """
     inlet = Iolet(Name='inlet',
                   Centre=Vector(0., 0., -0.5),
                   Normal=Vector(0., 0., -1.),
                   Radius=np.sqrt(2) / 2)
     outlet = Iolet(Name='outlet',
                    Centre=Vector(0., 0., 0.5),
                    Normal=Vector(0., 0., 1.),
                    Radius=np.sqrt(2) / 2)
     cube.Iolets = [inlet, outlet]
      
     generator = OutputGeneration.PolyDataGenerator(cube)
     generator.skipNonIntersectingBlocks = True
     generator.Execute()
     
     """Load back the resulting geometry file and assert things are as 
     expected
     """
     checker = CubeNormalsTestingGmyParser(cube.OutputGeometryFile, 
                                           cube.VoxelSize)
     checker.Load()
Esempio n. 3
0
    def test_cube(self, tmpdir):
        """Generate a gmy from a simple cubic profile and check the output"""
        cube = fixtures.cube(tmpdir)
        cube.VoxelSize = 0.23
        cube.StlFileUnitId = 0
        generator = OutputGeneration.PolyDataGenerator(cube)
        generator.Execute()
        # Load back the resulting geometry file and assert things are as
        # expected
        checker = CubeTestingGmyParser(cube.OutputGeometryFile, cube.VoxelSize)
        checker.Load()

        fluid_sites = sum(checker.Domain.BlockFluidSiteCounts)
        block_count = len(checker.Domain.Blocks)
        block_size = checker.Domain.BlockSize
        sites = block_count * block_size ** 3
        # assert(sites==4096)
        # assert(fluid_sites==729)
        assert(sites != fluid_sites)
        # Now, turn on the skip-non-intersecting-blocks optimisation, and
        # assert same result
        generator.skipNonIntersectingBlocks = True
        generator.Execute()
        checker_skip_nonintersecting = CubeTestingGmyParser(
            cube.OutputGeometryFile, cube.VoxelSize)
        checker_skip_nonintersecting.Load()
        fluid_sites_nonintersecting = sum(
            checker_skip_nonintersecting.Domain.BlockFluidSiteCounts)
        assert(fluid_sites_nonintersecting == fluid_sites)
    def test_cube(self, tmpdir):
        """Generate a gmy from a simple cubic profile and check the output"""
        cube = fixtures.cube(tmpdir)
        cube.VoxelSize = 0.23
        cube.StlFileUnitId = 0
        generator = OutputGeneration.PolyDataGenerator(cube)
        generator.Execute()
        # Load back the resulting geometry file and assert things are as
        # expected
        checker = CubeTestingGmyParser(cube.OutputGeometryFile, cube.VoxelSize)
        checker.Load()

        fluid_sites = sum(checker.Domain.BlockFluidSiteCounts)
        block_count = len(checker.Domain.Blocks)
        block_size = checker.Domain.BlockSize
        sites = block_count * block_size ** 3
        # assert(sites==4096)
        # assert(fluid_sites==729)
        assert(sites != fluid_sites)
        # Now, turn on the skip-non-intersecting-blocks optimisation, and
        # assert same result
        generator.skipNonIntersectingBlocks = True
        generator.Execute()
        checker_skip_nonintersecting = CubeTestingGmyParser(
            cube.OutputGeometryFile, cube.VoxelSize)
        checker_skip_nonintersecting.Load()
        fluid_sites_nonintersecting = sum(
            checker_skip_nonintersecting.Domain.BlockFluidSiteCounts)
        assert(fluid_sites_nonintersecting == fluid_sites)