#include "SSSector.hpp" #include #include namespace StrideSearch { template void Sector::allocWorkspaces(const std::vector>& criteria) { workspaces = std::vector(criteria.size()); const Int sector_size = indices.size(); for (Int i=0; ivarnames, sector_size); } } template void Sector::allocWorkspace(const std::shared_ptr locator) { workspaces = std::vector(1); workspaces[0] = Workspace(locator->varnames, indices.size()); } template std::string Sector::infoString(const int tab_lev, const bool printWorkspaces) const { std::ostringstream ss; std::string tabstr(""); for (int i=0; i std::vector>> Sector::evaluateCriteriaAtTimestep( std::vector>& criteria, const DateTime& dt, const std::string& fname, const Index time_ind) const { std::vector>> result; for (Int i=0; ievaluate(workspaces[i])) { const Index wspc_ind = criteria[i]->wspcIndex; Real elat, elon; if (criteria[i]->useSectorLocation()) { elat = lat; elon = lon; } else { elat = lats[wspc_ind]; elon = lons[wspc_ind]; } result.push_back(std::shared_ptr>( new Event(criteria[i]->description(), criteria[i]->val, elat, elon, dt, indices[wspc_ind], time_ind, fname, criteria[i]->compareKind, criteria[i]->locationKind))); } } return result; } template std::shared_ptr> Sector::evaluateLocatorCriterionAtTimestep( std::shared_ptr locator, const DateTime& dt, const std::string& fname, const Index time_ind) const { std::shared_ptr> result; if (locator->evaluate(workspaces[0])) { const Index wspc_ind = locator->wspcIndex; result = std::shared_ptr>(new Event(locator->description(), locator->val, lats[wspc_ind], lons[wspc_ind], dt, indices[wspc_ind], time_ind, fname, locator->compareKind, INDEPENDENT)); } return result; } /// Link Sector To Data implementation for UnstructuredLayout template <> template <> void Sector::linkHelper(const KDTree& tree, const std::shared_ptr ncr) { const Real avgCellSizeSq = ncr->avgResKm * ncr->avgResKm; const Int n_estimate = std::ceil(4*PI*radius*radius/(avgCellSizeSq)); auto searchReturn = tree.search(lat, lon, radius, n_estimate); for (Int i=0; i(ncr.get())->getDataIndexFromTreeIndex(tree_ind)); lats.push_back(ncr->getLat(tree_ind)); lons.push_back(ncr->getLon(tree_ind)); } } /// Link Sector To Data implementation for LatLonLayout template <> template <> void Sector::linkHelper(const KDTree& tree, const std::shared_ptr ncr) { const Real avgCellSizeSq = ncr->avgResKm * ncr->avgResKm; const Int n_estimate = std::ceil(4*PI*radius*radius/avgCellSizeSq); auto searchReturn = tree.search(lat, lon, radius, n_estimate); for (Int i=0; i(ncr.get())->getDataIndexFromTreeIndex(tree_ind)); lats.push_back(ncr->getLat(tree_ind)); lons.push_back(ncr->getLon(tree_ind)); } } /// ETI template struct Sector; template struct Sector; }