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

openmc-dev / openmc / 15714932041

17 Jun 2025 06:11PM UTC coverage: 85.297% (+0.1%) from 85.162%
15714932041

Pull #3453

github

web-flow
Merge c8f3e97e5 into 23eab2c89
Pull Request #3453: Secondary energy filter

31 of 50 new or added lines in 6 files covered. (62.0%)

1 existing line in 1 file now uncovered.

52595 of 61661 relevant lines covered (85.3%)

36868606.1 hits per line

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

76.67
/src/tallies/filter_delayedgroup.cpp
1
#include "openmc/tallies/filter_delayedgroup.h"
2

3
#include "openmc/error.h"
4
#include "openmc/xml_interface.h"
5

6
namespace openmc {
7

8
void DelayedGroupFilter::from_xml(pugi::xml_node node)
96✔
9
{
10
  auto groups = get_node_array<int>(node, "bins");
96✔
11
  this->set_groups(groups);
96✔
12
}
96✔
13

14
void DelayedGroupFilter::set_groups(span<int> groups)
96✔
15
{
16
  // Clear existing groups
17
  groups_.clear();
96✔
18
  groups_.reserve(groups.size());
96✔
19

20
  // Make sure all the group index values are valid.
21
  // TODO: do these need to be decremented for zero-based indexing?
22
  for (auto group : groups) {
672✔
23
    if (group < 1) {
576✔
24
      throw std::invalid_argument {"Encountered delayedgroup bin with index " +
×
25
                                   std::to_string(group) +
×
26
                                   " which is less than 1"};
×
27
    } else if (group > MAX_DELAYED_GROUPS) {
576✔
28
      throw std::invalid_argument {
×
29
        "Encountered delayedgroup bin with index " + std::to_string(group) +
×
NEW
30
        " which is greater than MAX_DELAYED_GROUPS (" +
×
31
        std::to_string(MAX_DELAYED_GROUPS) + ")"};
×
32
    }
33
    groups_.push_back(group);
576✔
34
  }
35

36
  n_bins_ = groups_.size();
96✔
37
}
96✔
38

39
void DelayedGroupFilter::get_all_bins(
6,703,037✔
40
  const Particle& p, TallyEstimator estimator, FilterMatch& match) const
41
{
42
  // Note that the bin is set to zero here, but bins outside zero are
43
  // tallied to regardless. This is because that logic has to be handled
44
  // in the scoring code instead where looping over the delayed
45
  // group takes place (tally_scoring.cpp).
46
  match.bins_.push_back(0);
6,703,037✔
47
  match.weights_.push_back(1.0);
6,703,037✔
48
}
6,703,037✔
49

50
void DelayedGroupFilter::to_statepoint(hid_t filter_group) const
66✔
51
{
52
  Filter::to_statepoint(filter_group);
66✔
53
  write_dataset(filter_group, "bins", groups_);
66✔
54
}
66✔
55

56
std::string DelayedGroupFilter::text_label(int bin) const
128,964✔
57
{
58
  return "Delayed Group " + std::to_string(groups_[bin]);
257,928✔
59
}
60

61
} // 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