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

openmc-dev / openmc / 22261613902

21 Feb 2026 06:02PM UTC coverage: 81.808% (+0.05%) from 81.763%
22261613902

Pull #3474

github

web-flow
Merge aea47008a into 139907c95
Pull Request #3474: Support arbitrary symmetry axis for CylindricalIndependent class

17351 of 24448 branches covered (70.97%)

Branch coverage included in aggregate %.

50 of 64 new or added lines in 2 files covered. (78.13%)

2915 existing lines in 63 files now uncovered.

57697 of 67289 relevant lines covered (85.75%)

45481208.67 hits per line

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

98.77
/src/finalize.cpp
1
#include "openmc/finalize.h"
2

3
#include "openmc/bank.h"
4
#include "openmc/capi.h"
5
#include "openmc/cmfd_solver.h"
6
#include "openmc/collision_track.h"
7
#include "openmc/constants.h"
8
#include "openmc/cross_sections.h"
9
#include "openmc/dagmc.h"
10
#include "openmc/eigenvalue.h"
11
#include "openmc/event.h"
12
#include "openmc/geometry.h"
13
#include "openmc/geometry_aux.h"
14
#include "openmc/material.h"
15
#include "openmc/mesh.h"
16
#include "openmc/message_passing.h"
17
#include "openmc/mgxs_interface.h"
18
#include "openmc/nuclide.h"
19
#include "openmc/photon.h"
20
#include "openmc/plot.h"
21
#include "openmc/random_lcg.h"
22
#include "openmc/random_ray/random_ray_simulation.h"
23
#include "openmc/settings.h"
24
#include "openmc/simulation.h"
25
#include "openmc/source.h"
26
#include "openmc/surface.h"
27
#include "openmc/tallies/tally.h"
28
#include "openmc/thermal.h"
29
#include "openmc/timer.h"
30
#include "openmc/volume_calc.h"
31
#include "openmc/weight_windows.h"
32

33
#include "openmc/tensor.h"
34

35
namespace openmc {
36

37
void free_memory()
7,536✔
38
{
39
  free_memory_geometry();
7,536✔
40
  free_memory_surfaces();
7,536✔
41
  free_memory_material();
7,536✔
42
  free_memory_volume();
7,536✔
43
  free_memory_simulation();
7,536✔
44
  free_memory_photon();
7,536✔
45
  free_memory_settings();
7,536✔
46
  free_memory_thermal();
7,536✔
47
  library_clear();
7,536✔
48
  nuclides_clear();
7,536✔
49
  free_memory_source();
7,536✔
50
  free_memory_mesh();
7,536✔
51
  free_memory_tally();
7,536✔
52
  free_memory_bank();
7,536✔
53
  free_memory_plot();
7,536✔
54
  free_memory_weight_windows();
7,536✔
55
  if (mpi::master) {
7,536✔
56
    free_memory_cmfd();
6,604✔
57
  }
58
  if (settings::event_based) {
7,536!
UNCOV
59
    free_event_queues();
×
60
  }
61
}
7,536✔
62

63
} // namespace openmc
64

65
using namespace openmc;
66

67
int openmc_finalize()
7,536✔
68
{
69
  if (simulation::initialized)
7,536✔
70
    openmc_simulation_finalize();
3✔
71

72
  // Clear results
73
  openmc_reset();
7,536✔
74

75
  // Reset timers
76
  reset_timers();
7,536✔
77

78
  // Reset global variables
79
  settings::assume_separate = false;
7,536✔
80
  settings::check_overlaps = false;
7,536✔
81
  settings::collision_track_config = CollisionTrackConfig {};
7,536✔
82
  settings::confidence_intervals = false;
7,536✔
83
  settings::create_fission_neutrons = true;
7,536✔
84
  settings::create_delayed_neutrons = true;
7,536✔
85
  settings::electron_treatment = ElectronTreatment::LED;
7,536✔
86
  settings::delayed_photon_scaling = true;
7,536✔
87
  settings::energy_cutoff = {0.0, 1000.0, 0.0, 0.0};
7,536✔
88
  settings::time_cutoff = {INFTY, INFTY, INFTY, INFTY};
7,536✔
89
  settings::entropy_on = false;
7,536✔
90
  settings::event_based = false;
7,536✔
91
  settings::free_gas_threshold = 400.0;
7,536✔
92
  settings::gen_per_batch = 1;
7,536✔
93
  settings::legendre_to_tabular = true;
7,536✔
94
  settings::legendre_to_tabular_points = -1;
7,536✔
95
  settings::material_cell_offsets = true;
7,536✔
96
  settings::max_lost_particles = 10;
7,536✔
97
  settings::max_order = 0;
7,536✔
98
  settings::max_particles_in_flight = 100000;
7,536✔
99
  settings::max_secondaries = 10000;
7,536✔
100
  settings::max_particle_events = 1'000'000;
7,536✔
101
  settings::max_history_splits = 10'000'000;
7,536✔
102
  settings::max_tracks = 1000;
7,536✔
103
  settings::max_write_lost_particles = -1;
7,536✔
104
  settings::n_log_bins = 8000;
7,536✔
105
  settings::n_inactive = 0;
7,536✔
106
  settings::n_particles = -1;
7,536✔
107
  settings::output_summary = true;
7,536✔
108
  settings::output_tallies = true;
7,536✔
109
  settings::particle_restart_run = false;
7,536✔
110
  settings::path_cross_sections.clear();
7,536✔
111
  settings::path_input.clear();
7,536✔
112
  settings::path_output.clear();
7,536✔
113
  settings::path_particle_restart.clear();
7,536✔
114
  settings::path_sourcepoint.clear();
7,536✔
115
  settings::path_statepoint.clear();
7,536✔
116
  settings::photon_transport = false;
7,536✔
117
  settings::reduce_tallies = true;
7,536✔
118
  settings::rel_max_lost_particles = 1.0e-6;
7,536✔
119
  settings::res_scat_on = false;
7,536✔
120
  settings::res_scat_method = ResScatMethod::rvs;
7,536✔
121
  settings::res_scat_energy_min = 0.01;
7,536✔
122
  settings::res_scat_energy_max = 1000.0;
7,536✔
123
  settings::restart_run = false;
7,536✔
124
  settings::run_CE = true;
7,536✔
125
  settings::run_mode = RunMode::UNSET;
7,536✔
126
  settings::solver_type = SolverType::MONTE_CARLO;
7,536✔
127
  settings::source_latest = false;
7,536✔
128
  settings::source_rejection_fraction = 0.05;
7,536✔
129
  settings::source_separate = false;
7,536✔
130
  settings::source_write = true;
7,536✔
131
  settings::ssw_cell_id = C_NONE;
7,536✔
132
  settings::ssw_cell_type = SSWCellType::None;
7,536✔
133
  settings::ssw_max_particles = 0;
7,536✔
134
  settings::ssw_max_files = 1;
7,536✔
135
  settings::survival_biasing = false;
7,536✔
136
  settings::temperature_default = 293.6;
7,536✔
137
  settings::temperature_method = TemperatureMethod::NEAREST;
7,536✔
138
  settings::temperature_multipole = false;
7,536✔
139
  settings::temperature_range = {0.0, 0.0};
7,536✔
140
  settings::temperature_tolerance = 10.0;
7,536✔
141
  settings::trigger_on = false;
7,536✔
142
  settings::trigger_predict = false;
7,536✔
143
  settings::trigger_batch_interval = 1;
7,536✔
144
  settings::uniform_source_sampling = false;
7,536✔
145
  settings::ufs_on = false;
7,536✔
146
  settings::urr_ptables_on = true;
7,536✔
147
  settings::verbosity = -1;
7,536✔
148
  settings::weight_cutoff = 0.25;
7,536✔
149
  settings::weight_survive = 1.0;
7,536✔
150
  settings::weight_windows_file.clear();
7,536✔
151
  settings::weight_windows_on = false;
7,536✔
152
  settings::write_all_tracks = false;
7,536✔
153
  settings::write_initial_source = false;
7,536✔
154

155
  simulation::keff = 1.0;
7,536✔
156
  simulation::need_depletion_rx = false;
7,536✔
157
  simulation::ssw_current_file = 1;
7,536✔
158
  simulation::total_gen = 0;
7,536✔
159

160
  simulation::entropy_mesh = nullptr;
7,536✔
161
  simulation::ufs_mesh = nullptr;
7,536✔
162

163
  data::energy_max = {INFTY, INFTY, INFTY, INFTY};
7,536✔
164
  data::energy_min = {0.0, 0.0, 0.0, 0.0};
7,536✔
165
  data::temperature_min = 0.0;
7,536✔
166
  data::temperature_max = INFTY;
7,536✔
167
  data::mg = {};
7,536✔
168
  model::root_universe = -1;
7,536✔
169
  model::plotter_seed = 1;
7,536✔
170
  openmc::openmc_set_seed(DEFAULT_SEED);
7,536✔
171
  openmc::openmc_set_stride(DEFAULT_STRIDE);
7,536✔
172

173
  // Deallocate arrays
174
  free_memory();
7,536✔
175

176
#ifdef OPENMC_LIBMESH_ENABLED
177
  settings::libmesh_init.reset();
1,559✔
178
#endif
179

180
  // Free all MPI types
181
#ifdef OPENMC_MPI
182
  if (mpi::source_site != MPI_DATATYPE_NULL) {
3,617✔
183
    MPI_Type_free(&mpi::source_site);
3,538✔
184
  }
185
  if (mpi::collision_track_site != MPI_DATATYPE_NULL) {
3,617✔
186
    MPI_Type_free(&mpi::collision_track_site);
3,538✔
187
  }
188
#endif
189

190
  openmc_finalize_random_ray();
7,536✔
191

192
  return 0;
7,536✔
193
}
194

195
int openmc_reset()
14,803✔
196
{
197

198
  model::universe_level_counts.clear();
14,803✔
199

200
  for (auto& t : model::tallies) {
64,473✔
201
    t->reset();
49,670✔
202
  }
203

204
  // Reset global tallies
205
  simulation::n_realizations = 0;
14,803✔
206
  simulation::global_tallies.fill(0.0);
14,803✔
207

208
  simulation::k_col_abs = 0.0;
14,803✔
209
  simulation::k_col_tra = 0.0;
14,803✔
210
  simulation::k_abs_tra = 0.0;
14,803✔
211
  simulation::k_sum = {0.0, 0.0};
14,803✔
212
  simulation::satisfy_triggers = false;
14,803✔
213

214
  settings::cmfd_run = false;
14,803✔
215

216
  simulation::n_lost_particles = 0;
14,803✔
217

218
  return 0;
14,803✔
219
}
220

221
int openmc_reset_timers()
188✔
222
{
223
  reset_timers();
188✔
224
  return 0;
188✔
225
}
226

227
int openmc_hard_reset()
170✔
228
{
229
  // Reset all tallies and timers
230
  openmc_reset();
170✔
231
  reset_timers();
170✔
232

233
  // Reset total generations and keff guess
234
  simulation::keff = 1.0;
170✔
235
  simulation::total_gen = 0;
170✔
236

237
  // Reset the random number generator state
238
  openmc::openmc_set_seed(DEFAULT_SEED);
170✔
239
  openmc::openmc_set_stride(DEFAULT_STRIDE);
170✔
240
  return 0;
170✔
241
}
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