Indexer: Add more general Run() call with reciprocal coordinates to accommodate more demanding schemes
This commit is contained in:
@@ -47,11 +47,11 @@ IndexerThreadPool::~IndexerThreadPool() { {
|
||||
}
|
||||
}
|
||||
|
||||
std::future<std::optional<CrystalLattice> > IndexerThreadPool::Run(const DiffractionExperiment &experiment,
|
||||
DataMessage &message) {
|
||||
std::future<IndexerResult> IndexerThreadPool::Run(const DiffractionExperiment &experiment,
|
||||
const std::vector<Coord>& recip) {
|
||||
// Create a promise/future pair
|
||||
auto promise = std::make_shared<std::promise<std::optional<CrystalLattice> > >();
|
||||
std::future<std::optional<CrystalLattice> > result = promise->get_future(); {
|
||||
auto promise = std::make_shared<std::promise<IndexerResult > >();
|
||||
std::future<IndexerResult> result = promise->get_future(); {
|
||||
std::unique_lock<std::mutex> lock(m);
|
||||
|
||||
// Don't allow enqueueing after stopping the pool
|
||||
@@ -60,7 +60,7 @@ std::future<std::optional<CrystalLattice> > IndexerThreadPool::Run(const Diffrac
|
||||
}
|
||||
|
||||
// Create a task package with the data message and coordinates
|
||||
taskQueue.emplace(TaskPackage{promise, &experiment, &message});
|
||||
taskQueue.emplace(TaskPackage{promise, &experiment, &recip});
|
||||
}
|
||||
|
||||
cond.notify_one();
|
||||
@@ -128,7 +128,7 @@ void IndexerThreadPool::Worker(int32_t threadIndex, const NUMAHWPolicy &numa_pol
|
||||
}
|
||||
}
|
||||
try {
|
||||
std::optional<CrystalLattice> result;
|
||||
IndexerResult result;
|
||||
|
||||
auto algorithm = task.experiment->GetIndexingAlgorithm();
|
||||
Indexer *indexer = nullptr;
|
||||
@@ -143,7 +143,7 @@ void IndexerThreadPool::Worker(int32_t threadIndex, const NUMAHWPolicy &numa_pol
|
||||
|
||||
if (indexer) {
|
||||
indexer->Setup(*task.experiment);
|
||||
result = indexer->Run(*task.message);
|
||||
result = indexer->Run(*task.recip);
|
||||
}
|
||||
|
||||
// Set the result via the promise
|
||||
|
||||
Reference in New Issue
Block a user