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

openmc-dev / openmc / 15371300071

01 Jun 2025 05:04AM UTC coverage: 85.143% (+0.3%) from 84.827%
15371300071

Pull #3176

github

web-flow
Merge 4f739184a into cb95c784b
Pull Request #3176: MeshFilter rotation - solution to issue #3166

86 of 99 new or added lines in 4 files covered. (86.87%)

3707 existing lines in 117 files now uncovered.

52212 of 61323 relevant lines covered (85.14%)

42831974.38 hits per line

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

94.03
/src/particle_data.cpp
1
#include "openmc/particle_data.h"
2

3
#include <sstream>
4

5
#include "openmc/cell.h"
6
#include "openmc/error.h"
7
#include "openmc/geometry.h"
8
#include "openmc/material.h"
9
#include "openmc/nuclide.h"
10
#include "openmc/photon.h"
11
#include "openmc/settings.h"
12
#include "openmc/tallies/derivative.h"
13
#include "openmc/tallies/filter.h"
14
#include "openmc/tallies/tally.h"
15

16
namespace openmc {
17

UNCOV
18
void GeometryState::mark_as_lost(const char* message)
×
19
{
UNCOV
20
  fatal_error(message);
×
21
}
22

23
void GeometryState::mark_as_lost(const std::string& message)
7,840✔
24
{
25
  mark_as_lost(message.c_str());
7,840✔
26
}
7,827✔
27

28
void GeometryState::mark_as_lost(const std::stringstream& message)
×
29
{
30
  mark_as_lost(message.str());
×
31
}
32

33
void LocalCoord::rotate(const vector<double>& rotation)
3,468,585✔
34
{
35
  r = r.rotate(rotation);
3,468,585✔
36
  u = u.rotate(rotation);
3,468,585✔
37
  rotated = true;
3,468,585✔
38
}
3,468,585✔
39

40
void LocalCoord::reset()
1,685,312,377✔
41
{
42
  cell = C_NONE;
1,685,312,377✔
43
  universe = C_NONE;
1,685,312,377✔
44
  lattice = C_NONE;
1,685,312,377✔
45
  lattice_i[0] = 0;
1,685,312,377✔
46
  lattice_i[1] = 0;
1,685,312,377✔
47
  lattice_i[2] = 0;
1,685,312,377✔
48
  rotated = false;
1,685,312,377✔
49
}
1,685,312,377✔
50

51
GeometryState::GeometryState()
256,918,184✔
52
{
53
  // Create and clear coordinate levels
54
  coord_.resize(model::n_coord_levels);
256,918,184✔
55
  cell_last_.resize(model::n_coord_levels);
256,918,184✔
56
  clear();
256,918,184✔
57
}
256,918,184✔
58

59
void GeometryState::advance_to_boundary_from_void()
21,295,350✔
60
{
61
  auto root_coord = this->coord(0);
21,295,350✔
62
  const auto& root_universe = model::universes[model::root_universe];
21,295,350✔
63
  boundary().reset();
21,295,350✔
64

65
  for (auto c_i : root_universe->cells_) {
85,181,400✔
66
    auto dist =
67
      model::cells.at(c_i)->distance(root_coord.r, root_coord.u, 0, this);
63,886,050✔
68
    if (dist.first < boundary().distance) {
63,886,050✔
69
      boundary().distance = dist.first;
28,096,980✔
70
      boundary().surface = dist.second;
28,096,980✔
71
    }
72
  }
73

74
  // if no intersection or near-infinite intersection, reset
75
  // boundary information
76
  if (boundary().distance > 1e300) {
21,295,350✔
77
    boundary().distance = INFTY;
2,687,670✔
78
    boundary().surface = SURFACE_NONE;
2,687,670✔
79
    return;
2,687,670✔
80
  }
81

82
  // move the particle up to (and just past) the boundary
83
  move_distance(boundary().distance + TINY_BIT);
18,607,680✔
84
}
85

86
void GeometryState::move_distance(double length)
21,057,615✔
87
{
88
  for (int j = 0; j < n_coord(); ++j) {
42,115,230✔
89
    coord(j).r += length * coord(j).u;
21,057,615✔
90
  }
91
}
21,057,615✔
92

93
ParticleData::ParticleData()
207,570,490✔
94
{
95
  zero_delayed_bank();
207,570,490✔
96

97
  // Every particle starts with no accumulated flux derivative.  Note that in
98
  // event mode, we construct the particle once up front, so have to run this
99
  // even if the current batch is inactive.
100
  if (!model::active_tallies.empty() || settings::event_based) {
207,570,490✔
101
    flux_derivs_.resize(model::tally_derivs.size());
51,466,515✔
102
    zero_flux_derivs();
51,466,515✔
103
  }
104

105
  // Allocate space for tally filter matches
106
  filter_matches_.resize(model::tally_filters.size());
207,570,490✔
107

108
  // Create microscopic cross section caches
109
  neutron_xs_.resize(data::nuclides.size());
207,570,490✔
110
  photon_xs_.resize(data::elements.size());
207,570,490✔
111

112
  // Creates the pulse-height storage for the particle
113
  if (!model::pulse_height_cells.empty()) {
207,570,490✔
114
    pht_storage_.resize(model::pulse_height_cells.size(), 0.0);
7,100✔
115
  }
116
}
207,570,490✔
117

118
TrackState ParticleData::get_track_state() const
24,101✔
119
{
120
  TrackState state;
24,101✔
121
  state.r = this->r();
24,101✔
122
  state.u = this->u();
24,101✔
123
  state.E = this->E();
24,101✔
124
  state.time = this->time();
24,101✔
125
  state.wgt = this->wgt();
24,101✔
126
  state.cell_id = model::cells[this->lowest_coord().cell]->id_;
24,101✔
127
  state.cell_instance = this->cell_instance();
24,101✔
128
  if (this->material() != MATERIAL_VOID) {
24,101✔
129
    state.material_id = model::materials[material()]->id_;
24,101✔
130
  }
131
  return state;
24,101✔
132
}
133

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