Ejemplo n.º 1
0
        /*
         * // make fluid drop
         * public void AddFluidToPoint(int x,int y,int size)
         * {
         * int i=x;
         * int j=y;
         *
         * PointToCell(x,y,ref i,ref j);
         *
         * fluid.SETBCOND();
         * int color=100;
         *
         * for(int n=i;n<i+size;n++)
         * for(int m=j;m<j+size;m++)
         * {
         *  if (fluid.GetCellType(n,m) == Fluid2D.CellType.CELL_EMPTY)
         *    fluid.MakeParticlesInCell(n,m,color);
         * }
         * }
         */
        // process physic step of fluid
        public void RunPhysicStep(bool onestep)
        {
            if (pause)
            {
                if (onestep == false)
                {
                    return;
                }
            }

            //  static bool added=false;
//      int xnum = 0, ynum = 0;
            // fluid.GetDomainSize(ref xnum, ref ynum);
            TimeUtil tu = TimeUtil.Instance();

            for (int n = 0; n <= runcount; n++)
            {
                tu.StartTimer(0);
                fluid.RunPhysic();
                tu.StopTimer(0);
                if (sleeptimems != 0)
                {
                    System.Threading.Thread.Sleep(sleeptimems);
                }
            }


            /*
             * ToFile("u.txt", 1);
             * ToFile("v.txt", 2);
             * ToFile("f.txt", 3);
             * ToFile("g.txt", 4);
             * ToFile("p.txt", 5);
             */
        }
Ejemplo n.º 2
0
        /*
         * // make fluid drop
         * public void AddFluidToPoint(int x,int y,int size)
         * {
         * int i=x;
         * int j=y;
         *
         * PointToCell(x,y,ref i,ref j);
         *
         * fluid.SETBCOND();
         * int color=100;
         *
         * for(int n=i;n<i+size;n++)
         * for(int m=j;m<j+size;m++)
         * {
         *  if (fluid.GetCellType(n,m) == Fluid2D.CellType.CELL_EMPTY)
         *    fluid.MakeParticlesInCell(n,m,color);
         * }
         * }
         */
        // process physic step of fluid
        public void RunPhysicStep(bool onestep)
        {
            if (pause)
            {
                if (onestep == false)
                {
                    return;
                }
            }

            //  static bool added=false;
            int xnum = 0, ynum = 0;
            // fluid.GetDomainSize(ref xnum, ref ynum);
            TimeUtil tu = TimeUtil.Instance();

//      for (int n = 0; n < 3; n++)
            {
                tu.StartTimer(0);
                fluid.RunPhysic();
                tu.StopTimer(0);
            }


            /*
             * ToFile("u.txt", 1);
             * ToFile("v.txt", 2);
             * ToFile("f.txt", 3);
             * ToFile("g.txt", 4);
             * ToFile("p.txt", 5);
             */
        }
Ejemplo n.º 3
0
        public World GetScene()
        {
            World world = new World();

            fluid.GetDomainSize(ref world.xnum, ref world.ynum);
            TimeUtil tu = TimeUtil.Instance();

            tu.timers[0].Copy(world.timers[0]);
            return(world);
        }