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

openmc-dev / openmc / 12730204001

12 Jan 2025 03:48AM UTC coverage: 84.907% (+0.04%) from 84.871%
12730204001

Pull #2655

github

web-flow
Merge ba7db72f7 into d2edf0ce4
Pull Request #2655: Raytrace plots

389 of 429 new or added lines in 5 files covered. (90.68%)

5 existing lines in 3 files now uncovered.

50288 of 59227 relevant lines covered (84.91%)

34298662.81 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

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

23
void GeometryState::mark_as_lost(const std::string& message)
6,268✔
24
{
25
  mark_as_lost(message.c_str());
6,268✔
26
}
6,258✔
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)
2,774,868✔
34
{
35
  r = r.rotate(rotation);
2,774,868✔
36
  u = u.rotate(rotation);
2,774,868✔
37
  rotated = true;
2,774,868✔
38
}
2,774,868✔
39

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

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

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

65
  for (auto c_i : root_universe->cells_) {
69,624,720✔
66
    auto dist =
67
      model::cells.at(c_i)->distance(root_coord.r, root_coord.u, 0, this);
52,218,540✔
68
    if (dist.first < boundary().distance) {
52,218,540✔
69
      boundary().distance = dist.first;
22,997,364✔
70
      boundary().surface_index = dist.second;
22,997,364✔
71
    }
72
  }
73

74
  // if no intersection or near-infinite intersection, reset
75
  // boundary information
76
  if (boundary().distance > 1e300) {
17,406,180✔
77
    boundary().distance = INFTY;
2,243,016✔
78
    boundary().surface_index = 0;
2,243,016✔
79
    return;
2,243,016✔
80
  }
81

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

86
void GeometryState::move_distance(double length)
15,175,164✔
87
{
88
  for (int j = 0; j < n_coord(); ++j) {
30,350,328✔
89
    coord(j).r += length * coord(j).u;
15,175,164✔
90
  }
91
}
15,175,164✔
92

93
ParticleData::ParticleData()
151,543,960✔
94
{
95
  zero_delayed_bank();
151,543,960✔
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) {
151,543,960✔
101
    flux_derivs_.resize(model::tally_derivs.size());
29,962,524✔
102
    zero_flux_derivs();
29,962,524✔
103
  }
104

105
  // Allocate space for tally filter matches
106
  filter_matches_.resize(model::tally_filters.size());
151,543,960✔
107

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

112
  // Creates the pulse-height storage for the particle
113
  if (!model::pulse_height_cells.empty()) {
151,543,960✔
114
    pht_storage_.resize(model::pulse_height_cells.size(), 0.0);
5,600✔
115
  }
116
}
151,543,960✔
117

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

© 2025 Coveralls, Inc