namespace FluidSim.Core
{
    public class GhostBuffer
    {
        public float[] Rho, U, P, Y;
        public int PipeCount { get; }

        public GhostBuffer(int pipeCount)
        {
            PipeCount = pipeCount;
            int size = pipeCount * 2;
            Rho = new float[size];
            U = new float[size];
            P = new float[size];
            Y = new float[size];
        }

        public void Set(int pipeIndex, bool isLeftEnd, float rho, float u, float p, float y)
        {
            int idx = pipeIndex * 2 + (isLeftEnd ? 0 : 1);
            Rho[idx] = rho;
            U[idx] = u;
            P[idx] = p;
            Y[idx] = y;
        }
    }
}