Exemplo n.º 1
0
 private void slUmfang_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
 {
     try
     {
         var bh = new BH(lblunu.Content.ToString(),
                         lblob.Content.ToString());
         txtbh.Text = bh.ToString();
     }
     catch
     {
         if (txtbh != null)
         {
             txtbh.Text = "-- -";
         }
     }
 }
Exemplo n.º 2
0
    public void DestroyAllEnemies()
    {
        if (GameObject.FindGameObjectsWithTag("Enemy").Length > 0)
        {
            enemies = GameObject.FindGameObjectsWithTag("Enemy");
            foreach (GameObject enemy in enemies)
            {
                enemy.GetComponent <Enemy>().DestroyEnemy();
            }
        }

        if (GameObject.FindGameObjectsWithTag("BH").Length > 0)
        {
            BHs = GameObject.FindGameObjectsWithTag("BH");
            foreach (GameObject BH in BHs)
            {
                BH.GetComponent <BalckHoleBehavior>().DestroyBH();
            }
        }
        aliveEnemies = 0;
    }
Exemplo n.º 3
0
        /// <summary>
        /// Assuming a FEMM window is opened, build rotor into that
        /// </summary>
        /// <param name="MaterialParams"></param>
        public override void BuildInFEMM(FEMM femm = null)
        {
            if (femm == null)
            {
                femm = FEMM.DefaultFEMM;
            }

            bool fullbuild = Motor.GeneralParams.FullBuildFEMModel;

            // create material data
            femm.mi_addmaterialAir(AirMaterialName);
            femm.mi_addmaterialMagnet(MagnetMaterialName, mu_M, Hc, 0);
            femm.mi_addmaterialSteel(SteelMaterialName, 1, 1, Lam_d, Lam_fill, FEMM.LaminationType.NotLaminated,
                                     BH.Select(p => p.b).ToArray(), BH.Select(p => p.h).ToArray());

            // create boundary data
            femm.mi_addboundprop_Prescribed_A(BoundaryProperty, 0, 0, 0, 0);

            /////// Build 1 poles
            ////Half one
            // segments (magnet)
            femm.mi_addSegmentEx(xA, yA, xB, yB, Group_Lines_Rotor); //AB
            femm.mi_addSegmentEx(xB, yB, xE, yE, Group_Lines_Rotor); //BE
            femm.mi_addSegmentEx(xD, yD, xE, yE, Group_Lines_Rotor); //DE
            femm.mi_addSegmentEx(xE, yE, xF, yF, Group_Lines_Rotor); //EF
            femm.mi_addSegmentEx(xF, yF, xC, yC, Group_Lines_Rotor); //FC
            femm.mi_addSegmentEx(xD, yD, xG, yG, Group_Lines_Rotor); //DG
            femm.mi_addSegmentEx(xH, yH, xG, yG, Group_Lines_Rotor); //HG
            femm.mi_addSegmentEx(xH, yH, xI, yI, Group_Lines_Rotor); //HI
            femm.mi_addSegmentEx(xI, yI, xF, yF, Group_Lines_Rotor); //IF
            femm.mi_addSegmentEx(xH, yH, xJ, yJ, Group_Lines_Rotor); //HJ
            femm.mi_addSegmentEx(xI, yI, xK, yK, Group_Lines_Rotor); //IK
            if (Poletype == PoleType.MiddleAir)
            {
                femm.mi_addSegmentEx(xJ, yJ, xJ, 0, Group_Lines_Rotor);//JJ1
            }
            else
            {
                femm.mi_addSegmentEx(xJ, yJ, xK, yK, Group_Lines_Rotor); //JK
            }
            // arcsegments AC
            double a = (Math.Atan(yA / xA) - Math.Atan(yC / xC)) * 180 / Math.PI;

            femm.mi_addArcEx(xC, yC, xA, yA, a, 1, Group_Lines_Rotor);
            // arcsegment RS
            femm.mi_addArcEx(xR, yR, xS, yS, alphaDegree, 1, Group_Lines_Rotor);

            // blocks
            // air block label
            double air1X = (xA + xB + xC) / 3;
            double air1Y = (yA + yB + yC) / 3;

            femm.mi_addBlockLabelEx(air1X, air1Y, AirMaterialName, Group_BlockLabel_Magnet_Air);
            //FEMM.mi_addBlockLabelEx(air1X, -air1Y, AirBlockName, Group_Label);

            if (Poletype != PoleType.MiddleAir)
            {
                double air2X = (xJ + xK + xI + xH) / 4;
                double air2Y = (yJ + yK + yI + yH) / 4;
                femm.mi_addBlockLabelEx(air2X, air2Y, AirMaterialName, Group_BlockLabel_Magnet_Air);
                //  femm.mi_addBlockLabelEx(air2X, -air2Y, AirBlockName, Group_Label);
            }

            // magnet block label
            double magBlockLabelX = (xD + xI) / 2;
            double magBlockLabelY = (yD + yI) / 2;

            femm.mi_addBlockLabelEx(magBlockLabelX, magBlockLabelY, MagnetMaterialName, Group_BlockLabel_Magnet_Air, alphaM * 180 / Math.PI - 90 + 180);//+180 but set back later
            //femm.mi_addBlockLabelEx(magBlockLabelX, -magBlockLabelY, MagnetBlockName, Group_Label, 90 - alphaM * 180 / Math.PI + 180);

            ///// mirrored all
            femm.mi_clearselected();
            femm.mi_selectgroup(Group_Lines_Rotor);
            femm.mi_selectgroup(Group_BlockLabel_Magnet_Air);
            femm.mi_mirror(0, 0, 1, 0, FEMM.EditMode.group);

            //// the remainings: not symmetrical
            if (Poletype == PoleType.MiddleAir)
            {
                femm.mi_addBlockLabelEx((xJ + xK0) / 2, 0, AirMaterialName, Group_BlockLabel_Magnet_Air);
            }

            ////////// Build 2 poles
            // copy pole if full build
            if (fullbuild)
            {
                femm.mi_clearselected();
                femm.mi_selectgroup(Group_Lines_Rotor);
                femm.mi_selectgroup(Group_BlockLabel_Magnet_Air);
                femm.mi_copyrotate(0, 0, 360 / (2 * p), 1, FEMM.EditMode.group);
            }
            // rotate the magnet direction (of the first pole)
            femm.mi_clearselected();
            femm.mi_selectlabel(magBlockLabelX, magBlockLabelY);
            femm.mi_setblockprop(MagnetMaterialName, true, 0, "", alphaM * 180 / Math.PI - 90, Group_BlockLabel_Magnet_Air, 0);
            femm.mi_clearselected();
            femm.mi_selectlabel(magBlockLabelX, -magBlockLabelY);
            femm.mi_setblockprop(MagnetMaterialName, true, 0, "", 90 - alphaM * 180 / Math.PI, Group_BlockLabel_Magnet_Air, 0);

            if (fullbuild)
            {
                //////// Build p-1 pair of poles remaining
                femm.mi_clearselected();
                femm.mi_selectgroup(Group_Lines_Rotor);
                femm.mi_selectgroup(Group_BlockLabel_Magnet_Air);
                femm.mi_copyrotate(0, 0, 360 / p, p - 1, FEMM.EditMode.group);
            }

            /////// The remaining: not symmetrical: add label for rotor steel
            femm.mi_addBlockLabelEx((DiaYoke / 2 + O2 / 2), 0, SteelMaterialName, Group_BlockLabel_Steel);


            if (fullbuild)
            {
                // pre-rotate rotor (only in fullbuild)
                femm.mi_clearselected();
                femm.mi_selectgroup(Group_Lines_Rotor);
                femm.mi_selectgroup(Group_BlockLabel_Magnet_Air);
                femm.mi_selectgroup(Group_BlockLabel_Steel);
                femm.mi_moverotate(0, 0, PreviewRotateAngle, FEMM.EditMode.group);
            }

            if (!fullbuild)
            {
                //build boundary of motor: 2 lines, anti-periodic
                String boundaryName = "rotor-apb-1";
                femm.mi_addSegmentEx(0, 0, xS, yS, Group_Lines_Rotor);
                femm.mi_addSegmentEx(0, 0, xS, -yS, Group_Lines_Rotor);

                femm.mi_addboundprop_AntiPeriodic(boundaryName);

                femm.mi_clearselected();
                femm.mi_selectsegment(xS, yS);
                femm.mi_selectsegment(xS, -yS);
                femm.mi_setsegmentprop(boundaryName, 0, true, false, Group_Lines_Rotor);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Sauvegarde les changements effectués.
        /// </summary>
        public static bool Save()
        {
            try
            {
                lock (mySyncSave)
                {
                    long StartTime = Environment.TickCount;
                    Logger.Info("World saving ...");

                    // Execution des requetes
                    lock (mySaveQueue)
                        while (mySaveQueue.Count != 0)
                        {
                            mySaveQueue.Dequeue()();
                        }

                    lock (GuildTable.Cache)
                        foreach (var Guild in GuildTable.Cache.Values)
                        {
                            Guild.SaveChanges();
                            GuildTable.Update(Guild);
                        }

                    lock (CharacterTable.myCharacterById)
                        foreach (var Character in CharacterTable.myCharacterById.Values.Where(x => x.myInitialized))
                        {
                            CharacterTable.Update(Character);
                        }

                    lock (SpeakingTable.Cache)
                        foreach (var Speaking in SpeakingTable.Cache.Values)
                        {
                            SpeakingTable.Add(Speaking);
                        }

                    lock (AreaTable.Cache)
                        foreach (var area in AreaTable.Cache.Values)
                        {
                            AreaTable.Update(area);
                        }

                    lock (AreaSubTable.Cache)
                        foreach (var subarea in AreaSubTable.Cache.Values)
                        {
                            AreaSubTable.Save(subarea);
                        }

                    lock (BidHouseTable.Cache)
                    {
                        var BHI = new List <BidHouseItem>();
                        foreach (var BH in BidHouseTable.Cache.Values)
                        {
                            BHI.AddRange(BH.getAllEntry());
                        }
                        BidHouseTable.Update(BHI);
                    }

                    Logger.Info("World saved in " + (Environment.TickCount - StartTime) + "ms");

                    return(true);
                }
            }
            catch (Exception ex)
            {
                Logger.Error("DatabaseEntities::Save() " + ex.ToString());

                return(false);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Assuming a FEMM window is opened, build rotor into that
        /// </summary>
        /// <param name="MaterialParams"></param>
        public override void BuildInFEMM(FEMM femm = null)
        {
            if (femm == null)
            {
                femm = FEMM.DefaultFEMM;
            }

            bool fullbuild = Motor.GeneralParams.FullBuildFEMModel;

            // create material data
            //femm.mi_addmaterialAir(AirMaterialName);
            femm.mi_addmaterialMagnet(MagnetMaterialName, mu_M, Hc, 0);
            femm.mi_addmaterialSteel(SteelMaterialName, 1, 1, Lam_d, Lam_fill, FEMM.LaminationType.NotLaminated,
                                     BH.Select(p => p.b).ToArray(), BH.Select(p => p.h).ToArray());

            // create boundary data
            femm.mi_addboundprop_Prescribed_A(BoundaryProperty, 0, 0, 0, 0);

            /////// Build 1 poles
            ////Half one

            // arcsegments AC
            double a = GammaM / 180 * alphaDegree;

            femm.mi_addArcEx(xR, yR, xA, yA, a, 1, Group_Lines_Rotor);
            // arcsegment RS
            femm.mi_addArcEx(xRR, yRR, xSS, ySS, alphaDegree, 1, Group_Lines_Rotor);
            // segments (magnet)
            femm.mi_addSegmentEx(xA, yA, xB, yB, Group_Lines_Rotor);

            // blocks
            // magnet block label
            double magBlockLabelX = (xR + xRR) / 2;
            double magBlockLabelY = 0;

            femm.mi_addBlockLabelEx(magBlockLabelX, magBlockLabelY, MagnetMaterialName, Group_BlockLabel_Magnet_Air, 180);//+180 but set back later
            //femm.mi_addBlockLabelEx(magBlockLabelX, -magBlockLabelY, MagnetBlockName, Group_Label, 90 - alphaM * 180 / Math.PI + 180);

            ///// mirrored all
            femm.mi_clearselected();
            femm.mi_selectgroup(Group_Lines_Rotor);
            femm.mi_selectgroup(Group_BlockLabel_Magnet_Air);
            femm.mi_mirror(0, 0, 1, 0, FEMM.EditMode.group);

            ////////// Build 2 poles
            // copy pole if full build
            if (fullbuild)
            {
                femm.mi_clearselected();
                femm.mi_selectgroup(Group_Lines_Rotor);
                femm.mi_selectgroup(Group_BlockLabel_Magnet_Air);
                femm.mi_copyrotate(0, 0, 360 / (2 * p), 1, FEMM.EditMode.group);
            }
            // rotate the magnet direction (of the first pole)
            femm.mi_clearselected();
            femm.mi_selectlabel(magBlockLabelX, magBlockLabelY);
            femm.mi_setblockprop(MagnetMaterialName, true, 0, "", 0, Group_BlockLabel_Magnet_Air, 0);

            if (fullbuild)
            {
                //////// Build p-1 pair of poles remaining
                femm.mi_clearselected();
                femm.mi_selectgroup(Group_Lines_Rotor);
                femm.mi_selectgroup(Group_BlockLabel_Magnet_Air);
                femm.mi_copyrotate(0, 0, 360 / p, p - 1, FEMM.EditMode.group);
            }

            /////// The remaining: not symmetrical: add label for rotor steel
            femm.mi_addBlockLabelEx(RYoke / 2, 0, SteelMaterialName, Group_BlockLabel_Steel);


            if (fullbuild)
            {
                // pre-rotate rotor (only in fullbuild)
                femm.mi_clearselected();
                femm.mi_selectgroup(Group_Lines_Rotor);
                femm.mi_selectgroup(Group_BlockLabel_Magnet_Air);
                femm.mi_selectgroup(Group_BlockLabel_Steel);
                femm.mi_moverotate(0, 0, PreRotateAngle, FEMM.EditMode.group);
            }

            if (!fullbuild)
            {
                //build boundary of motor: 2 lines, anti-periodic
                String boundaryName = "rotor-apb-1";
                femm.mi_addSegmentEx(0, 0, xS, yS, Group_Lines_Rotor);
                femm.mi_addSegmentEx(0, 0, xS, -yS, Group_Lines_Rotor);

                femm.mi_addboundprop_AntiPeriodic(boundaryName);

                femm.mi_clearselected();
                femm.mi_selectsegment(xS, yS);
                femm.mi_selectsegment(xS, -yS);
                femm.mi_setsegmentprop(boundaryName, 0, true, false, Group_Lines_Rotor);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Build Stator in FEMM
        /// </summary>
        /// <param name="MaterialParams"></param>
        public override void BuildInFEMM(FEMM femm = null)
        {
            if (femm == null)
            {
                femm = FEMM.DefaultFEMM;
            }

            AbstractRotor Rotor     = Motor.Rotor;
            bool          fullbuild = Motor.GeneralParams.FullBuildFEMModel;

            // create material
            femm.mi_addmaterialSteel(SteelMaterialName, 1, 1, Lam_d, Lam_fill, FEMM.LaminationType.NotLaminated,
                                     BH.Select(p => p.b).ToArray(), BH.Select(p => p.h).ToArray());
            femm.mi_addmaterialCopper(WireMaterialName, WireConduct, WireType, 1, WireDiameter);

            // create boundary
            femm.mi_addboundprop_Prescribed_A(BoundaryProperty, 0, 0, 0, 0);

            /////// Build half slot
            ////segments - lines
            femm.mi_addSegmentEx(xB, yB, xC, yC, Group_Lines_Stator); //BC
            femm.mi_addSegmentEx(xD, yD, xE, yE, Group_Lines_Stator); //DE
            femm.mi_addSegmentEx(xF, yF, xF, 0, Group_Lines_Stator);  //FF1
            if (yC != yCC)
            {
                femm.mi_addSegmentEx(xC, yC, xCC, yCC, Group_Lines_Stator);//CC'
            }
            //// arcsegments
            //BA
            double a = (Math.Atan(yA / xA) - Math.Atan(yB / xB)) * 180 / Math.PI;

            femm.mi_addArcEx(xB, yB, xA, yA, a, 1, Group_Lines_Stator);
            //DC'
            femm.mi_addArcEx(xD, yD, xCC, yCC, 90, 30, Group_Lines_Stator);
            //EF
            femm.mi_addArcEx(xF, yF, xE, yE, 90, 30, Group_Lines_Stator);

            //// the coil
            femm.mi_addSegmentEx(xD2, yD2, xE2, yE2, Group_Lines_Stator);
            femm.mi_addSegmentEx(xF2, yF2, xF2, 0, Group_Lines_Stator);
            femm.mi_addSegmentEx(xCC2, yCC2, xCC2, 0, Group_Lines_Stator);
            //CC2-D2
            femm.mi_addArcEx(xD2, yD2, xCC2, yCC2, 90, 30, Group_Lines_Stator);
            //EF
            femm.mi_addArcEx(xF2, yF2, xE2, yE2, 90, 30, Group_Lines_Stator);

            ////// mirrored half to one
            femm.mi_clearselected();
            femm.mi_selectgroup(Group_Lines_Stator);
            femm.mi_mirror(0, 0, 1, 0, FEMM.EditMode.group);

            //////// Build Q slots (copy)
            femm.mi_clearselected();
            femm.mi_selectgroup(Group_Lines_Stator);
            femm.mi_selectgroup(Group_BlockLabel_Wire);
            if (fullbuild)
            {
                femm.mi_copyrotate(0, 0, 360.0 / Q, Q - 1, FEMM.EditMode.group);
            }
            else
            {
                femm.mi_copyrotate(0, 0, 360.0 / Q, Q / (2 * Rotor.p) - 1, FEMM.EditMode.group);

                // rotate so they match with rotor
                femm.mi_clearselected();
                femm.mi_selectgroup(Group_Lines_Stator);
                femm.mi_selectgroup(Group_BlockLabel_Wire);
                // rotate angle to
                double shiftangle = -Rotor.alphaDegree + 180.0 / Q;
                femm.mi_moverotate(0, 0, shiftangle, FEMM.EditMode.group);
            }

            ////// Block labels (steel)
            femm.mi_addBlockLabelEx((xF + Rstator) / 2, 0, SteelMaterialName, Group_BlockLabel_Steel);

            /////// Stator outer lines (2 arcs)
            if (fullbuild)
            {
                femm.mi_addArcEx(Rstator, 0, -Rstator, 0, 180, 10, Group_Lines_Stator);
                femm.mi_addArcEx(-Rstator, 0, Rstator, 0, 180, 10, Group_Lines_Stator);
            }
            else
            {
                femm.mi_addArcEx(Rstator * Math.Cos(Rotor.alpha), -Rstator * Math.Sin(Rotor.alpha),
                                 Rstator * Math.Cos(Rotor.alpha), Rstator * Math.Sin(Rotor.alpha), 2 * Rotor.alphaDegree, 10, Group_Lines_Stator);
            }

            // Set boundary condition for outline stator
            femm.mi_clearselected();
            if (fullbuild)
            {
                femm.mi_selectarcsegment(0, Rstator);
                femm.mi_selectarcsegment(0, -Rstator);
            }
            else
            {
                femm.mi_selectarcsegment(Rstator, 0);
            }

            femm.mi_setarcsegmentprop(10, BoundaryProperty, false, Group_Lines_Stator);

            /////// Wire, circuits in slot
            foreach (Circuit c in circuits)
            {
                femm.mi_addcircprop(c.name, c.current, c.circuitType);
            }

            double r = (xD + xE) / 2;

            foreach (Coil sci in coils)
            {
                int i = coils.IndexOf(sci);

                if (fullbuild)
                {
                    //angle go clockwise from 3 o'clock (=0 degree in decarter),
                    double aa = -2 * Math.PI * i / Q;
                    double x  = r * Math.Cos(aa);
                    double y  = r * Math.Sin(aa);
                    femm.mi_addBlockLabelEx(x, y, WireMaterialName, Group_BlockLabel_Wire, sci.inCircuit, sci.Nturns);
                }
                else
                {
                    //angle go clockwise from 3 o'clock (=0 degree in decarter), shift +pi/Q (to match rotor)
                    int    nn = Q / (2 * Rotor.p);
                    double aa = -2 * Math.PI * i / Q + (nn % 2 == 0 ? Math.PI / Q : 0);
                    double x  = r * Math.Cos(aa);
                    double y  = r * Math.Sin(aa);
                    if (aa > -Rotor.alpha || aa < -2 * Math.PI + Rotor.alpha)
                    {
                        femm.mi_addBlockLabelEx(x, y, WireMaterialName, Group_BlockLabel_Wire, sci.inCircuit, sci.Nturns);
                    }
                }
            }

            if (fullbuild)
            {
                //pre-rotate stator (fullbuild only)
                femm.mi_clearselected();
                femm.mi_selectgroup(Group_Lines_Stator);
                femm.mi_selectgroup(Group_BlockLabel_Wire);
                femm.mi_selectgroup(Group_BlockLabel_Steel);
                femm.mi_moverotate(0, 0, PreRotateAngle, FEMM.EditMode.group);
            }

            if (!fullbuild)
            {
                //build boundary of motor: 2 lines, anti-periodic
                String boundaryName = "stator-apb-1";
                double x1           = Rinstator * Math.Cos(Rotor.alpha);
                double y1           = Rinstator * Math.Sin(Rotor.alpha);
                double x2           = Rstator * Math.Cos(Rotor.alpha);
                double y2           = Rstator * Math.Sin(Rotor.alpha);

                femm.mi_addSegmentEx(x1, y1, x2, y2, Group_Lines_Stator);
                femm.mi_addSegmentEx(x1, -y1, x2, -y2, Group_Lines_Stator);

                femm.mi_addboundprop_AntiPeriodic(boundaryName);

                femm.mi_clearselected();
                femm.mi_selectsegment(x2, y2);
                femm.mi_selectsegment(x2, -y2);
                femm.mi_setsegmentprop(boundaryName, 0, true, false, Group_Lines_Stator);
            }
        }
Exemplo n.º 7
0
        private models.Run Iteration(string benchmark, int iteration, bool isDryRun)
        {
            var dryRun = isDryRun ? " dryrun" : "";

            Logging.GetLogging().InfoFormat("Benchmarker | Benchmark{0} \"{1}\": start iteration {2}", dryRun, benchmark, iteration);
            GC.Collect(1);
            System.Threading.Thread.Sleep(5 * 1000);              // cool down?

            var sw = Stopwatch.StartNew();

            switch (benchmark)
            {
            case "bh":
                BH.Main(new string[] { "-b", "400", "-s", "200" }, Logging.GetLogging());
                break;

            case "binarytree":
                BinaryTrees.Main(new string[] { "17" }, Logging.GetLogging());
                break;

            case "bisort":
                BiSort.Main(new string[] { "-s", "1500000" }, Logging.GetLogging());
                break;

            case "euler":
                Euler.Main(new string[] { }, Logging.GetLogging());
                break;

            case "except":
                except.Main(new string[] { "500000" }, Logging.GetLogging());
                break;

            case "gcbridge-links":
                GcBridge.Main(new string[] { benchmark }, Logging.GetLogging());
                break;

            case "gcbridge-linkedfan":
                GcBridge.Main(new string[] { benchmark }, Logging.GetLogging());
                break;

            case "gcbridge-inversefan":
                GcBridge.Main(new string[] { benchmark }, Logging.GetLogging());
                break;

            case "gcbridge-deadlist":
                GcBridge.Main(new string[] { benchmark }, Logging.GetLogging());
                break;

            case "gcbridge-selflinks":
                GcBridge.Main(new string[] { benchmark }, Logging.GetLogging());
                break;

            case "gcbridge-spider":
                GcBridge.Main(new string[] { benchmark }, Logging.GetLogging());
                break;

            case "gcbridge-doublefan-1000":
                GcBridge.Main(new string[] { benchmark }, Logging.GetLogging());
                break;

            case "gcbridge-doublefan-4000":
                GcBridge.Main(new string[] { benchmark }, Logging.GetLogging());
                break;

            case "grandetracer":
                RayTracer.Main(new string[] { }, Logging.GetLogging());
                break;

            case "graph4":
                graph4.Node.Main(Logging.GetLogging());
                break;

            case "graph8":
                graph8.Node.Main(Logging.GetLogging());
                break;

            case "hash3":
                Hash3.Main(new string[] { "400000" }, Logging.GetLogging());
                break;

            case "health":
                Health.Main(new string[] { "-l", "10", "-t", "16" }, Logging.GetLogging());
                break;

            case "lists":
                Lists.Main(new string[] { "1000" }, Logging.GetLogging());
                break;

            case "mandelbrot":
                Mandelbrot.Main(new string[] { "1500" }, Logging.GetLogging());
                break;

            case "n-body":
                NBody.Main(new string[] { "400000" }, Logging.GetLogging());
                break;

            case "objinst":
                Objinst.Main(new string[] { "4000000" }, Logging.GetLogging());
                break;

            case "onelist":
                OneList.Main();
                break;

            case "perimeter":
                Perimeter.Main(new string[] { "-l", "17" }, Logging.GetLogging());
                break;

            case "raytracer2":
                RayTracer2.Main(new string[] { "120" }, Logging.GetLogging());
                break;

            case "raytracer3":
                RayTracer3.Main(new string[] { "120" }, Logging.GetLogging());
                break;

            case "scimark-fft":
                ScimarkEntrypoint.Main(new string[] { "fft" }, Logging.GetLogging());
                break;

            case "scimark-sor":
                ScimarkEntrypoint.Main(new string[] { "sor" }, Logging.GetLogging());
                break;

            case "scimark-mc":
                ScimarkEntrypoint.Main(new string[] { "mc" }, Logging.GetLogging());
                break;

            case "scimark-mm":
                ScimarkEntrypoint.Main(new string[] { "mm" }, Logging.GetLogging());
                break;

            case "scimark-lu":
                ScimarkEntrypoint.Main(new string[] { "lu" }, Logging.GetLogging());
                break;

            case "specraytracer":
                MainCL.Main(new string[] { "200", "1250" }, Logging.GetLogging());
                break;

            case "strcat":
                strcat.Main(new string[] { "40000000" });
                break;

            default:
                throw new NotImplementedException();
            }
            sw.Stop();
            Logging.GetLogging().InfoFormat("Benchmarker | Benchmark{0} \"{1}\": finished iteration {2}, took {3}ms", dryRun, benchmark, iteration, sw.ElapsedMilliseconds);
            var run = new models.Run {
                Benchmark = new models.Benchmark {
                    Name = benchmark
                }
            };

            run.RunMetrics.Add(
                new models.RunMetric {
                Metric = models.RunMetric.MetricType.Time,
                Value  = TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds)
            }
                );
            return(run);
        }
Exemplo n.º 8
0
    /**
     * Create the testdata used in the benchmark.
     *
     * @param nbody the number of bodies to create
     */
    public void createTestData(int nbody)
    {
        MathVector cmr = MathVector.makeMathVector();
        MathVector cmv = MathVector.makeMathVector();

        bodyTab = new List <Body>();

        double rsc  = 3.0 * 3.1415 / 16.0;
        double vsc  = Math.Sqrt(1.0 / rsc);
        double seed = 123.0;

        int k;

        for (int i = 0; i < nbody; i++)
        {
            Body p = Body.makeBody();
            bodyTab.Add(p);
            p.mass = 1.0 / (double)nbody;

            seed = BH.myRand(seed);
            double t1 = BH.xRand(0.0, 0.999, seed);
            t1 = Math.Pow(t1, (-2.0 / 3.0)) - 1.0;
            double r = 1.0 / Math.Sqrt(t1);

            double coeff = 4.0;
            for (k = 0; k < MathVector.NDIM; k++)
            {
                seed = BH.myRand(seed);
                r    = BH.xRand(0.0, 0.999, seed);
                p.pos.setValue(k, coeff * r);
            }

            cmr.addition(p.pos);

            double x = 0.0;
            double y = 0.0;
            do
            {
                seed = BH.myRand(seed);
                x    = BH.xRand(0.0, 1.0, seed);
                seed = BH.myRand(seed);
                y    = BH.xRand(0.0, 0.1, seed);
            } while(y > x * x * Math.Pow(1.0 - x * x, 3.5));

            double v = Math.Sqrt(2.0) * x / Math.Pow(1.0 + r * r, 0.25);

            double rad = vsc * v;
            double rsq = 0.0;
            do
            {
                for (k = 0; k < MathVector.NDIM; k++)
                {
                    seed = BH.myRand(seed);
                    p.vel.setValue(k, BH.xRand(-1.0, 1.0, seed));
                }
                rsq = p.vel.dotProduct();
            } while(rsq > 1.0);
            double rsc1 = rad / Math.Sqrt(rsq);
            p.vel.multScalar1(rsc1);
            cmv.addition(p.vel);
        }

        cmr.divScalar((double)nbody);
        cmv.divScalar((double)nbody);

        this.bodyTabRev = new List <Body>();

        for (int j = 0; j < this.bodyTab.Count; ++j)
        {
            Body b = this.bodyTab[j];
            b.pos.subtraction1(cmr);
            b.vel.subtraction1(cmv);
            this.bodyTabRev.Add(b);
        }
    }