• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

openmc-dev / openmc / 21240277645

22 Jan 2026 07:46AM UTC coverage: 80.906% (-1.1%) from 81.998%
21240277645

Pull #3745

github

web-flow
Merge b47b53e16 into c5df2bf62
Pull Request #3745: Add n_elements to the MeshBase protocol and deprecate num_mesh_cells

16262 of 22513 branches covered (72.23%)

Branch coverage included in aggregate %.

15 of 21 new or added lines in 2 files covered. (71.43%)

1061 existing lines in 55 files now uncovered.

53902 of 64210 relevant lines covered (83.95%)

7933045.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

71.0
/src/ifp.cpp
1
#include "openmc/ifp.h"
2

3
#include "openmc/bank.h"
4
#include "openmc/message_passing.h"
5
#include "openmc/particle.h"
6
#include "openmc/particle_data.h"
7
#include "openmc/settings.h"
8
#include "openmc/simulation.h"
9
#include "openmc/vector.h"
10

11
namespace openmc {
12

13
bool is_beta_effective_or_both()
545,476✔
14
{
15
  if (settings::ifp_parameter == IFPParameter::BetaEffective ||
545,476!
16
      settings::ifp_parameter == IFPParameter::Both) {
545,476!
17
    return true;
545,476✔
18
  }
19
  return false;
×
20
}
21

22
bool is_generation_time_or_both()
456,172✔
23
{
24
  if (settings::ifp_parameter == IFPParameter::GenerationTime ||
456,172!
25
      settings::ifp_parameter == IFPParameter::Both) {
456,172!
26
    return true;
456,172✔
27
  }
28
  return false;
×
29
}
30

31
void ifp(const Particle& p, int64_t idx)
122,966✔
32
{
33
  if (is_beta_effective_or_both()) {
122,966!
34
    const auto& delayed_groups =
35
      simulation::ifp_source_delayed_group_bank[p.current_work() - 1];
122,966✔
36
    simulation::ifp_fission_delayed_group_bank[idx] =
122,966✔
37
      _ifp(p.delayed_group(), delayed_groups);
245,932✔
38
  }
39
  if (is_generation_time_or_both()) {
122,966!
40
    const auto& lifetimes =
41
      simulation::ifp_source_lifetime_bank[p.current_work() - 1];
122,966✔
42
    simulation::ifp_fission_lifetime_bank[idx] = _ifp(p.lifetime(), lifetimes);
122,966✔
43
  }
44
}
122,966✔
45

46
void resize_simulation_ifp_banks()
8✔
47
{
48
  resize_ifp_data(simulation::ifp_source_delayed_group_bank,
8✔
49
    simulation::ifp_source_lifetime_bank, simulation::work_per_rank);
50
  resize_ifp_data(simulation::ifp_fission_delayed_group_bank,
8✔
51
    simulation::ifp_fission_lifetime_bank, 3 * simulation::work_per_rank);
52
}
8✔
53

54
void copy_ifp_data_from_fission_banks(
242,966✔
55
  int i_bank, vector<int>& delayed_groups, vector<double>& lifetimes)
56
{
57
  if (is_beta_effective_or_both()) {
242,966!
58
    delayed_groups = simulation::ifp_fission_delayed_group_bank[i_bank];
242,966✔
59
  }
60
  if (is_generation_time_or_both()) {
242,966!
61
    lifetimes = simulation::ifp_fission_lifetime_bank[i_bank];
242,966✔
62
  }
63
}
242,966✔
64

65
#ifdef OPENMC_MPI
66
void broadcast_ifp_n_generation(int& n_generation,
160✔
67
  const vector<vector<int>>& delayed_groups,
68
  const vector<vector<double>>& lifetimes)
69
{
70
  if (mpi::rank == 0) {
160✔
71
    if (is_beta_effective_or_both()) {
120!
72
      n_generation = static_cast<int>(delayed_groups[0].size());
120✔
73
    } else {
UNCOV
74
      n_generation = static_cast<int>(lifetimes[0].size());
×
75
    }
76
  }
77
  MPI_Bcast(&n_generation, 1, MPI_INT, 0, mpi::intracomm);
160✔
78
}
160✔
79

80
void copy_partial_ifp_data_to_source_banks(int64_t idx, int n, int64_t i_bank,
160✔
81
  const vector<vector<int>>& delayed_groups,
82
  const vector<vector<double>>& lifetimes)
83
{
84
  if (is_beta_effective_or_both()) {
160!
85
    std::copy(&delayed_groups[idx], &delayed_groups[idx + n],
160✔
86
      &simulation::ifp_source_delayed_group_bank[i_bank]);
160✔
87
  }
88
  if (is_generation_time_or_both()) {
160!
89
    std::copy(&lifetimes[idx], &lifetimes[idx + n],
160✔
90
      &simulation::ifp_source_lifetime_bank[i_bank]);
160✔
91
  }
92
}
160✔
93
#endif
94

UNCOV
95
void copy_complete_ifp_data_to_source_banks(
×
96
  const vector<vector<int>>& delayed_groups,
97
  const vector<vector<double>>& lifetimes)
98
{
UNCOV
99
  if (is_beta_effective_or_both()) {
×
UNCOV
100
    std::copy(delayed_groups.data(),
×
UNCOV
101
      delayed_groups.data() + settings::n_particles,
×
102
      simulation::ifp_source_delayed_group_bank.begin());
103
  }
UNCOV
104
  if (is_generation_time_or_both()) {
×
UNCOV
105
    std::copy(lifetimes.data(), lifetimes.data() + settings::n_particles,
×
106
      simulation::ifp_source_lifetime_bank.begin());
107
  }
UNCOV
108
}
×
109

110
void allocate_temporary_vector_ifp(
160✔
111
  vector<vector<int>>& delayed_groups, vector<vector<double>>& lifetimes)
112
{
113
  if (is_beta_effective_or_both()) {
160!
114
    delayed_groups.resize(simulation::fission_bank.size());
160✔
115
  }
116
  if (is_generation_time_or_both()) {
160!
117
    lifetimes.resize(simulation::fission_bank.size());
160✔
118
  }
119
}
160✔
120

121
void copy_ifp_data_to_fission_banks(const vector<int>* const delayed_groups_ptr,
160✔
122
  const vector<double>* lifetimes_ptr)
123
{
124
  if (is_beta_effective_or_both()) {
160!
125
    std::copy(delayed_groups_ptr,
160✔
126
      delayed_groups_ptr + simulation::fission_bank.size(),
160✔
127
      simulation::ifp_fission_delayed_group_bank.data());
128
  }
129
  if (is_generation_time_or_both()) {
160!
130
    std::copy(lifetimes_ptr, lifetimes_ptr + simulation::fission_bank.size(),
160✔
131
      simulation::ifp_fission_lifetime_bank.data());
132
  }
133
}
160✔
134

135
} // namespace openmc
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc