Ejemplo n.º 1
0
    void Prepare()
    {
        fft = isf.fft;
        fft.init();

        isf.hbar        = HBar;
        isf.estimate_dt = 1.0f / InvDt;

        isf.InitComputeShader();
        isf.InitISF();



        InitComputeShader();

        var N = isf.N;

        psi1     = FFT.CreateRenderTexture3D(N[0], N[1], N[2], RenderTextureFormat.RGFloat);
        psi2     = FFT.CreateRenderTexture3D(N[0], N[1], N[2], RenderTextureFormat.RGFloat);
        psi_mask = FFT.CreateRenderTexture3D(N[0], N[1], N[2], RenderTextureFormat.RFloat);

        isf.InitializePsi(ref psi1, ref psi2);



        //for(int i = 0; i < 10; ++i)
        //{
        //UpdatePsi(ref psi1, ref psi2);
        //}

        //fft.ExportComplex3D(psi1, "test/ink.psi1.json");
        InitilizeParticles();
    }
Ejemplo n.º 2
0
    void Prepare()
    {
        InitScale();

        fft = isf.fft;
        fft.init();

        isf.hbar        = HBar;
        isf.size        = Size;
        isf.N           = N;
        isf.estimate_dt = 1.0f / DtInv;

        NFloat = ISFUtils.IntToFloat(N);


        isf.InitComputeShader();
        isf.InitISF();

        psi1 = FFT.CreateRenderTexture3D(N[0], N[1], N[2], RenderTextureFormat.RGFloat);
        psi2 = FFT.CreateRenderTexture3D(N[0], N[1], N[2], RenderTextureFormat.RGFloat);
        isf.InitializePsi(ref psi1, ref psi2);


        InitComputeShader();
        InitPsi(ref psi1, ref psi2);
        InitParticles();
    }
Ejemplo n.º 3
0
    public void RunMyTest()
    {
        Texture3D tex_psi1;
        Texture3D tex_psi2;

        var psi1 = fft.LoadJson3D("test/psi1.json", out tex_psi1);
        var psi2 = fft.LoadJson3D("test/psi2.json", out tex_psi2);

        UpdateNozzles();
        // fft.ExportFloat1_3D(NozzleRT, "test/isf.nozzle.json");

        var N = isf.N;
        // Nozzle mask
        // =====================
        var rtf4 = FFT.CreateRenderTexture3D(N[0], N[1], N[2]);

        DebugRT = rtf4;
        CS.SetTexture(kernelZeroOutDebugOutput, "DebugOutput", rtf4);
        DispatchCS(kernelZeroOutDebugOutput);

        CS.SetTexture(kernelBlitDebugMask, "Nozzle", NozzleRT);
        CS.SetTexture(kernelBlitDebugMask, "DebugOutput", rtf4);
        DispatchCS(kernelBlitDebugMask);
        fft.ExportFloat4_3D(rtf4, "test/isf.nozzle.mask.json");

        DispatchCS(kernelZeroOutDebugOutput);

        isf.InitializePsi(ref psi1, ref psi2);
        for (int i = 0; i < 10; ++i)
        {
            InitilizeNozzlePsi(ref psi1, ref psi2);
        }

        fft.ExportComplex3D(psi1, "test/isf.ini.ps1.json");
        fft.ExportComplex3D(psi2, "test/isf.ini.ps2.json");

        fft.ExportFloat4_3D(rtf4, "test/isf.phase.json");

        // Application.Quit(0);
    }
Ejemplo n.º 4
0
    void TakeTestN(Vector3Int N)
    {
        isf.N = N;


        isf.InitISF();

        psi1 = FFT.CreateRenderTexture3D(N[0], N[1], N[2], RenderTextureFormat.RGFloat);
        psi2 = FFT.CreateRenderTexture3D(N[0], N[1], N[2], RenderTextureFormat.RGFloat);
        isf.InitializePsi(ref psi1, ref psi2);

        var watch = new System.Diagnostics.Stopwatch();

        watch.Start();

        for (int i = 0; i < 5; ++i)
        {
            isf.current_tick += 1;

            isf.ShroedingerIntegration(ref psi1, ref psi2);
            isf.Normalize(ref psi1, ref psi2);
            isf.PressureProject(ref psi1, ref psi2);
            fft.ExportComplex3D(psi1, null);
            Debug.Log("  At: " + i.ToString());
        }

        watch.Stop();
        BenchmarkSingleResult ben = new BenchmarkSingleResult();

        ben.milli = watch.ElapsedMilliseconds / 5.0;
        ben.Nx    = N.x;
        ben.Ny    = N.y;
        ben.Nz    = N.z;
        ben.scale = N.x * N.y * N.z;

        result.results.Add(ben);
    }