Example #1
0
  private void testSetup(Element e) {
    int vs = e.getVectorSize();
    if (vs == 3) {
      vs = 4;
    }
    createWalk(vs);

    Type t1 = Type.createX(mRS, e, gWidth * gHeight * gDepth / vs);
    in1DAlloc = Allocation.createTyped(mRS, t1);
    out1DAlloc = Allocation.createTyped(mRS, t1);
    script.set_gAlloc1DIn(in1DAlloc);
    script.set_gAlloc1DOut(out1DAlloc);
    scriptRelaxed.set_gAlloc1DIn(in1DAlloc);
    scriptRelaxed.set_gAlloc1DOut(out1DAlloc);

    Type t2 = Type.createXY(mRS, e, gWidth / vs, gHeight * gDepth);
    in2DAlloc = Allocation.createTyped(mRS, t2);
    out2DAlloc = Allocation.createTyped(mRS, t2);
    script.set_gAlloc2DIn(in2DAlloc);
    script.set_gAlloc2DOut(out2DAlloc);
    scriptRelaxed.set_gAlloc2DIn(in2DAlloc);
    scriptRelaxed.set_gAlloc2DOut(out2DAlloc);

    Type t3 = Type.createXYZ(mRS, e, gWidth / vs, gHeight, gDepth);
    in3DAlloc = Allocation.createTyped(mRS, t3);
    out3DAlloc = Allocation.createTyped(mRS, t3);
    script.set_gAlloc3DIn(in3DAlloc);
    script.set_gAlloc3DOut(out3DAlloc);
    scriptRelaxed.set_gAlloc3DIn(in3DAlloc);
    scriptRelaxed.set_gAlloc3DOut(out3DAlloc);
  }
 public void forEach_root(Allocation ain, Allocation aout) {
   // check ain
   if (!ain.getType().getElement().isCompatible(__ScriptField_particle)) {
     throw new RSRuntimeException("Type mismatch with ScriptField_particle!");
   }
   // check aout
   if (!aout.getType().getElement().isCompatible(__ScriptField_particle)) {
     throw new RSRuntimeException("Type mismatch with ScriptField_particle!");
   }
   // Verify dimensions
   Type tIn = ain.getType();
   Type tOut = aout.getType();
   if ((tIn.getCount() != tOut.getCount())
       || (tIn.getX() != tOut.getX())
       || (tIn.getY() != tOut.getY())
       || (tIn.getZ() != tOut.getZ())
       || (tIn.hasFaces() != tOut.hasFaces())
       || (tIn.hasMipmaps() != tOut.hasMipmaps())) {
     throw new RSRuntimeException("Dimension mismatch between input and output parameters!");
   }
   forEach(mExportForEachIdx_root, ain, aout, null);
 }