               fprintf(stderr, "Unexpected file size.\n");
             }
             else {
-              std::vector<uint8_t> tmp(2*N);
+              std::vector<uint8_t> tmp(2 * N);
               if (fread(tmp.data(), 2, N, fp) == N) {
                 switch (format) {
                 case FieldFormat::UInt8: {
                   scalarField_host.resize(N);
-                  const auto* dst = reinterpret_cast<uint8_t*>(scalarField_host.data());
+                  auto* dst = reinterpret_cast<uint8_t*>(scalarField_host.data());
                   for (size_t i = 0; i < N; i++) {
                     const uint32_t v = tmp[2 * i + 0] | tmp[2 * i + 1] << 8;
-                    scalarField_host[i] = v >> 4; // 12 bits are in use.
+                    dst[i] = v >> 4; // 12 bits are in use.
                   }
                   break;
                 }
                 case FieldFormat::UInt16: {
                   scalarField_host.resize(sizeof(uint16_t) * N);
-                  const auto* dst = reinterpret_cast<uint16_t*>(scalarField_host.data());
+                  auto* dst = reinterpret_cast<uint16_t*>(scalarField_host.data());
                   for (size_t i = 0; i < N; i++) {
                     const uint32_t v = tmp[2 * i + 0] | tmp[2 * i + 1] << 8;
-                    scalarField_host[i] = v;
+                    dst[i] = v;
                   }
                   break;
                 }
                 case FieldFormat::Float: {
                   scalarField_host.resize(sizeof(float) * N);
-                  const auto* dst = reinterpret_cast<float*>(scalarField_host.data());
+                  auto* dst = reinterpret_cast<float*>(scalarField_host.data());
                   for (size_t i = 0; i < N; i++) {
                     const uint32_t v = tmp[2 * i + 0] | tmp[2 * i + 1] << 8;
-                    scalarField_host[i] = v;
+                    dst[i] = v;
                   }
                   break;
                 }

    float iso = 0.0;
    switch (format) {
    case FieldFormat::UInt8:
      iso = 0.5f*255.f*(iso + 1.f);
      break;
    case FieldFormat::UInt16:
      iso = 0.5f*65535.f*(iso + 1.f);
    default: break;
    }


  int deviceIndex = 0;

  for (int i = 1; i < argc; i++) {
    if (i + 1 < argc && (strcmp(argv[i], "-d") == 0 || strcmp(argv[i], "--device") == 0)) { deviceIndex = std::atoi(argv[i + 1]); i++; }
    else if (i + 1 < argc && strcmp(argv[i], "-nx") == 0) { nx = uint32_t(std::atoi(argv[i + 1])); i++; }
    else if (i + 1 < argc && strcmp(argv[i], "-ny") == 0) { ny = uint32_t(std::atoi(argv[i + 1])); i++; }
    else if (i + 1 < argc && strcmp(argv[i], "-nz") == 0) { nz = uint32_t(std::atoi(argv[i + 1])); i++; }
    else if (i + 1 < argc && strcmp(argv[i], "-n") == 0) { nx = uint32_t(std::atoi(argv[i + 1])); ny = nx; nz = nx; i++; }
    else if (i + 1 < argc && strcmp(argv[i], "-f") == 0) {
      if (strcmp(argv[i + 1], "uint8") == 0) { format = FieldFormat::UInt8; }
      else if (strcmp(argv[i + 1], "uint16") == 0) { format = FieldFormat::UInt16; }
