Exemplo n.º 1
0
        public Grid <Vector2Int, Vector2> MakeGrid2Di(CenterType type, DataType dataType, Grid2DConfigure config)
        {
            Grid <Vector2Int, Vector2> ret = Grid <Vector2Int, Vector2> .NullGrid.Instance;

            switch (dataType)
            {
            case DataType.Scalar:
            {
                if (type == CenterType.CellCentered)
                {
                    ret = new CellCenteredScalarGrid2Di(config.Resolution, config.CellSize, config.Origin);
                }
                else
                {
                    Assert.IsFalse(true);
                }
            }
            break;

            case DataType.Vector:     //no vector int grid for now
            default: Assert.IsFalse(true); break;
            }

            return(ret);
        }
Exemplo n.º 2
0
        protected void InitData()
        {
            Grid2DConfigure config = new Grid2DConfigure();

            config.CellSize   = new Vector2(cellSpace, cellSpace);
            config.Resolution = this.gridSize;

            this.velocity      = factory.MakeGrid2D(GridFactory.CenterType.FaceCentered, GridFactory.DataType.Vector, config) as FaceCenterdVectorGrid2D;
            this.savedVelocity = factory.MakeGrid2D(GridFactory.CenterType.FaceCentered, GridFactory.DataType.Vector, config) as FaceCenterdVectorGrid2D;
            //this.weightSum = factory.MakeGrid2D(GridFactory.CenterType.FaceCentered, GridFactory.DataType.Vector, config) as FaceCenteredGrid2D;

            this.pressure = factory.MakeGrid2D(GridFactory.CenterType.CellCentered, GridFactory.DataType.Scalar, config) as CellCenteredScalarGrid2D;
            this.marker   = factory.MakeGrid2Di(GridFactory.CenterType.CellCentered, GridFactory.DataType.Scalar, config) as CellCenteredScalarGrid2Di;
            this.phi      = factory.MakeGrid2D(GridFactory.CenterType.CellCentered, GridFactory.DataType.Scalar, config) as CellCenteredScalarGrid2D;

            this.poisson        = factory.MakeGrid2D(GridFactory.CenterType.CellCentered, GridFactory.DataType.Vector, config) as CellCenteredVectorGrid2D;
            this.preconditioner = factory.MakeGrid2D(GridFactory.CenterType.CellCentered, GridFactory.DataType.Scalar, config) as CellCenteredScalarGrid2D;

            this.mField = factory.MakeGrid2D(GridFactory.CenterType.CellCentered, GridFactory.DataType.Scalar, config) as CellCenteredScalarGrid2D;
            this.r      = factory.MakeGrid2D(GridFactory.CenterType.CellCentered, GridFactory.DataType.Scalar, config) as CellCenteredScalarGrid2D;
            this.z      = factory.MakeGrid2D(GridFactory.CenterType.CellCentered, GridFactory.DataType.Scalar, config) as CellCenteredScalarGrid2D;
            this.s      = factory.MakeGrid2D(GridFactory.CenterType.CellCentered, GridFactory.DataType.Scalar, config) as CellCenteredScalarGrid2D;
        }