Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
string_histogram.hpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
10#pragma once
11
20#include <unordered_map>
21#include <string>
22#include <vector>
23
24namespace shamalgs::collective {
25
41 std::unordered_map<std::string, int> string_histogram(
42 const std::vector<std::string> &inputs, std::string delimiter, bool hash_based);
43
45 std::unordered_map<std::string, int> all_string_histogram(
46 const std::vector<std::string> &inputs, std::string delimiter, bool hash_based);
47
48} // namespace shamalgs::collective
std::unordered_map< std::string, int > string_histogram(const std::vector< std::string > &inputs, std::string delimiter, bool hash_based)
Constructs a histogram from a vector of strings, counting occurrences of each unique string.
std::unordered_map< std::string, int > all_string_histogram(const std::vector< std::string > &inputs, std::string delimiter, bool hash_based)
same as string_histogram but with result return on every rank