GCC Code Coverage Report


Directory: ./
File: include/cells.hpp
Date: 2024-04-18 12:22:13
Exec Total Coverage
Lines: 7 7 100.0%
Functions: 1 1 100.0%
Branches: 1 2 50.0%

Line Branch Exec Source
1 #pragma once
2
3 #include "multiindex.hpp"
4 #include "types.hpp"
5 #include <unordered_map>
6 #include <vector>
7
8 struct Particle;
9
10 7550 struct Cell {
11 std::vector<int> particleIndices;
12 std::vector<std::pair<int, int>> pairsAll;
13 std::vector<std::pair<int, int>> pairsNewton3;
14 std::vector<std::tuple<int, int, int>> triplesAll;
15 std::vector<std::tuple<int, int, int>> triplesNewton3;
16 };
17
18 class Cells {
19 public:
20 Vec cellLinv;
21 Multiindex<DIM, FORTRAN> multiindex;
22 std::vector<Cell> cells;
23 std::string colorScheme;
24 std::vector<std::vector<int>> sameColorIndices;
25 std::unordered_map<int, int> particle2cell;
26
27 Cells(const Vec &cellL, const ArrayI &count, const std::string &colorScheme = "",
28 bool triples = false);
29
30 23712 inline int getIndex(const Vec &r) {
31 23712 return multiindex.multi2lin((r.array() * cellLinv.array()).cast<int>());
32 }
33
1/2
✓ Branch 0 taken 65 times.
✗ Branch 1 not taken.
11510209 inline Cell &operator[](const int i) { return cells[i]; }
34 4213 inline Cell &operator[](const Vec &r) { return (*this)[getIndex(r)]; }
35 4795 inline std::vector<Cell>::iterator begin() { return cells.begin(); }
36 4795 inline std::vector<Cell>::iterator end() { return cells.end(); }
37
38 std::vector<std::pair<int, int>> getPairs(int cellIndex, const std::string &mode);
39 std::vector<std::tuple<int, int, int>> getTriples(int cellIndex, const std::string &mode);
40 std::vector<int> getSameColorIndices(int color, const std::string &mode);
41 };
42