// Copyright (2019-2022) Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-or-later #include "IndexerWrapper.h" void IndexerWrapper::Setup(const UnitCell &cell) { indexer.iCellM() = CrystalLattice(cell).GetEigenMatrix(); } std::vector IndexerWrapper::Run(const std::vector &coord) { std::vector ret; if (coord.size() < MIN_SPOTS_TO_INDEX) return ret; size_t nspots = std::min(MAX_SPOTS_TO_INDEX, coord.size()); for (int i = 0; i < nspots; i++) { indexer.spotX(i) = coord[i].x; indexer.spotY(i) = coord[i].y; indexer.spotZ(i) = coord[i].z; } // Index indexer.index(1, nspots); // Get best cell auto id = fast_feedback::refine::best_cell(indexer.oScoreV()); // Check if is viable if (fast_feedback::refine::is_viable_cell(indexer.oCell(id), indexer.Spots(), 0.05f, 9u)) ret.emplace_back(indexer.oCell(id)); return ret; }