void Server::trim(const std::vector<TrimTask>& tasks) { compact(m_structure); const size_t item_count = m_structure.carrier().item_count(); std::vector<TrimTask> sorted_tasks = tasks; std::sort(sorted_tasks.begin(), sorted_tasks.end(), [](const TrimTask& lhs, const TrimTask& rhs) { return lhs.size > rhs.size; }); const size_t task_count = sorted_tasks.size(); #pragma omp parallel for schedule(dynamic, 1) for (size_t iter = 0; iter < task_count; ++iter) { const TrimTask& task = sorted_tasks[iter]; if (task.size >= item_count) { if (task.size > item_count) { POMAGMA_WARN("trimming only " << item_count << " of " << task.size << " obs"); } m_structure.dump(task.filename); } else { Structure region; region.init_carrier(task.size); extend(region.signature(), m_structure.signature()); pomagma::trim(m_structure, region, m_theory_file, m_language_file, task.temperature); if (POMAGMA_DEBUG_LEVEL > 1) { region.validate(); } region.dump(task.filename); } } }
void dump_structure (const std::string & filename) { structure.dump(filename); }