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

openmc-dev / openmc / 9617074623

21 Jun 2024 04:53PM UTC coverage: 84.715% (+0.03%) from 84.688%
9617074623

Pull #3042

github

web-flow
Merge 47e50a3a9 into 4bd0b09e6
Pull Request #3042: Rely on std::filesystem for file_utils

26 of 31 new or added lines in 5 files covered. (83.87%)

921 existing lines in 34 files now uncovered.

48900 of 57723 relevant lines covered (84.71%)

31496763.14 hits per line

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

77.96
/src/settings.cpp
1
#include "openmc/settings.h"
2

3
#include <cmath>  // for ceil, pow
4
#include <limits> // for numeric_limits
5
#include <string>
6

7
#include <fmt/core.h>
8
#ifdef _OPENMP
9
#include <omp.h>
10
#endif
11

12
#include "openmc/capi.h"
13
#include "openmc/constants.h"
14
#include "openmc/container_util.h"
15
#include "openmc/distribution.h"
16
#include "openmc/distribution_multi.h"
17
#include "openmc/distribution_spatial.h"
18
#include "openmc/eigenvalue.h"
19
#include "openmc/error.h"
20
#include "openmc/file_utils.h"
21
#include "openmc/mcpl_interface.h"
22
#include "openmc/mesh.h"
23
#include "openmc/message_passing.h"
24
#include "openmc/output.h"
25
#include "openmc/plot.h"
26
#include "openmc/random_lcg.h"
27
#include "openmc/random_ray/random_ray.h"
28
#include "openmc/simulation.h"
29
#include "openmc/source.h"
30
#include "openmc/string_utils.h"
31
#include "openmc/tallies/trigger.h"
32
#include "openmc/volume_calc.h"
33
#include "openmc/weight_windows.h"
34
#include "openmc/xml_interface.h"
35

36
namespace openmc {
37

38
//==============================================================================
39
// Global variables
40
//==============================================================================
41

42
namespace settings {
43

44
// Default values for boolean flags
45
bool assume_separate {false};
46
bool check_overlaps {false};
47
bool cmfd_run {false};
48
bool confidence_intervals {false};
49
bool create_delayed_neutrons {true};
50
bool create_fission_neutrons {true};
51
bool delayed_photon_scaling {true};
52
bool entropy_on {false};
53
bool event_based {false};
54
bool legendre_to_tabular {true};
55
bool material_cell_offsets {true};
56
bool output_summary {true};
57
bool output_tallies {true};
58
bool particle_restart_run {false};
59
bool photon_transport {false};
60
bool reduce_tallies {true};
61
bool res_scat_on {false};
62
bool restart_run {false};
63
bool run_CE {true};
64
bool source_latest {false};
65
bool source_separate {false};
66
bool source_write {true};
67
bool source_mcpl_write {false};
68
bool surf_source_write {false};
69
bool surf_mcpl_write {false};
70
bool surf_source_read {false};
71
bool survival_biasing {false};
72
bool temperature_multipole {false};
73
bool trigger_on {false};
74
bool trigger_predict {false};
75
bool ufs_on {false};
76
bool urr_ptables_on {true};
77
bool weight_windows_on {false};
78
bool weight_window_checkpoint_surface {false};
79
bool weight_window_checkpoint_collision {true};
80
bool write_all_tracks {false};
81
bool write_initial_source {false};
82

83
std::string path_cross_sections;
84
std::string path_input;
85
std::string path_output;
86
std::string path_particle_restart;
87
std::string path_sourcepoint;
88
std::string path_statepoint;
89
const char* path_statepoint_c {path_statepoint.c_str()};
90
std::string weight_windows_file;
91

92
int32_t n_inactive {0};
93
int32_t max_lost_particles {10};
94
double rel_max_lost_particles {1.0e-6};
95
int32_t max_write_lost_particles {-1};
96
int32_t gen_per_batch {1};
97
int64_t n_particles {-1};
98

99
int64_t max_particles_in_flight {100000};
100
int max_particle_events {1000000};
101

102
ElectronTreatment electron_treatment {ElectronTreatment::TTB};
103
array<double, 4> energy_cutoff {0.0, 1000.0, 0.0, 0.0};
104
array<double, 4> time_cutoff {INFTY, INFTY, INFTY, INFTY};
105
int legendre_to_tabular_points {C_NONE};
106
int max_order {0};
107
int n_log_bins {8000};
108
int n_batches;
109
int n_max_batches;
110
int max_history_splits {10'000'000};
111
int max_tracks {1000};
112
ResScatMethod res_scat_method {ResScatMethod::rvs};
113
double res_scat_energy_min {0.01};
114
double res_scat_energy_max {1000.0};
115
vector<std::string> res_scat_nuclides;
116
RunMode run_mode {RunMode::UNSET};
117
SolverType solver_type {SolverType::MONTE_CARLO};
118
std::unordered_set<int> sourcepoint_batch;
119
std::unordered_set<int> statepoint_batch;
120
std::unordered_set<int> source_write_surf_id;
121
int64_t max_surface_particles;
122
int64_t ssw_cell_id {C_NONE};
123
SSWCellType ssw_cell_type {SSWCellType::None};
124
TemperatureMethod temperature_method {TemperatureMethod::NEAREST};
125
double temperature_tolerance {10.0};
126
double temperature_default {293.6};
127
array<double, 2> temperature_range {0.0, 0.0};
128
int trace_batch;
129
int trace_gen;
130
int64_t trace_particle;
131
vector<array<int, 3>> track_identifiers;
132
int trigger_batch_interval {1};
133
int verbosity {7};
134
double weight_cutoff {0.25};
135
double weight_survive {1.0};
136

137
} // namespace settings
138

139
//==============================================================================
140
// Functions
141
//==============================================================================
142

143
void get_run_parameters(pugi::xml_node node_base)
5,828✔
144
{
145
  using namespace settings;
146
  using namespace pugi;
147

148
  // Check number of particles
149
  if (!check_for_node(node_base, "particles")) {
5,828✔
UNCOV
150
    fatal_error("Need to specify number of particles.");
×
151
  }
152

153
  // Get number of particles if it wasn't specified as a command-line argument
154
  if (n_particles == -1) {
5,828✔
155
    n_particles = std::stoll(get_node_value(node_base, "particles"));
5,828✔
156
  }
157

158
  // Get maximum number of in flight particles for event-based mode
159
  if (check_for_node(node_base, "max_particles_in_flight")) {
5,828✔
UNCOV
160
    max_particles_in_flight =
×
UNCOV
161
      std::stoll(get_node_value(node_base, "max_particles_in_flight"));
×
162
  }
163

164
  // Get maximum number of events allowed per particle
165
  if (check_for_node(node_base, "max_particle_events")) {
5,828✔
UNCOV
166
    max_particle_events =
×
UNCOV
167
      std::stoll(get_node_value(node_base, "max_particle_events"));
×
168
  }
169

170
  // Get number of basic batches
171
  if (check_for_node(node_base, "batches")) {
5,828✔
172
    n_batches = std::stoi(get_node_value(node_base, "batches"));
5,828✔
173
  }
174
  if (!trigger_on)
5,828✔
175
    n_max_batches = n_batches;
5,683✔
176

177
  // Get max number of lost particles
178
  if (check_for_node(node_base, "max_lost_particles")) {
5,828✔
179
    max_lost_particles =
17✔
180
      std::stoi(get_node_value(node_base, "max_lost_particles"));
17✔
181
  }
182

183
  // Get relative number of lost particles
184
  if (check_for_node(node_base, "rel_max_lost_particles")) {
5,828✔
UNCOV
185
    rel_max_lost_particles =
×
UNCOV
186
      std::stod(get_node_value(node_base, "rel_max_lost_particles"));
×
187
  }
188

189
  // Get relative number of lost particles
190
  if (check_for_node(node_base, "max_write_lost_particles")) {
5,828✔
191
    max_write_lost_particles =
17✔
192
      std::stoi(get_node_value(node_base, "max_write_lost_particles"));
17✔
193
  }
194

195
  // Get number of inactive batches
196
  if (run_mode == RunMode::EIGENVALUE ||
5,828✔
197
      solver_type == SolverType::RANDOM_RAY) {
1,793✔
198
    if (check_for_node(node_base, "inactive")) {
4,086✔
199
      n_inactive = std::stoi(get_node_value(node_base, "inactive"));
3,956✔
200
    }
201
    if (check_for_node(node_base, "generations_per_batch")) {
4,086✔
202
      gen_per_batch =
17✔
203
        std::stoi(get_node_value(node_base, "generations_per_batch"));
17✔
204
    }
205

206
    // Preallocate space for keff and entropy by generation
207
    int m = settings::n_max_batches * settings::gen_per_batch;
4,086✔
208
    simulation::k_generation.reserve(m);
4,086✔
209
    simulation::entropy.reserve(m);
4,086✔
210

211
    // Get the trigger information for keff
212
    if (check_for_node(node_base, "keff_trigger")) {
4,086✔
213
      xml_node node_keff_trigger = node_base.child("keff_trigger");
114✔
214

215
      if (check_for_node(node_keff_trigger, "type")) {
114✔
216
        auto temp = get_node_value(node_keff_trigger, "type", true, true);
114✔
217
        if (temp == "std_dev") {
114✔
218
          keff_trigger.metric = TriggerMetric::standard_deviation;
114✔
219
        } else if (temp == "variance") {
×
220
          keff_trigger.metric = TriggerMetric::variance;
×
UNCOV
221
        } else if (temp == "rel_err") {
×
222
          keff_trigger.metric = TriggerMetric::relative_error;
×
223
        } else {
UNCOV
224
          fatal_error("Unrecognized keff trigger type " + temp);
×
225
        }
226
      } else {
114✔
UNCOV
227
        fatal_error("Specify keff trigger type in settings XML");
×
228
      }
229

230
      if (check_for_node(node_keff_trigger, "threshold")) {
114✔
231
        keff_trigger.threshold =
114✔
232
          std::stod(get_node_value(node_keff_trigger, "threshold"));
114✔
233
        if (keff_trigger.threshold <= 0) {
114✔
UNCOV
234
          fatal_error("keff trigger threshold must be positive");
×
235
        }
236
      } else {
UNCOV
237
        fatal_error("Specify keff trigger threshold in settings XML");
×
238
      }
239
    }
240
  }
241

242
  // Random ray variables
243
  if (solver_type == SolverType::RANDOM_RAY) {
5,828✔
244
    xml_node random_ray_node = node_base.child("random_ray");
85✔
245
    if (check_for_node(random_ray_node, "distance_active")) {
85✔
246
      RandomRay::distance_active_ =
85✔
247
        std::stod(get_node_value(random_ray_node, "distance_active"));
85✔
248
      if (RandomRay::distance_active_ <= 0.0) {
85✔
UNCOV
249
        fatal_error("Random ray active distance must be greater than 0");
×
250
      }
251
    } else {
UNCOV
252
      fatal_error("Specify random ray active distance in settings XML");
×
253
    }
254
    if (check_for_node(random_ray_node, "distance_inactive")) {
85✔
255
      RandomRay::distance_inactive_ =
85✔
256
        std::stod(get_node_value(random_ray_node, "distance_inactive"));
85✔
257
      if (RandomRay::distance_inactive_ < 0) {
85✔
UNCOV
258
        fatal_error(
×
259
          "Random ray inactive distance must be greater than or equal to 0");
260
      }
261
    } else {
UNCOV
262
      fatal_error("Specify random ray inactive distance in settings XML");
×
263
    }
264
    if (check_for_node(random_ray_node, "source")) {
85✔
265
      xml_node source_node = random_ray_node.child("source");
85✔
266
      // Get point to list of <source> elements and make sure there is at least
267
      // one
268
      RandomRay::ray_source_ = Source::create(source_node);
85✔
269
    } else {
UNCOV
270
      fatal_error("Specify random ray source in settings XML");
×
271
    }
272
  }
273
}
5,828✔
274

275
void read_settings_xml()
1,695✔
276
{
277
  using namespace settings;
278
  using namespace pugi;
279
  // Check if settings.xml exists
280
  std::string filename = settings::path_input + "settings.xml";
1,695✔
281
  if (!file_exists(filename)) {
1,695✔
282
    if (run_mode != RunMode::PLOTTING) {
24✔
UNCOV
283
      fatal_error("Could not find any XML input files! In order to run OpenMC, "
×
284
                  "you first need a set of input files; at a minimum, this "
285
                  "includes settings.xml, geometry.xml, and materials.xml or a "
286
                  "single model XML file. Please consult the user's guide at "
287
                  "https://docs.openmc.org for further information.");
288
    } else {
289
      // The settings.xml file is optional if we just want to make a plot.
290
      return;
24✔
291
    }
292
  }
293

294
  // Parse settings.xml file
295
  xml_document doc;
1,671✔
296
  auto result = doc.load_file(filename.c_str());
1,671✔
297
  if (!result) {
1,671✔
UNCOV
298
    fatal_error("Error processing settings.xml file.");
×
299
  }
300

301
  // Get root element
302
  xml_node root = doc.document_element();
1,671✔
303

304
  // Verbosity
305
  if (check_for_node(root, "verbosity")) {
1,671✔
306
    verbosity = std::stoi(get_node_value(root, "verbosity"));
211✔
307
  }
308

309
  // To this point, we haven't displayed any output since we didn't know what
310
  // the verbosity is. Now that we checked for it, show the title if necessary
311
  if (mpi::master) {
1,671✔
312
    if (verbosity >= 2)
1,446✔
313
      title();
1,245✔
314
  }
315

316
  write_message("Reading settings XML file...", 5);
1,671✔
317

318
  read_settings_xml(root);
1,671✔
319
}
1,684✔
320

321
void read_settings_xml(pugi::xml_node root)
6,178✔
322
{
323
  using namespace settings;
324
  using namespace pugi;
325

326
  // Find if a multi-group or continuous-energy simulation is desired
327
  if (check_for_node(root, "energy_mode")) {
6,178✔
328
    std::string temp_str = get_node_value(root, "energy_mode", true, true);
629✔
329
    if (temp_str == "mg" || temp_str == "multi-group") {
629✔
330
      run_CE = false;
629✔
UNCOV
331
    } else if (temp_str == "ce" || temp_str == "continuous-energy") {
×
UNCOV
332
      run_CE = true;
×
333
    }
334
  }
629✔
335

336
  // Check for user meshes and allocate
337
  read_meshes(root);
6,178✔
338

339
  // Look for deprecated cross_sections.xml file in settings.xml
340
  if (check_for_node(root, "cross_sections")) {
6,178✔
UNCOV
341
    warning(
×
342
      "Setting cross_sections in settings.xml has been deprecated."
343
      " The cross_sections are now set in materials.xml and the "
344
      "cross_sections input to materials.xml and the OPENMC_CROSS_SECTIONS"
345
      " environment variable will take precendent over setting "
346
      "cross_sections in settings.xml.");
UNCOV
347
    path_cross_sections = get_node_value(root, "cross_sections");
×
348
  }
349

350
  if (!run_CE) {
6,178✔
351
    // Scattering Treatments
352
    if (check_for_node(root, "max_order")) {
629✔
353
      max_order = std::stoi(get_node_value(root, "max_order"));
17✔
354
    } else {
355
      // Set to default of largest int - 1, which means to use whatever is
356
      // contained in library. This is largest int - 1 because for legendre
357
      // scattering, a value of 1 is added to the order; adding 1 to the largest
358
      // int gets you the largest negative integer, which is not what we want.
359
      max_order = std::numeric_limits<int>::max() - 1;
612✔
360
    }
361
  }
362

363
  // Check for a trigger node and get trigger information
364
  if (check_for_node(root, "trigger")) {
6,178✔
365
    xml_node node_trigger = root.child("trigger");
162✔
366

367
    // Check if trigger(s) are to be turned on
368
    trigger_on = get_node_value_bool(node_trigger, "active");
162✔
369

370
    if (trigger_on) {
162✔
371
      if (check_for_node(node_trigger, "max_batches")) {
145✔
372
        n_max_batches = std::stoi(get_node_value(node_trigger, "max_batches"));
145✔
373
      } else {
UNCOV
374
        fatal_error("<max_batches> must be specified with triggers");
×
375
      }
376

377
      // Get the batch interval to check triggers
378
      if (!check_for_node(node_trigger, "batch_interval")) {
145✔
379
        trigger_predict = true;
17✔
380
      } else {
381
        trigger_batch_interval =
128✔
382
          std::stoi(get_node_value(node_trigger, "batch_interval"));
128✔
383
        if (trigger_batch_interval <= 0) {
128✔
UNCOV
384
          fatal_error("Trigger batch interval must be greater than zero");
×
385
        }
386
      }
387
    }
388
  }
389

390
  // Check run mode if it hasn't been set from the command line
391
  xml_node node_mode;
6,178✔
392
  if (run_mode == RunMode::UNSET) {
6,178✔
393
    if (check_for_node(root, "run_mode")) {
5,862✔
394
      std::string temp_str = get_node_value(root, "run_mode", true, true);
5,794✔
395
      if (temp_str == "eigenvalue") {
5,794✔
396
        run_mode = RunMode::EIGENVALUE;
3,967✔
397
      } else if (temp_str == "fixed source") {
1,827✔
398
        run_mode = RunMode::FIXED_SOURCE;
1,793✔
399
      } else if (temp_str == "plot") {
34✔
400
        run_mode = RunMode::PLOTTING;
×
401
      } else if (temp_str == "particle restart") {
34✔
UNCOV
402
        run_mode = RunMode::PARTICLE;
×
403
      } else if (temp_str == "volume") {
34✔
404
        run_mode = RunMode::VOLUME;
34✔
405
      } else {
UNCOV
406
        fatal_error("Unrecognized run mode: " + temp_str);
×
407
      }
408

409
      // Assume XML specifies <particles>, <batches>, etc. directly
410
      node_mode = root;
5,794✔
411
    } else {
5,794✔
412
      warning("<run_mode> should be specified.");
68✔
413

414
      // Make sure that either eigenvalue or fixed source was specified
415
      node_mode = root.child("eigenvalue");
68✔
416
      if (node_mode) {
68✔
417
        run_mode = RunMode::EIGENVALUE;
68✔
418
      } else {
419
        node_mode = root.child("fixed_source");
×
UNCOV
420
        if (node_mode) {
×
421
          run_mode = RunMode::FIXED_SOURCE;
×
422
        } else {
UNCOV
423
          fatal_error("<eigenvalue> or <fixed_source> not specified.");
×
424
        }
425
      }
426
    }
427
  }
428

429
  // Check solver type
430
  if (check_for_node(root, "random_ray")) {
6,178✔
431
    solver_type = SolverType::RANDOM_RAY;
85✔
432
    if (run_CE)
85✔
UNCOV
433
      fatal_error("multi-group energy mode must be specified in settings XML "
×
434
                  "when using the random ray solver.");
435
  }
436

437
  if (run_mode == RunMode::EIGENVALUE || run_mode == RunMode::FIXED_SOURCE) {
6,178✔
438
    // Read run parameters
439
    get_run_parameters(node_mode);
5,828✔
440

441
    // Check number of active batches, inactive batches, max lost particles and
442
    // particles
443
    if (n_batches <= n_inactive) {
5,828✔
444
      fatal_error("Number of active batches must be greater than zero.");
×
445
    } else if (n_inactive < 0) {
5,828✔
446
      fatal_error("Number of inactive batches must be non-negative.");
×
447
    } else if (n_particles <= 0) {
5,828✔
448
      fatal_error("Number of particles must be greater than zero.");
×
449
    } else if (max_lost_particles <= 0) {
5,828✔
450
      fatal_error("Number of max lost particles must be greater than zero.");
×
451
    } else if (rel_max_lost_particles <= 0.0 || rel_max_lost_particles >= 1.0) {
5,828✔
UNCOV
452
      fatal_error("Relative max lost particles must be between zero and one.");
×
453
    }
454
  }
455

456
  // Copy plotting random number seed if specified
457
  if (check_for_node(root, "plot_seed")) {
6,178✔
UNCOV
458
    auto seed = std::stoll(get_node_value(root, "plot_seed"));
×
UNCOV
459
    model::plotter_seed = seed;
×
460
  }
461

462
  // Copy random number seed if specified
463
  if (check_for_node(root, "seed")) {
6,178✔
464
    auto seed = std::stoll(get_node_value(root, "seed"));
408✔
465
    openmc_set_seed(seed);
408✔
466
  }
467

468
  // Check for electron treatment
469
  if (check_for_node(root, "electron_treatment")) {
6,178✔
470
    auto temp_str = get_node_value(root, "electron_treatment", true, true);
51✔
471
    if (temp_str == "led") {
51✔
UNCOV
472
      electron_treatment = ElectronTreatment::LED;
×
473
    } else if (temp_str == "ttb") {
51✔
474
      electron_treatment = ElectronTreatment::TTB;
51✔
475
    } else {
UNCOV
476
      fatal_error("Unrecognized electron treatment: " + temp_str + ".");
×
477
    }
478
  }
51✔
479

480
  // Check for photon transport
481
  if (check_for_node(root, "photon_transport")) {
6,178✔
482
    photon_transport = get_node_value_bool(root, "photon_transport");
189✔
483

484
    if (!run_CE && photon_transport) {
189✔
UNCOV
485
      fatal_error("Photon transport is not currently supported in "
×
486
                  "multigroup mode");
487
    }
488
  }
489

490
  // Number of bins for logarithmic grid
491
  if (check_for_node(root, "log_grid_bins")) {
6,178✔
492
    n_log_bins = std::stoi(get_node_value(root, "log_grid_bins"));
17✔
493
    if (n_log_bins < 1) {
17✔
UNCOV
494
      fatal_error("Number of bins for logarithmic grid must be greater "
×
495
                  "than zero.");
496
    }
497
  }
498

499
  // Number of OpenMP threads
500
  if (check_for_node(root, "threads")) {
6,178✔
UNCOV
501
    if (mpi::master)
×
UNCOV
502
      warning("The <threads> element has been deprecated. Use "
×
503
              "the OMP_NUM_THREADS environment variable to set the number of "
504
              "threads.");
505
  }
506

507
  // ==========================================================================
508
  // EXTERNAL SOURCE
509

510
  // Get point to list of <source> elements and make sure there is at least one
511
  for (pugi::xml_node node : root.children("source")) {
12,212✔
512
    model::external_sources.push_back(Source::create(node));
6,045✔
513
  }
514

515
  // Check if the user has specified to read surface source
516
  if (check_for_node(root, "surf_source_read")) {
6,167✔
517
    surf_source_read = true;
17✔
518
    // Get surface source read node
519
    xml_node node_ssr = root.child("surf_source_read");
17✔
520

521
    std::string path = "surface_source.h5";
17✔
522
    // Check if the user has specified different file for surface source reading
523
    if (check_for_node(node_ssr, "path")) {
17✔
524
      path = get_node_value(node_ssr, "path", false, true);
17✔
525
    }
526
    model::external_sources.push_back(make_unique<FileSource>(path));
17✔
527
  }
17✔
528

529
  // If no source specified, default to isotropic point source at origin with
530
  // Watt spectrum. No default source is needed in random ray mode.
531
  if (model::external_sources.empty() &&
7,818✔
532
      settings::solver_type != SolverType::RANDOM_RAY) {
1,651✔
533
    double T[] {0.0};
1,617✔
534
    double p[] {1.0};
1,617✔
535
    model::external_sources.push_back(make_unique<IndependentSource>(
1,617✔
536
      UPtrSpace {new SpatialPoint({0.0, 0.0, 0.0})},
3,234✔
537
      UPtrAngle {new Isotropic()}, UPtrDist {new Watt(0.988e6, 2.249e-6)},
3,234✔
538
      UPtrDist {new Discrete(T, p, 1)}));
3,234✔
539
  }
540

541
  // Check if we want to write out source
542
  if (check_for_node(root, "write_initial_source")) {
6,167✔
UNCOV
543
    write_initial_source = get_node_value_bool(root, "write_initial_source");
×
544
  }
545

546
  // Survival biasing
547
  if (check_for_node(root, "survival_biasing")) {
6,167✔
548
    survival_biasing = get_node_value_bool(root, "survival_biasing");
190✔
549
  }
550

551
  // Probability tables
552
  if (check_for_node(root, "ptables")) {
6,167✔
553
    urr_ptables_on = get_node_value_bool(root, "ptables");
17✔
554
  }
555

556
  // Cutoffs
557
  if (check_for_node(root, "cutoff")) {
6,167✔
558
    xml_node node_cutoff = root.child("cutoff");
114✔
559
    if (check_for_node(node_cutoff, "weight")) {
114✔
560
      weight_cutoff = std::stod(get_node_value(node_cutoff, "weight"));
17✔
561
    }
562
    if (check_for_node(node_cutoff, "weight_avg")) {
114✔
563
      weight_survive = std::stod(get_node_value(node_cutoff, "weight_avg"));
17✔
564
    }
565
    if (check_for_node(node_cutoff, "energy_neutron")) {
114✔
566
      energy_cutoff[0] =
34✔
567
        std::stod(get_node_value(node_cutoff, "energy_neutron"));
17✔
568
    } else if (check_for_node(node_cutoff, "energy")) {
97✔
569
      warning("The use of an <energy> cutoff is deprecated and should "
×
570
              "be replaced by <energy_neutron>.");
UNCOV
571
      energy_cutoff[0] = std::stod(get_node_value(node_cutoff, "energy"));
×
572
    }
573
    if (check_for_node(node_cutoff, "energy_photon")) {
114✔
574
      energy_cutoff[1] =
126✔
575
        std::stod(get_node_value(node_cutoff, "energy_photon"));
63✔
576
    }
577
    if (check_for_node(node_cutoff, "energy_electron")) {
114✔
UNCOV
578
      energy_cutoff[2] =
×
UNCOV
579
        std::stof(get_node_value(node_cutoff, "energy_electron"));
×
580
    }
581
    if (check_for_node(node_cutoff, "energy_positron")) {
114✔
UNCOV
582
      energy_cutoff[3] =
×
UNCOV
583
        std::stod(get_node_value(node_cutoff, "energy_positron"));
×
584
    }
585
    if (check_for_node(node_cutoff, "time_neutron")) {
114✔
586
      time_cutoff[0] = std::stod(get_node_value(node_cutoff, "time_neutron"));
17✔
587
    }
588
    if (check_for_node(node_cutoff, "time_photon")) {
114✔
UNCOV
589
      time_cutoff[1] = std::stod(get_node_value(node_cutoff, "time_photon"));
×
590
    }
591
    if (check_for_node(node_cutoff, "time_electron")) {
114✔
UNCOV
592
      time_cutoff[2] = std::stod(get_node_value(node_cutoff, "time_electron"));
×
593
    }
594
    if (check_for_node(node_cutoff, "time_positron")) {
114✔
UNCOV
595
      time_cutoff[3] = std::stod(get_node_value(node_cutoff, "time_positron"));
×
596
    }
597
  }
598

599
  // Particle trace
600
  if (check_for_node(root, "trace")) {
6,167✔
601
    auto temp = get_node_array<int64_t>(root, "trace");
17✔
602
    if (temp.size() != 3) {
17✔
UNCOV
603
      fatal_error("Must provide 3 integers for <trace> that specify the "
×
604
                  "batch, generation, and particle number.");
605
    }
606
    trace_batch = temp.at(0);
17✔
607
    trace_gen = temp.at(1);
17✔
608
    trace_particle = temp.at(2);
17✔
609
  }
17✔
610

611
  // Particle tracks
612
  if (check_for_node(root, "track")) {
6,167✔
613
    // Get values and make sure there are three per particle
614
    auto temp = get_node_array<int>(root, "track");
51✔
615
    if (temp.size() % 3 != 0) {
51✔
UNCOV
616
      fatal_error(
×
617
        "Number of integers specified in 'track' is not "
618
        "divisible by 3.  Please provide 3 integers per particle to be "
619
        "tracked.");
620
    }
621

622
    // Reshape into track_identifiers
623
    int n_tracks = temp.size() / 3;
51✔
624
    for (int i = 0; i < n_tracks; ++i) {
204✔
625
      track_identifiers.push_back(
153✔
626
        {temp[3 * i], temp[3 * i + 1], temp[3 * i + 2]});
153✔
627
    }
628
  }
51✔
629

630
  // Shannon Entropy mesh
631
  if (check_for_node(root, "entropy_mesh")) {
6,167✔
632
    int temp = std::stoi(get_node_value(root, "entropy_mesh"));
485✔
633
    if (model::mesh_map.find(temp) == model::mesh_map.end()) {
485✔
UNCOV
634
      fatal_error(fmt::format(
×
635
        "Mesh {} specified for Shannon entropy does not exist.", temp));
636
    }
637

638
    auto* m =
639
      dynamic_cast<RegularMesh*>(model::meshes[model::mesh_map.at(temp)].get());
485✔
640
    if (!m)
485✔
UNCOV
641
      fatal_error("Only regular meshes can be used as an entropy mesh");
×
642
    simulation::entropy_mesh = m;
485✔
643

644
    // Turn on Shannon entropy calculation
645
    entropy_on = true;
485✔
646

647
  } else if (check_for_node(root, "entropy")) {
5,682✔
UNCOV
648
    fatal_error(
×
649
      "Specifying a Shannon entropy mesh via the <entropy> element "
650
      "is deprecated. Please create a mesh using <mesh> and then reference "
651
      "it by specifying its ID in an <entropy_mesh> element.");
652
  }
653

654
  // Uniform fission source weighting mesh
655
  if (check_for_node(root, "ufs_mesh")) {
6,167✔
656
    auto temp = std::stoi(get_node_value(root, "ufs_mesh"));
17✔
657
    if (model::mesh_map.find(temp) == model::mesh_map.end()) {
17✔
UNCOV
658
      fatal_error(fmt::format("Mesh {} specified for uniform fission site "
×
659
                              "method does not exist.",
660
        temp));
661
    }
662

663
    auto* m =
664
      dynamic_cast<RegularMesh*>(model::meshes[model::mesh_map.at(temp)].get());
17✔
665
    if (!m)
17✔
UNCOV
666
      fatal_error("Only regular meshes can be used as a UFS mesh");
×
667
    simulation::ufs_mesh = m;
17✔
668

669
    // Turn on uniform fission source weighting
670
    ufs_on = true;
17✔
671

672
  } else if (check_for_node(root, "uniform_fs")) {
6,150✔
UNCOV
673
    fatal_error(
×
674
      "Specifying a UFS mesh via the <uniform_fs> element "
675
      "is deprecated. Please create a mesh using <mesh> and then reference "
676
      "it by specifying its ID in a <ufs_mesh> element.");
677
  }
678

679
  // Check if the user has specified to write state points
680
  if (check_for_node(root, "state_point")) {
6,167✔
681

682
    // Get pointer to state_point node
683
    auto node_sp = root.child("state_point");
200✔
684

685
    // Determine number of batches at which to store state points
686
    if (check_for_node(node_sp, "batches")) {
200✔
687
      // User gave specific batches to write state points
688
      auto temp = get_node_array<int>(node_sp, "batches");
200✔
689
      for (const auto& b : temp) {
617✔
690
        statepoint_batch.insert(b);
417✔
691
      }
692
    } else {
200✔
693
      // If neither were specified, write state point at last batch
UNCOV
694
      statepoint_batch.insert(n_batches);
×
695
    }
696
  } else {
697
    // If no <state_point> tag was present, by default write state point at
698
    // last batch only
699
    statepoint_batch.insert(n_batches);
5,967✔
700
  }
701

702
  // Check if the user has specified to write source points
703
  if (check_for_node(root, "source_point")) {
6,167✔
704
    // Get source_point node
705
    xml_node node_sp = root.child("source_point");
102✔
706

707
    // Determine batches at which to store source points
708
    if (check_for_node(node_sp, "batches")) {
102✔
709
      // User gave specific batches to write source points
710
      auto temp = get_node_array<int>(node_sp, "batches");
51✔
711
      for (const auto& b : temp) {
136✔
712
        sourcepoint_batch.insert(b);
85✔
713
      }
714
    } else {
51✔
715
      // If neither were specified, write source points with state points
716
      sourcepoint_batch = statepoint_batch;
51✔
717
    }
718

719
    // Check if the user has specified to write binary source file
720
    if (check_for_node(node_sp, "separate")) {
102✔
721
      source_separate = get_node_value_bool(node_sp, "separate");
68✔
722
    }
723
    if (check_for_node(node_sp, "write")) {
102✔
UNCOV
724
      source_write = get_node_value_bool(node_sp, "write");
×
725
    }
726
    if (check_for_node(node_sp, "mcpl")) {
102✔
727
      source_mcpl_write = get_node_value_bool(node_sp, "mcpl");
17✔
728

729
      // Make sure MCPL support is enabled
730
      if (source_mcpl_write && !MCPL_ENABLED) {
17✔
UNCOV
731
        fatal_error(
×
732
          "Your build of OpenMC does not support writing MCPL source files.");
733
      }
734
    }
735
    if (check_for_node(node_sp, "overwrite_latest")) {
102✔
736
      source_latest = get_node_value_bool(node_sp, "overwrite_latest");
17✔
737
      source_separate = source_latest;
17✔
738
    }
739
  } else {
740
    // If no <source_point> tag was present, by default we keep source bank in
741
    // statepoint file and write it out at statepoints intervals
742
    source_separate = false;
6,065✔
743
    sourcepoint_batch = statepoint_batch;
6,065✔
744
  }
745

746
  // Check if the user has specified to write surface source
747
  if (check_for_node(root, "surf_source_write")) {
6,167✔
748
    surf_source_write = true;
343✔
749
    // Get surface source write node
750
    xml_node node_ssw = root.child("surf_source_write");
343✔
751

752
    // Determine surface ids at which crossing particles are to be banked.
753
    // If no surfaces are specified, all surfaces in the model will be used
754
    // to bank source points.
755
    if (check_for_node(node_ssw, "surface_ids")) {
343✔
756
      auto temp = get_node_array<int>(node_ssw, "surface_ids");
209✔
757
      for (const auto& b : temp) {
1,065✔
758
        source_write_surf_id.insert(b);
856✔
759
      }
760
    }
209✔
761

762
    // Get maximum number of particles to be banked per surface
763
    if (check_for_node(node_ssw, "max_particles")) {
343✔
764
      max_surface_particles =
333✔
765
        std::stoll(get_node_value(node_ssw, "max_particles"));
333✔
766
    } else {
767
      fatal_error("A maximum number of particles needs to be specified "
10✔
768
                  "using the 'max_particles' parameter to store surface "
769
                  "source points.");
770
    }
771

772
    if (check_for_node(node_ssw, "mcpl")) {
333✔
UNCOV
773
      surf_mcpl_write = get_node_value_bool(node_ssw, "mcpl");
×
774

775
      // Make sure MCPL support is enabled
UNCOV
776
      if (surf_mcpl_write && !MCPL_ENABLED) {
×
UNCOV
777
        fatal_error("Your build of OpenMC does not support writing MCPL "
×
778
                    "surface source files.");
779
      }
780
    }
781
    // Get cell information
782
    if (check_for_node(node_ssw, "cell")) {
333✔
783
      ssw_cell_id = std::stoll(get_node_value(node_ssw, "cell"));
114✔
784
      ssw_cell_type = SSWCellType::Both;
114✔
785
    }
786
    if (check_for_node(node_ssw, "cellfrom")) {
333✔
787
      if (ssw_cell_id != C_NONE) {
99✔
788
        fatal_error(
20✔
789
          "'cell', 'cellfrom' and 'cellto' cannot be used at the same time.");
790
      }
791
      ssw_cell_id = std::stoll(get_node_value(node_ssw, "cellfrom"));
79✔
792
      ssw_cell_type = SSWCellType::From;
79✔
793
    }
794
    if (check_for_node(node_ssw, "cellto")) {
313✔
795
      if (ssw_cell_id != C_NONE) {
78✔
796
        fatal_error(
20✔
797
          "'cell', 'cellfrom' and 'cellto' cannot be used at the same time.");
798
      }
799
      ssw_cell_id = std::stoll(get_node_value(node_ssw, "cellto"));
58✔
800
      ssw_cell_type = SSWCellType::To;
58✔
801
    }
802
  }
803

804
  // If source is not separate and is to be written out in the statepoint file,
805
  // make sure that the sourcepoint batch numbers are contained in the
806
  // statepoint list
807
  if (!source_separate) {
6,117✔
808
    for (const auto& b : sourcepoint_batch) {
12,230✔
809
      if (!contains(statepoint_batch, b)) {
6,198✔
UNCOV
810
        fatal_error(
×
811
          "Sourcepoint batches are not a subset of statepoint batches.");
812
      }
813
    }
814
  }
815

816
  // Check if the user has specified to not reduce tallies at the end of every
817
  // batch
818
  if (check_for_node(root, "no_reduce")) {
6,117✔
UNCOV
819
    reduce_tallies = !get_node_value_bool(root, "no_reduce");
×
820
  }
821

822
  // Check if the user has specified to use confidence intervals for
823
  // uncertainties rather than standard deviations
824
  if (check_for_node(root, "confidence_intervals")) {
6,117✔
825
    confidence_intervals = get_node_value_bool(root, "confidence_intervals");
17✔
826
  }
827

828
  // Check for output options
829
  if (check_for_node(root, "output")) {
6,117✔
830
    // Get pointer to output node
831
    pugi::xml_node node_output = root.child("output");
397✔
832

833
    // Check for summary option
834
    if (check_for_node(node_output, "summary")) {
397✔
835
      output_summary = get_node_value_bool(node_output, "summary");
380✔
836
    }
837

838
    // Check for ASCII tallies output option
839
    if (check_for_node(node_output, "tallies")) {
397✔
840
      output_tallies = get_node_value_bool(node_output, "tallies");
17✔
841
    }
842

843
    // Set output directory if a path has been specified
844
    if (check_for_node(node_output, "path")) {
397✔
UNCOV
845
      path_output = get_node_value(node_output, "path");
×
UNCOV
846
      if (!ends_with(path_output, "/")) {
×
UNCOV
847
        path_output += "/";
×
848
      }
849
    }
850
  }
851

852
  // Resonance scattering parameters
853
  if (check_for_node(root, "resonance_scattering")) {
6,117✔
854
    xml_node node_res_scat = root.child("resonance_scattering");
17✔
855

856
    // See if resonance scattering is enabled
857
    if (check_for_node(node_res_scat, "enable")) {
17✔
858
      res_scat_on = get_node_value_bool(node_res_scat, "enable");
17✔
859
    } else {
UNCOV
860
      res_scat_on = true;
×
861
    }
862

863
    // Determine what method is used
864
    if (check_for_node(node_res_scat, "method")) {
17✔
865
      auto temp = get_node_value(node_res_scat, "method", true, true);
17✔
866
      if (temp == "rvs") {
17✔
867
        res_scat_method = ResScatMethod::rvs;
17✔
UNCOV
868
      } else if (temp == "dbrc") {
×
UNCOV
869
        res_scat_method = ResScatMethod::dbrc;
×
870
      } else {
UNCOV
871
        fatal_error(
×
UNCOV
872
          "Unrecognized resonance elastic scattering method: " + temp + ".");
×
873
      }
874
    }
17✔
875

876
    // Minimum energy for resonance scattering
877
    if (check_for_node(node_res_scat, "energy_min")) {
17✔
878
      res_scat_energy_min =
17✔
879
        std::stod(get_node_value(node_res_scat, "energy_min"));
17✔
880
    }
881
    if (res_scat_energy_min < 0.0) {
17✔
UNCOV
882
      fatal_error("Lower resonance scattering energy bound is negative");
×
883
    }
884

885
    // Maximum energy for resonance scattering
886
    if (check_for_node(node_res_scat, "energy_max")) {
17✔
887
      res_scat_energy_max =
17✔
888
        std::stod(get_node_value(node_res_scat, "energy_max"));
17✔
889
    }
890
    if (res_scat_energy_max < res_scat_energy_min) {
17✔
UNCOV
891
      fatal_error("Upper resonance scattering energy bound is below the "
×
892
                  "lower resonance scattering energy bound.");
893
    }
894

895
    // Get resonance scattering nuclides
896
    if (check_for_node(node_res_scat, "nuclides")) {
17✔
897
      res_scat_nuclides =
898
        get_node_array<std::string>(node_res_scat, "nuclides");
17✔
899
    }
900
  }
901

902
  // Get volume calculations
903
  for (pugi::xml_node node_vol : root.children("volume_calc")) {
6,447✔
904
    model::volume_calcs.emplace_back(node_vol);
330✔
905
  }
906

907
  // Get temperature settings
908
  if (check_for_node(root, "temperature_default")) {
6,117✔
909
    temperature_default =
187✔
910
      std::stod(get_node_value(root, "temperature_default"));
187✔
911
  }
912
  if (check_for_node(root, "temperature_method")) {
6,117✔
913
    auto temp = get_node_value(root, "temperature_method", true, true);
350✔
914
    if (temp == "nearest") {
350✔
915
      temperature_method = TemperatureMethod::NEAREST;
150✔
916
    } else if (temp == "interpolation") {
200✔
917
      temperature_method = TemperatureMethod::INTERPOLATION;
200✔
918
    } else {
UNCOV
919
      fatal_error("Unknown temperature method: " + temp);
×
920
    }
921
  }
350✔
922
  if (check_for_node(root, "temperature_tolerance")) {
6,117✔
923
    temperature_tolerance =
186✔
924
      std::stod(get_node_value(root, "temperature_tolerance"));
186✔
925
  }
926
  if (check_for_node(root, "temperature_multipole")) {
6,117✔
927
    temperature_multipole = get_node_value_bool(root, "temperature_multipole");
34✔
928

929
    // Multipole currently doesn't work with photon transport
930
    if (temperature_multipole && photon_transport) {
34✔
UNCOV
931
      fatal_error("Multipole data cannot currently be used in conjunction with "
×
932
                  "photon transport.");
933
    }
934
  }
935
  if (check_for_node(root, "temperature_range")) {
6,117✔
936
    auto range = get_node_array<double>(root, "temperature_range");
×
UNCOV
937
    temperature_range[0] = range.at(0);
×
UNCOV
938
    temperature_range[1] = range.at(1);
×
939
  }
940

941
  // Check for tabular_legendre options
942
  if (check_for_node(root, "tabular_legendre")) {
6,117✔
943
    // Get pointer to tabular_legendre node
944
    xml_node node_tab_leg = root.child("tabular_legendre");
102✔
945

946
    // Check for enable option
947
    if (check_for_node(node_tab_leg, "enable")) {
102✔
948
      legendre_to_tabular = get_node_value_bool(node_tab_leg, "enable");
102✔
949
    }
950

951
    // Check for the number of points
952
    if (check_for_node(node_tab_leg, "num_points")) {
102✔
UNCOV
953
      legendre_to_tabular_points =
×
UNCOV
954
        std::stoi(get_node_value(node_tab_leg, "num_points"));
×
955
      if (legendre_to_tabular_points <= 1 && !run_CE) {
×
UNCOV
956
        fatal_error(
×
957
          "The 'num_points' subelement/attribute of the "
958
          "<tabular_legendre> element must contain a value greater than 1");
959
      }
960
    }
961
  }
962

963
  // Check whether create delayed neutrons in fission
964
  if (check_for_node(root, "create_delayed_neutrons")) {
6,117✔
UNCOV
965
    create_delayed_neutrons =
×
UNCOV
966
      get_node_value_bool(root, "create_delayed_neutrons");
×
967
  }
968

969
  // Check whether create fission sites
970
  if (run_mode == RunMode::FIXED_SOURCE) {
6,117✔
971
    if (check_for_node(root, "create_fission_neutrons")) {
1,742✔
972
      create_fission_neutrons =
17✔
973
        get_node_value_bool(root, "create_fission_neutrons");
17✔
974
    }
975
  }
976

977
  // Check whether to scale fission photon yields
978
  if (check_for_node(root, "delayed_photon_scaling")) {
6,117✔
UNCOV
979
    delayed_photon_scaling =
×
UNCOV
980
      get_node_value_bool(root, "delayed_photon_scaling");
×
981
  }
982

983
  // Check whether to use event-based parallelism
984
  if (check_for_node(root, "event_based")) {
6,117✔
UNCOV
985
    event_based = get_node_value_bool(root, "event_based");
×
986
  }
987

988
  // Check whether material cell offsets should be generated
989
  if (check_for_node(root, "material_cell_offsets")) {
6,117✔
UNCOV
990
    material_cell_offsets = get_node_value_bool(root, "material_cell_offsets");
×
991
  }
992

993
  // Weight window information
994
  for (pugi::xml_node node_ww : root.children("weight_windows")) {
6,187✔
995
    variance_reduction::weight_windows.emplace_back(
70✔
996
      std::make_unique<WeightWindows>(node_ww));
140✔
997
  }
998

999
  // Enable weight windows by default if one or more are present
1000
  if (variance_reduction::weight_windows.size() > 0)
6,117✔
1001
    settings::weight_windows_on = true;
41✔
1002

1003
  // read weight windows from file
1004
  if (check_for_node(root, "weight_windows_file")) {
6,117✔
UNCOV
1005
    weight_windows_file = get_node_value(root, "weight_windows_file");
×
1006
  }
1007

1008
  // read settings for weight windows value, this will override
1009
  // the automatic setting even if weight windows are present
1010
  if (check_for_node(root, "weight_windows_on")) {
6,117✔
1011
    weight_windows_on = get_node_value_bool(root, "weight_windows_on");
24✔
1012
  }
1013

1014
  if (check_for_node(root, "max_history_splits")) {
6,117✔
1015
    settings::max_history_splits =
233✔
1016
      std::stoi(get_node_value(root, "max_history_splits"));
233✔
1017
  }
1018

1019
  if (check_for_node(root, "max_tracks")) {
6,117✔
1020
    settings::max_tracks = std::stoi(get_node_value(root, "max_tracks"));
51✔
1021
  }
1022

1023
  // Create weight window generator objects
1024
  if (check_for_node(root, "weight_window_generators")) {
6,117✔
1025
    auto wwgs_node = root.child("weight_window_generators");
24✔
1026
    for (pugi::xml_node node_wwg :
24✔
1027
      wwgs_node.children("weight_windows_generator")) {
72✔
1028
      variance_reduction::weight_windows_generators.emplace_back(
24✔
1029
        std::make_unique<WeightWindowsGenerator>(node_wwg));
48✔
1030
    }
1031
    // if any of the weight windows are intended to be generated otf, make sure
1032
    // they're applied
1033
    for (const auto& wwg : variance_reduction::weight_windows_generators) {
24✔
1034
      if (wwg->on_the_fly_) {
24✔
1035
        settings::weight_windows_on = true;
24✔
1036
        break;
24✔
1037
      }
1038
    }
1039
  }
1040

1041
  // Set up weight window checkpoints
1042
  if (check_for_node(root, "weight_window_checkpoints")) {
6,117✔
UNCOV
1043
    xml_node ww_checkpoints = root.child("weight_window_checkpoints");
×
UNCOV
1044
    if (check_for_node(ww_checkpoints, "collision")) {
×
UNCOV
1045
      weight_window_checkpoint_collision =
×
UNCOV
1046
        get_node_value_bool(ww_checkpoints, "collision");
×
1047
    }
UNCOV
1048
    if (check_for_node(ww_checkpoints, "surface")) {
×
UNCOV
1049
      weight_window_checkpoint_surface =
×
UNCOV
1050
        get_node_value_bool(ww_checkpoints, "surface");
×
1051
    }
1052
  }
1053
}
6,117✔
1054

1055
void free_memory_settings()
6,249✔
1056
{
1057
  settings::statepoint_batch.clear();
6,249✔
1058
  settings::sourcepoint_batch.clear();
6,249✔
1059
  settings::source_write_surf_id.clear();
6,249✔
1060
  settings::res_scat_nuclides.clear();
6,249✔
1061
}
6,249✔
1062

1063
//==============================================================================
1064
// C API functions
1065
//==============================================================================
1066

1067
extern "C" int openmc_set_n_batches(
60✔
1068
  int32_t n_batches, bool set_max_batches, bool add_statepoint_batch)
1069
{
1070
  if (settings::n_inactive >= n_batches) {
60✔
1071
    set_errmsg("Number of active batches must be greater than zero.");
12✔
1072
    return OPENMC_E_INVALID_ARGUMENT;
12✔
1073
  }
1074

1075
  if (simulation::current_batch >= n_batches) {
48✔
1076
    set_errmsg("Number of batches must be greater than current batch.");
12✔
1077
    return OPENMC_E_INVALID_ARGUMENT;
12✔
1078
  }
1079

1080
  if (!settings::trigger_on) {
36✔
1081
    // Set n_batches and n_max_batches to same value
1082
    settings::n_batches = n_batches;
12✔
1083
    settings::n_max_batches = n_batches;
12✔
1084
  } else {
1085
    // Set n_batches and n_max_batches based on value of set_max_batches
1086
    if (set_max_batches) {
24✔
1087
      settings::n_max_batches = n_batches;
12✔
1088
    } else {
1089
      settings::n_batches = n_batches;
12✔
1090
    }
1091
  }
1092

1093
  // Update size of k_generation and entropy
1094
  int m = settings::n_max_batches * settings::gen_per_batch;
36✔
1095
  simulation::k_generation.reserve(m);
36✔
1096
  simulation::entropy.reserve(m);
36✔
1097

1098
  // Add value of n_batches to statepoint_batch
1099
  if (add_statepoint_batch &&
60✔
1100
      !(contains(settings::statepoint_batch, n_batches)))
24✔
1101
    settings::statepoint_batch.insert(n_batches);
24✔
1102

1103
  return 0;
36✔
1104
}
1105

1106
extern "C" int openmc_get_n_batches(int* n_batches, bool get_max_batches)
4,560✔
1107
{
1108
  *n_batches = get_max_batches ? settings::n_max_batches : settings::n_batches;
4,560✔
1109

1110
  return 0;
4,560✔
1111
}
1112

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