示例#1
0
        static void UpdateRepo(string dir, string expected)
        {
            List <string> resultList;

            HG.InvokeCommand(dir, "update -C", out resultList);
            Assert.AreEqual(1, resultList.Count);
            Assert.AreEqual(expected, resultList[0]);
        }
示例#2
0
 /**
  * Recursively walk the tree to do hackwalk calculation
  */
 public override HG walkSubTree(double dsq, HG hg)
 {
     if (this != hg.pskip)
     {
         hg = gravSub(hg);
     }
     return(hg);
 }
示例#3
0
文件: HG.cs 项目: lewurm/benchmarker
		/**
	 * Create a HG  object.
	 *
	 * @param b the body object
	 * @param p a vector that represents the body
	 */
		public static HG makeHG (Body b, MathVector p)
		{
			HG hg = new HG ();
			hg.pskip = b;
			hg.pos0 = p.cloneMathVector ();
			hg.phi0 = 0.0;
			hg.acc0 = MathVector.makeMathVector ();
			return hg;
		}
示例#4
0
    /**
     * Evaluate gravitational field on the body.
     * The original olden version calls a routine named "walkscan",
     * but we use the same name that is in the Barnes code.
     */
    public void hackGravity(double rsize, Node root)
    {
        MathVector pos0 = pos.cloneMathVector();

        HG hg = HG.makeHG(this, pos);

        hg     = root.walkSubTree(rsize * rsize, hg);
        phi    = hg.phi0;
        newAcc = hg.acc0;
    }
示例#5
0
        /**
         * Create a HG  object.
         *
         * @param b the body object
         * @param p a vector that represents the body
         */
        public static HG makeHG(Body b, MathVector p)
        {
            HG hg = new HG();

            hg.pskip = b;
            hg.pos0  = p.cloneMathVector();
            hg.phi0  = 0.0;
            hg.acc0  = MathVector.makeMathVector();
            return(hg);
        }
示例#6
0
    /**
     * Decide if the cell is too close to accept as a single term.
     *
     * @return true if the cell is too close.
     */
    public bool subdivp(double dsq, HG hg)
    {
        MathVector dr = MathVector.makeMathVector();

        dr.subtraction2(pos, hg.pos0);
        double drsq = dr.dotProduct();

        // in the original olden version drsp is multiplied by 1.0
        return(drsq < dsq);
    }
示例#7
0
        public void AddFile()
        {
            string nName = TestContext.TestDir + "\\HGCommandsTest\\TheApp\\NewFile.txt";

            File.Create(nName);

            Dictionary <string, char> fileStatusDictionary;

            Assert.IsTrue(HG.AddFiles(new string[] { nName }, out fileStatusDictionary), "add file");
            char status = fileStatusDictionary[nName];

            Assert.AreEqual(status, 'A');
        }
示例#8
0
	/**
	 * Compute a single body-body or body-cell interaction
	 */
	public HG gravSub(HG hg)
	{
		MathVector dr = MathVector.makeMathVector();
		dr.subtraction2(pos, hg.pos0);

		double drsq = dr.dotProduct() + (EPS * EPS);
		double drabs = Math.Sqrt(drsq);

		double phii = mass / drabs;
		hg.phi0 -= phii;
		double mor3 = phii / drsq;
		dr.multScalar1(mor3);
		hg.acc0.addition(dr);
		return hg;
	}
示例#9
0
    /**
     * Compute a single body-body or body-cell interaction
     */
    public HG gravSub(HG hg)
    {
        MathVector dr = MathVector.makeMathVector();

        dr.subtraction2(pos, hg.pos0);

        double drsq  = dr.dotProduct() + (EPS * EPS);
        double drabs = Math.Sqrt(drsq);

        double phii = mass / drabs;

        hg.phi0 -= phii;
        double mor3 = phii / drsq;

        dr.multScalar1(mor3);
        hg.acc0.addition(dr);
        return(hg);
    }
示例#10
0
    /**
     * Recursively walk the tree to do hackwalk calculation
     */
    public override HG walkSubTree(double dsq, HG hg)
    {
        if (subdivp(dsq, hg))
        {
            for (int k = 0; k < Cell.NSUB; k++)
            {
                Node r = this.subp[k];
                if (r != null)
                {
                    hg = r.walkSubTree(dsq / 4.0, hg);
                }
            }
        }
        else
        {
            hg = gravSub(hg);
        }

        return(hg);
    }
示例#11
0
    public Hand()
    {
        this.hg      = new HG();
        this.hg.left = new XY[21];
        for (int i = 0; i < 21; i++)
        {
            XY xy = new XY();
            xy.x            = 1;
            xy.y            = 2;
            this.hg.left[i] = xy;
        }
        this.hg.right = new XY[21];
        for (int i = 0; i < 21; i++)
        {
            XY xy = new XY();
            xy.x             = 1;
            xy.y             = 2;
            this.hg.right[i] = xy;
        }
        var reSerializedJson = JsonConvert.SerializeObject(this.hg);

        this.hg = JsonConvert.DeserializeObject <HG>(reSerializedJson);
    }
 public static bool DeleteReparseInformation(this FileSystemInfo dir, uint reparseTag)
 {
     using (SafeFileHandle hFile = dir.GetHandle())
     {
         ReparseDataBuffer buffer;
         dir.GetReparseInformation(out buffer);
         buffer.ReparseDataLength = 0;
         using (HG<ReparseDataBuffer> hg = new HG<ReparseDataBuffer>(buffer))
         {
             int bytesReturned = 0;
             bool rc = Kernel32.DeviceIoControl(
                 hFile,
                 EIOControlCode.FsctlDeleteReparsePoint,
                 hg.Pointer,
                 (ushort)Constants.REPARSE_MOUNTPOINT_HEADER_SIZE,
                 IntPtr.Zero,
                 0,
                 ref bytesReturned,
                 IntPtr.Zero);
             return rc;
         }
     }
 }
 public static bool GetReparseInformation(this FileSystemInfo dir, out ReparseDataBuffer buffer)
 {
     using (SafeFileHandle hFile = dir.GetHandle())
     {
         using (HG<ReparseDataBuffer> hg = new HG<ReparseDataBuffer>())
         {
             int bytesReturned = 0;
             bool rc = Kernel32.DeviceIoControl(
                 hFile,
                 EIOControlCode.FsctlGetReparsePoint,
                 IntPtr.Zero,
                 0,
                 hg.Pointer,
                 hg.SizeOf,
                 ref bytesReturned,
                 IntPtr.Zero);
             buffer = hg.Structure;
             return rc;
         }
     }
 }
示例#14
0
	/**
	 * Recursively walk the tree to do hackwalk calculation
	 */
	public override HG walkSubTree(double dsq, HG hg)
	{
		if(this != hg.pskip)
			hg = gravSub(hg);
		return hg;
	}
示例#15
0
	/**
	 * Decide if the cell is too close to accept as a single term.
	 *
	 * @return true if the cell is too close.
	 */
	public bool subdivp(double dsq, HG hg)
	{
		MathVector dr = MathVector.makeMathVector();
		dr.subtraction2(pos, hg.pos0);
		double drsq = dr.dotProduct();

		// in the original olden version drsp is multiplied by 1.0
		return (drsq < dsq);
	}
示例#16
0
 public Hand(string json)
 {
     this.hg = JsonConvert.DeserializeObject <HG>(json);
 }
示例#17
0
 public abstract HG walkSubTree(double dsq, HG hg);
示例#18
0
	/**
	 * Recursively walk the tree to do hackwalk calculation
	 */
	public override HG walkSubTree(double dsq, HG hg)
	{
		if(subdivp(dsq, hg))
		{
			for(int k = 0; k < Cell.NSUB; k++)
			{
				Node r = this.subp[k];
				if(r != null)
					hg = r.walkSubTree(dsq / 4.0, hg);
			}
		}
		else
			hg = gravSub(hg);

		return hg;
	}
示例#19
0
	public abstract HG walkSubTree(double dsq, HG hg);