Exemplo n.º 1
0
void GUI(void){	
  SetDefaultLineType(0);
  DefineGraphNxN_R("phi", &phi[0][0], &xdim, &ydim, NULL);
  DefineGraphNxN_R("psi", &psi[0][0], &xdim, &ydim, NULL);
  DefineGraphNxN_R("rho", &rho[0][0], &xdim, &ydim, NULL); 
  NewGraph();

  StartMenu("Ising Bilayer",1);

  SetActiveGraph(0);
  DefineGraph(contour2d_,"Visualize");

  //StartMenu("Controls",0);
  DefineInt("iterations", &iterations);
  DefineInt("repeat", &repeat);
  //DefineInt("stabilize", &stabilize);
  DefineDouble("phi_init", &r_zero[0]);
  DefineDouble("psi_init", &r_zero[1]);
  DefineDouble("Temperature", &T);
  DefineDouble("Lambda", &lambda);
  //EndMenu();

  StartMenu("Secondary Inputs",0);
  DefineInt("xdim", &xdim);
  DefineInt("ydim", &ydim);
  EndMenu();

  DefineFunction("reinitialize",&Init);

  DefineBool("Pause",&Pause);
  DefineBool("Single Step",&singlestep);
  DefineBool("Done",&done);	
  EndMenu();
}
Exemplo n.º 2
0
void GUI(){
  DefineGraphN_R("Density",density,&size,&densityreq);
  StartMenu("GUI",1);
    DefineDouble("T",&T);
    DefineDouble("omega",&omega);
    StartMenu("Restart",0);
      DefineMod("size",&size,SIZE+1);
      DefineDouble("Amplitude",&Amplitude);
      DefineFunction("Restart sin",&init);
      DefineFunction("Restart step",&init2);
    EndMenu();
    DefineGraph(curve2d_,"Density graph");
    DefineBool("Pause",&pause);
    DefineBool("Single step",&sstep);
    DefineInt("Repeat",&Repeat);    DefineBool("Done",&done);
  EndMenu();
}
Exemplo n.º 3
0
void GUI(){
  DefineGraphNxN_R("rho",&rho[0][0],&Xdim,&Ydim,&rhoreq);
#ifdef DEBUG
  DefineGraphNxN_R("bb",&bb[0][0],&Xdim,&Ydim,&noreq);
  DefineGraphNxN_R("b1",&b1[0][0],&Xdim,&Ydim,&noreq);
  DefineGraphNxN_R("b3",&b3[0][0],&Xdim,&Ydim,&noreq);
  DefineGraphNxN_R("b5",&b5[0][0],&Xdim,&Ydim,&noreq);
  DefineGraphNxN_R("b6",&b6[0][0],&Xdim,&Ydim,&noreq);
#endif
  DefineGraphNxN_RxR("u",&u[0][0][0],&Xdim,&Ydim,&ureq);

  StartMenu("Lattice Boltzmann",1);
  DefineDouble("1/tau",&omega);
  DefineInt("Measurement freq.",&FrequencyMeasure);
  StartMenu("Reinitialize",0);
  DefineDouble("Amplitude",&Amp2);
  DefineDouble("Width",&Width);
  DefineFunction("reinitialize",&init);
  DefineFunction("Particle init",&initParticle);
  EndMenu();
  DefineDouble("Velocity amplitude",&Amp);
  StartMenu("Particle",0);
  DefineDouble("R",&R);
  DefineDouble("M",&M);
  DefineDouble("Ux",&Ux);
  DefineDouble("Uy",&Uy);
  DefineDouble("Cx",&Cx);
  DefineDouble("Cy",&Cy);
  DefineDouble("Mx",&Mx);
  DefineDouble("My",&My);
  EndMenu();
  DefineGraph(contour2d_,"Density&Vector plots");
  DefineInt("Repeat",&Repeat);
  DefineBool("Pause",&Pause);
  DefineBool("Single Step",&sstep);
  DefineBool("Done",&done);
  EndMenu();
}
Exemplo n.º 4
0
bool MandelboxKernelControl::SetFrom(const SettingCollection &settings,
                                     CudaContext &context,
                                     size_t width,
                                     size_t height)
{
    bool changed = false;
    if (old_width != width || old_height != height || !scratch_buffer()
        || !rand_buffer())
    {
        changed = true;
        old_width = width;
        old_height = height;
        scratch_buffer.~CuMem();
        rand_buffer.~CuMem();
        new(&scratch_buffer) CuMem<char>(context,
                                         width * height * MandelboxStateSize);
        new(&rand_buffer) CuMem<uint64_t>(context, width * height);
    }
    MandelboxCfg temp;
#define DefineFlt(name) temp.name = (float)settings.Get(#name).AsFloat()
#define DefineInt(name) temp.name = (int)settings.Get(#name).AsInt()
#define DefineBool(name) temp.name = settings.Get(#name).AsBool() ? 1 : 0
    DefineFlt(posX);
    DefineFlt(posY);
    DefineFlt(posZ);
    DefineFlt(lookX);
    DefineFlt(lookY);
    DefineFlt(lookZ);
    DefineFlt(upX);
    DefineFlt(upY);
    DefineFlt(upZ);
    DefineFlt(fov);
    DefineFlt(focalDistance);

    DefineFlt(Scale);
    DefineFlt(FoldingLimit);
    DefineFlt(FixedRadius2);
    DefineFlt(MinRadius2);
    DefineFlt(DeRotationAmount);
    DefineFlt(DeRotationAxisX);
    DefineFlt(DeRotationAxisY);
    DefineFlt(DeRotationAxisZ);
    DefineFlt(DofAmount);
    DefineFlt(FovAbberation);

    DefineFlt(LightPosX);
    DefineFlt(LightPosY);
    DefineFlt(LightPosZ);
    DefineFlt(LightSize);

    DefineBool(WhiteClamp);

    DefineFlt(LightBrightnessHue);
    DefineFlt(LightBrightnessSat);
    DefineFlt(LightBrightnessVal);

    DefineFlt(AmbientBrightnessHue);
    DefineFlt(AmbientBrightnessSat);
    DefineFlt(AmbientBrightnessVal);

    DefineFlt(ReflectHue);
    DefineFlt(ReflectSat);
    DefineFlt(ReflectVal);

    DefineInt(MaxIters);
    DefineFlt(Bailout);
    DefineFlt(DeMultiplier);
    DefineInt(RandSeedInitSteps);
    DefineFlt(MaxRayDist);
    DefineInt(MaxRaySteps);
    DefineInt(NumRayBounces);
    DefineFlt(QualityFirstRay);
    DefineFlt(QualityRestRay);
    DefineInt(ItersPerKernel);
#undef DefineFlt
#undef DefineInt
#undef DefineBool
    if (!old_state)
    {
        changed = true;
        old_state = make_unique<MandelboxCfg>();
        *old_state = temp;
    }
    else if (memcmp(old_state.get(), &temp, sizeof(temp)))
    {
        changed = true;
        *old_state = temp;
    }
    temp.scratch = scratch_buffer();
    temp.randbuf = rand_buffer();
    kernelVariable.Set(temp);
    return changed;
}