本文整理汇总了C++中ScalarField::Fill方法的典型用法代码示例。如果您正苦于以下问题:C++ ScalarField::Fill方法的具体用法?C++ ScalarField::Fill怎么用?C++ ScalarField::Fill使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScalarField
的用法示例。
在下文中一共展示了ScalarField::Fill方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Run
//.........这里部分代码省略.........
} else if (arg == "-InputInitMomentum" && argc > 1) {
momentumPath = argv[1];
--argc; ++argv;
} else if (arg == "-OutputPath" && argc > 1) {
outputPath = argv[1];
--argc; ++argv;
} else if (arg == "-Device" && argc > 1) {
deviceName = argv[1];
--argc; ++argv;
} else if (arg == "-ShowDevices") {
for (auto && d : compute::system::devices())
std::cout << d.name() << std::endl;
return 0;
} else if (arg == "-affineT" && argc > 12) {
for (auto i = 1; i <= 12; ++i)
transfo[(i - 1) / 4][(i - 1) % 4] = atof(argv[i]);
argc -= 12;
argv += 12;
} else if (arg == "-Gauss" && argc > 1) {
sigmaXs[0] = sigmaYs[0] = sigmaZs[0] = atof(argv[1]);
--argc; ++argv;
} else if (arg == "-M_gauss" && argc > 1) {
auto temp = atoi(argv[1]);
--argc; ++argv;
for (auto i = 1; i <= 7; ++i) {
if (temp >= i && argc > 2) {
weights[i - 1] = atof(argv[1]);
sigmaXs[i - 1] = sigmaYs[i - 1] = sigmaZs[i - 1] = atof(argv[2]);
argc -= 2;
argv += 2;
}
}
} else if (arg == "-M_Gauss_easier" && argc > 2) {
sigmaXs[0] = atof(argv[1]);
sigmaXs[6] = atof(argv[2]);
argc -= 2;
argv += 2;
if (sigmaXs[0] < sigmaXs[6]) {
std::swap(sigmaXs[0], sigmaXs[6]);
}
sigmaYs[0] = sigmaZs[0] = sigmaXs[0];
sigmaYs[6] = sigmaZs[6] = sigmaXs[6];
weights[0] = 0.f;
auto a = (sigmaYs[6] - sigmaYs[0]) / 6.f;
auto b = sigmaYs[0] - a;
for (auto i = 2; i <= 6; ++i)
sigmaXs[i - 1] = sigmaYs[i - 1] = sigmaZs[i - 1] = i * a + b;
} else if (arg == "-alpha" && argc > 1) {
alpha = atof(argv[1]);
--argc; ++argv;
} else if (arg == "-MaxVeloUpdate" && argc > 1) {
maxVeloUpdate = atof(argv[1]);
--argc; ++argv;
} else if (arg == "-KernelSource" && argc > 1) {
sourcePath = argv[1];
--argc; ++argv;
} else {
usage();
return 1;
}
}
ScalarField momentum;
if (momentumPath.empty()) {
momentum = ScalarField { image.NX(), image.NY(), image.NZ() };
momentum.Fill(0.f);
} else
momentum = ScalarField::Read({ momentumPath.c_str() });
if (deviceName.empty())
SetDevice(compute::system::default_device());
else
SetDevice(compute::system::find_device(deviceName));
std::cout << "OpenCL will use " << GetDevice().name() << std::endl;
compute::command_queue queue { GetContext(), GetDevice() };
SetSourcePath(std::move(sourcePath));
GeoShoot gs { std::move(image), std::move(target), std::move(momentum), transfo, N, queue };
gs.Weights = std::move(weights);
gs.SigmaXs = std::move(sigmaXs);
gs.SigmaYs = std::move(sigmaYs);
gs.SigmaZs = std::move(sigmaZs);
gs.Alpha = alpha;
gs.MaxUpdate = maxVeloUpdate;
gs.Run(nbIterations);
queue.finish();
gs.Save(outputPath);
return 0;
}