GCC Code Coverage Report


Directory: ./
File: include/particle.hpp
Date: 2025-02-03 10:58:24
Exec Total Coverage
Lines: 9 9 100.0%
Functions: 1 1 100.0%
Branches: 14 24 58.3%

Line Branch Exec Source
1 #pragma once
2
3 #include "types.hpp"
4
5 struct alignas(64) Particle {
6 Vec r = Vec::Zero();
7 ArrayI box = ArrayI::Zero();
8 Vec v = Vec::Zero();
9 Vec Fext = Vec::Zero();
10 double Eext = 0.;
11 Vec Fint = Vec::Zero();
12 Vec Tauext = Vec::Zero();
13 Vec Tauint = Vec::Zero();
14 Vec rRand = Vec::Zero();
15 Vec u = Vec::Zero();
16 Real sigma = 1.;
17 Real m = 1.;
18 Real gamma = 1.;
19 int species = 0;
20
21 4955 Particle(const Vec &r, const Vec &v = Vec::Zero(), const Vec &u = Vec::Zero(), Real sigma = 1.,
22 Real m = 1., Real gamma = 1., int species = 0)
23
2/2
✓ Branch 12 taken 1 times.
✓ Branch 13 taken 4954 times.
4955 : r(r), v(v), u(u), sigma(sigma), m(m), gamma(gamma), species(species) {
24
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 4954 times.
4955 if (sigma > 1) {
25 1 throw std::invalid_argument(
26 "The largest particle species has sigma = 1 by convention. Cannot create particle with "
27 1 "sigma = " +
28
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 std::to_string(sigma) +
29
2/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
3 ". Please rescale your particles and system to meet this requirement.");
30 }
31 4954 }
32
7/14
✓ Branch 3 taken 1181 times.
✗ Branch 4 not taken.
✓ Branch 8 taken 1101 times.
✗ Branch 9 not taken.
✓ Branch 13 taken 1101 times.
✗ Branch 14 not taken.
✓ Branch 18 taken 9 times.
✗ Branch 19 not taken.
✓ Branch 23 taken 10 times.
✗ Branch 24 not taken.
✓ Branch 28 taken 9 times.
✗ Branch 29 not taken.
✓ Branch 33 taken 10 times.
✗ Branch 34 not taken.
5833 inline Vec F() const { return Fext + Fint; }
33 inline Vec Tau() const { return Tauext + Tauint; }
34 };
35
36 enum class ParticleUpdateType { MOVE = 0, INSERT = 1, DELETE = -1 };
37