Exemplo n.º 1
0
 public FluidSimulationFrame(IntSize3 leveSetSizeStokesSize, int numParticles, IntSize3 navierStokesSize, float navierStokesCellSize)
 {
     LeveSetSizeStokesSize = leveSetSizeStokesSize;
     Particles             = new Vector3[numParticles];
     Phi              = new double[leveSetSizeStokesSize.Volume()];
     ParticleMask     = new bool[leveSetSizeStokesSize.Volume()];
     NavierStokesGrid = new NavierStokesGrid(navierStokesSize, navierStokesCellSize);
 }
Exemplo n.º 2
0
        public LevelSet(IntSize3 size, float cellSize, INavierStokesGrid grid)
        {
            Size         = size;
            CellSize     = cellSize;
            phi          = new double[size.Volume()];
            backPhi      = new double[size.Volume()];
            mass         = new float[size.Volume()];
            backMass     = new float[size.Volume()];
            states       = new NavierStokesCellState[size.Volume()];
            particleMass = new float[size.Volume()];
            particleMask = new bool[size.Volume()];

            for (int j = 0; j < Size.Height - 1; j++)
            {
                for (int i = 0; i < Size.Width - 1; i++)
                {
                    var point = new Vector3(i, j, 0) * CellSize;
                    State(i, j) = grid.StateAtPoint(point);
                }
            }
        }