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

openmc-dev / openmc / 33521352282

01 Sep 2026 02:44PM UTC coverage: 81.193% (-0.2%) from 81.356%
33521352282

Pull #4094

github

web-flow
Merge 3ad36b6e4 into c6f91874b
Pull Request #4094: Replace the IFP parameter enum with independent flags

17997 of 25934 branches covered (69.4%)

Branch coverage included in aggregate %.

58 of 58 new or added lines in 11 files covered. (100.0%)

409 existing lines in 27 files now uncovered.

59388 of 69376 relevant lines covered (85.6%)

42908846.64 hits per line

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

75.04
/src/initialize.cpp
1
#include "openmc/initialize.h"
2

3
#include <clocale>
4
#include <cstddef>
5
#include <cstdlib> // for getenv
6
#include <cstring>
7
#include <string>
8

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

14
#include "openmc/capi.h"
15
#include "openmc/chain.h"
16
#include "openmc/constants.h"
17
#include "openmc/cross_sections.h"
18
#include "openmc/error.h"
19
#include "openmc/file_utils.h"
20
#include "openmc/geometry_aux.h"
21
#include "openmc/hdf5_interface.h"
22
#include "openmc/material.h"
23
#include "openmc/memory.h"
24
#include "openmc/message_passing.h"
25
#include "openmc/mgxs_interface.h"
26
#include "openmc/nuclide.h"
27
#include "openmc/openmp_interface.h"
28
#include "openmc/output.h"
29
#include "openmc/plot.h"
30
#include "openmc/random_lcg.h"
31
#include "openmc/settings.h"
32
#include "openmc/simulation.h"
33
#include "openmc/string_utils.h"
34
#include "openmc/summary.h"
35
#include "openmc/tallies/tally.h"
36
#include "openmc/thermal.h"
37
#include "openmc/timer.h"
38
#include "openmc/vector.h"
39
#include "openmc/weight_windows.h"
40

41
#ifdef OPENMC_LIBMESH_ENABLED
42
#include "libmesh/libmesh.h"
43
#endif
44

45
int openmc_init(int argc, char* argv[], const void* intracomm)
6,757 ✔
46
{
47
  using namespace openmc;
6,757 ✔
48

49
#ifdef OPENMC_MPI
50
  // Check if intracomm was passed
51
  MPI_Comm comm;
2,998 ✔
52
  if (intracomm) {
2,998 ✔
53
    comm = *static_cast<const MPI_Comm*>(intracomm);
2,851 ✔
54
  } else {
55
    comm = MPI_COMM_WORLD;
51 ✔
56
  }
57

58
  // Initialize MPI for C++
59
  initialize_mpi(comm);
2,998 ✔
60
#endif
61

62
  // Parse command-line arguments
63
  int err = parse_command_line(argc, argv);
6,757 ✔
64
  if (err)
6,733 ✔
65
    return err;
66

67
#ifdef OPENMC_LIBMESH_ENABLED
68
  const int n_threads = num_threads();
996 ✔
69
  // initialize libMesh if it hasn't been initialized already
70
  // (if initialized externally, the libmesh_init object needs to be provided
71
  // also)
72
  if (!settings::libmesh_init && !libMesh::initialized()) {
996 !
73
#if defined(OPENMC_MPI) && defined(LIBMESH_HAVE_MPI)
74
    // Pass command line arguments, the OpenMC communicator, and thread count.
75
    // Because libMesh was not initialized, we assume that OpenMC is the primary
76
    // application and that its main MPI comm should be used.
77
    settings::libmesh_init =
996 ✔
78
      make_unique<libMesh::LibMeshInit>(argc, argv, comm, n_threads);
1,992 ✔
79
#else
80
    // libMesh was built without MPI, so use its serial communicator.
81
    settings::libmesh_init =
82
      make_unique<libMesh::LibMeshInit>(argc, argv, 0, n_threads);
83
#endif
84

85
    settings::libmesh_comm = &(settings::libmesh_init->comm());
996 ✔
86
  }
87

88
#endif
89

90
  // Start total and initialization timer
91
  simulation::time_total.start();
6,725 ✔
92
  simulation::time_initialize.start();
6,725 ✔
93

94
#ifdef _OPENMP
95
  // If OMP_SCHEDULE is not set, default to a static schedule
96
  char* envvar = std::getenv("OMP_SCHEDULE");
2,738 ✔
97
  if (!envvar) {
2,738 !
98
    omp_set_schedule(omp_sched_static, 0);
2,738 ✔
99
  }
100
#endif
101

102
  // Initialize random number generator -- if the user specifies a seed and/or
103
  // stride, it will be re-initialized later
104
  openmc::openmc_set_seed(DEFAULT_SEED);
6,725 ✔
105
  openmc::openmc_set_stride(DEFAULT_STRIDE);
6,725 ✔
106

107
  // Copy previous locale and set locale to C. This is a workaround for an issue
108
  // whereby when openmc_init is called from the plotter, the Qt application
109
  // framework first calls std::setlocale, which affects how pugixml reads
110
  // floating point numbers due to a bug:
111
  // https://github.com/zeux/pugixml/issues/469
112
  std::string prev_locale = std::setlocale(LC_ALL, nullptr);
6,725 ✔
113
  if (std::setlocale(LC_ALL, "C") == NULL) {
6,725 !
114
    fatal_error("Cannot set locale to C.");
×
115
  }
116

117
  // Read XML input files
118
  if (!read_model_xml())
6,725 ✔
119
    read_separate_xml_files();
1,027 ✔
120

121
  if (!settings::properties_file.empty()) {
6,655 ✔
122
    openmc_properties_import(settings::properties_file.c_str());
8 ✔
123
  }
124

125
  // Reset locale to previous state
126
  if (std::setlocale(LC_ALL, prev_locale.c_str()) == NULL) {
6,655 !
127
    fatal_error("Cannot reset locale.");
×
128
  }
129

130
  // Write some initial output under the header if needed
131
  initial_output();
6,655 ✔
132

133
  // Check for particle restart run
134
  if (settings::particle_restart_run)
6,655 ✔
135
    settings::run_mode = RunMode::PARTICLE;
41 ✔
136

137
  // Stop initialization timer
138
  simulation::time_initialize.stop();
6,655 ✔
139
  simulation::time_total.stop();
6,655 ✔
140

141
  return 0;
6,655 ✔
142
}
6,663 ✔
143

144
namespace openmc {
145

146
#ifdef OPENMC_MPI
147
void initialize_mpi(MPI_Comm intracomm)
2,998 ✔
148
{
149
  mpi::intracomm = intracomm;
2,998 ✔
150

151
  // Initialize MPI
152
  int flag;
2,998 ✔
153
  MPI_Initialized(&flag);
2,998 ✔
154
  if (!flag)
2,998 ✔
155
    MPI_Init(nullptr, nullptr);
2,422 ✔
156

157
  // Determine number of processes and rank for each
158
  MPI_Comm_size(intracomm, &mpi::n_procs);
2,998 ✔
159
  MPI_Comm_rank(intracomm, &mpi::rank);
2,998 ✔
160
  mpi::master = (mpi::rank == 0);
2,998 ✔
161

162
  // Create bank datatype
163
  SourceSite b;
2,998 ✔
164
  MPI_Aint disp[15];
2,998 ✔
165
  MPI_Get_address(&b.r, &disp[0]);
2,998 ✔
166
  MPI_Get_address(&b.u, &disp[1]);
2,998 ✔
167
  MPI_Get_address(&b.E, &disp[2]);
2,998 ✔
168
  MPI_Get_address(&b.time, &disp[3]);
2,998 ✔
169
  MPI_Get_address(&b.wgt, &disp[4]);
2,998 ✔
170
  MPI_Get_address(&b.delayed_group, &disp[5]);
2,998 ✔
171
  MPI_Get_address(&b.surf_id, &disp[6]);
2,998 ✔
172
  MPI_Get_address(&b.particle, &disp[7]);
2,998 ✔
173
  MPI_Get_address(&b.parent_nuclide, &disp[8]);
2,998 ✔
174
  MPI_Get_address(&b.parent_id, &disp[9]);
2,998 ✔
175
  MPI_Get_address(&b.progeny_id, &disp[10]);
2,998 ✔
176
  MPI_Get_address(&b.wgt_born, &disp[11]);
2,998 ✔
177
  MPI_Get_address(&b.wgt_ww_born, &disp[12]);
2,998 ✔
178
  MPI_Get_address(&b.n_split, &disp[13]);
2,998 ✔
179
  MPI_Get_address(&b.n_collision, &disp[14]);
2,998 ✔
180
  for (int i = 14; i >= 0; --i) {
47,968 ✔
181
    disp[i] -= disp[0];
44,970 ✔
182
  }
183

184
  // Block counts for each field
185
  int blocks[] = {3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
2,998 ✔
186

187
  // Types for each field
188
  MPI_Datatype types[] = {
2,998 ✔
189
    MPI_DOUBLE,  // r (3 doubles)
190
    MPI_DOUBLE,  // u (3 doubles)
191
    MPI_DOUBLE,  // E
192
    MPI_DOUBLE,  // time
193
    MPI_DOUBLE,  // wgt
194
    MPI_INT,     // delayed_group
195
    MPI_INT,     // surf_id
196
    MPI_INT,     // particle (enum)
197
    MPI_INT,     // parent_nuclide
198
    MPI_INT64_T, // parent_id
199
    MPI_INT64_T, // progeny_id
200
    MPI_DOUBLE,  // wgt_born
201
    MPI_DOUBLE,  // wgt_ww_born
202
    MPI_INT64_T, // n_split
203
    MPI_INT      // n_collision
204
  };
205

206
  MPI_Type_create_struct(15, blocks, disp, types, &mpi::source_site);
2,998 ✔
207
  MPI_Type_commit(&mpi::source_site);
2,998 ✔
208

209
  CollisionTrackSite bc;
2,998 ✔
210
  MPI_Aint dispc[16];
2,998 ✔
211
  MPI_Get_address(&bc.r, &dispc[0]);             // double
2,998 ✔
212
  MPI_Get_address(&bc.u, &dispc[1]);             // double
2,998 ✔
213
  MPI_Get_address(&bc.E, &dispc[2]);             // double
2,998 ✔
214
  MPI_Get_address(&bc.dE, &dispc[3]);            // double
2,998 ✔
215
  MPI_Get_address(&bc.time, &dispc[4]);          // double
2,998 ✔
216
  MPI_Get_address(&bc.wgt, &dispc[5]);           // double
2,998 ✔
217
  MPI_Get_address(&bc.event_mt, &dispc[6]);      // int
2,998 ✔
218
  MPI_Get_address(&bc.delayed_group, &dispc[7]); // int
2,998 ✔
219
  MPI_Get_address(&bc.cell_id, &dispc[8]);       // int
2,998 ✔
220
  MPI_Get_address(&bc.nuclide_id, &dispc[9]);    // int
2,998 ✔
221
  MPI_Get_address(&bc.material_id, &dispc[10]);  // int
2,998 ✔
222
  MPI_Get_address(&bc.universe_id, &dispc[11]);  // int
2,998 ✔
223
  MPI_Get_address(&bc.n_collision, &dispc[12]);  // int
2,998 ✔
224
  MPI_Get_address(&bc.particle, &dispc[13]);     // int
2,998 ✔
225
  MPI_Get_address(&bc.parent_id, &dispc[14]);    // int64_t
2,998 ✔
226
  MPI_Get_address(&bc.progeny_id, &dispc[15]);   // int64_t
2,998 ✔
227
  for (int i = 15; i >= 0; --i) {
50,966 ✔
228
    dispc[i] -= dispc[0];
47,968 ✔
229
  }
230

231
  int blocksc[] = {3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
2,998 ✔
232
  MPI_Datatype typesc[] = {MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE,
2,998 ✔
233
    MPI_DOUBLE, MPI_DOUBLE, MPI_INT, MPI_INT, MPI_INT, MPI_INT, MPI_INT,
234
    MPI_INT, MPI_INT, MPI_INT, MPI_INT64_T, MPI_INT64_T};
235

236
  MPI_Type_create_struct(
2,998 ✔
237
    16, blocksc, dispc, typesc, &mpi::collision_track_site);
238
  MPI_Type_commit(&mpi::collision_track_site);
2,998 ✔
239
}
2,998 ✔
240
#endif // OPENMC_MPI
241

242
int parse_command_line(int argc, char* argv[])
6,757 ✔
243
{
244
  int last_flag = 0;
6,757 ✔
245
  for (int i = 1; i < argc; ++i) {
7,731 ✔
246
    std::string arg {argv[i]};
982 ✔
247
    if (arg[0] == '-') {
982 ✔
248
      if (arg == "-p" || arg == "--plot") {
1,733 !
249
        settings::run_mode = RunMode::PLOTTING;
87 ✔
250
        settings::check_overlaps = true;
87 ✔
251

252
      } else if (arg == "-n" || arg == "--particles") {
1,638 !
253
        i += 1;
8 ✔
254
        settings::n_particles = std::stoll(argv[i]);
16 ✔
255

256
      } else if (arg == "-q" || arg == "--verbosity") {
1,630 !
257
        i += 1;
×
258
        settings::verbosity = std::stoi(argv[i]);
×
259
        if (settings::verbosity > 10 || settings::verbosity < 1) {
×
260
          auto msg = fmt::format("Invalid verbosity: {}.", settings::verbosity);
×
261
          set_errmsg(msg);
×
262
          return OPENMC_E_INVALID_ARGUMENT;
×
263
        }
×
264

265
      } else if (arg == "-e" || arg == "--event") {
1,630 !
UNCOV
266
        settings::event_based = true;
×
267
      } else if (arg == "-r" || arg == "--restart") {
1,543 !
268
        i += 1;
87 ✔
269
        // Check what type of file this is
270
        hid_t file_id = file_open(argv[i], 'r', true);
87 ✔
271
        std::string filetype;
87 ✔
272
        read_attribute(file_id, "filetype", filetype);
87 ✔
273
        file_close(file_id);
87 ✔
274

275
        // Set path and flag for type of run
276
        if (filetype == "statepoint") {
87 ✔
277
          settings::path_statepoint = argv[i];
46 ✔
278
          settings::path_statepoint_c = settings::path_statepoint.c_str();
46 ✔
279
          settings::restart_run = true;
46 ✔
280
        } else if (filetype == "particle restart") {
41 !
281
          settings::path_particle_restart = argv[i];
41 ✔
282
          settings::particle_restart_run = true;
41 ✔
283
        } else {
284
          auto msg =
×
285
            fmt::format("Unrecognized file after restart flag: {}.", filetype);
×
286
          set_errmsg(msg);
×
287
          return OPENMC_E_INVALID_ARGUMENT;
×
288
        }
×
289

290
        // If its a restart run check for additional source file
291
        if (settings::restart_run && i + 1 < argc) {
87 !
292
          // Check if it has extension we can read
293
          if (ends_with(argv[i + 1], ".h5")) {
×
294

295
            // Check file type is a source file
296
            file_id = file_open(argv[i + 1], 'r', true);
×
297
            read_attribute(file_id, "filetype", filetype);
×
298
            file_close(file_id);
×
299
            if (filetype != "source") {
×
300
              std::string msg {
×
301
                "Second file after restart flag must be a source file"};
×
302
              set_errmsg(msg);
×
303
              return OPENMC_E_INVALID_ARGUMENT;
×
304
            }
×
305

306
            // It is a source file
307
            settings::path_sourcepoint = argv[i + 1];
87 !
308
            i += 1;
309

310
          } else {
311
            // Source is in statepoint file
312
            settings::path_sourcepoint = settings::path_statepoint;
×
313
          }
314

315
        } else {
316
          // Source is assumed to be in statepoint file
317
          settings::path_sourcepoint = settings::path_statepoint;
174 ✔
318
        }
319

320
      } else if (arg == "-g" || arg == "--geometry-debug") {
1,543 !
321
        settings::check_overlaps = true;
×
322
      } else if (arg == "-c" || arg == "--volume") {
872 ✔
323
        settings::run_mode = RunMode::VOLUME;
645 ✔
324
      } else if (arg == "-s" || arg == "--threads") {
132 !
325
        // Read number of threads
326
        if (i + 1 >= argc) {
34 !
327
          std::string msg {"Number of threads not specified."};
×
328
          set_errmsg(msg);
×
329
          return OPENMC_E_INVALID_ARGUMENT;
×
330
        }
×
331
        i += 1;
34 ✔
332

333
#ifdef _OPENMP
334
        // Read and set number of OpenMP threads
335
        int n_threads = std::stoi(argv[i]);
26 ✔
336
        if (n_threads < 1) {
13 !
337
          std::string msg {"Number of threads must be positive."};
×
338
          set_errmsg(msg);
×
339
          return OPENMC_E_INVALID_ARGUMENT;
340
        }
341
        omp_set_num_threads(n_threads);
13 ✔
342
#else
343
        if (mpi::master) {
21 ✔
344
          warning("Ignoring number of threads specified on command line.");
40 ✔
345
        }
346
#endif
347

348
      } else if (arg == "-?" || arg == "-h" || arg == "--help") {
147 !
349
        print_usage();
×
350
        return OPENMC_E_UNASSIGNED;
351

352
      } else if (arg == "-v" || arg == "--version") {
90 !
353
        print_version();
8 ✔
354
        print_build_info();
8 ✔
355
        return OPENMC_E_UNASSIGNED;
356

357
      } else if (arg == "-t" || arg == "--track") {
41 !
358
        settings::write_all_tracks = true;
41 ✔
359

360
      } else {
361
        fmt::print(stderr, "Unknown option: {}\n", argv[i]);
×
362
        print_usage();
×
363
        return OPENMC_E_UNASSIGNED;
364
      }
365

366
      last_flag = i;
367
    }
368
  }
982 ✔
369

370
  // Determine directory where XML input files are
371
  if (argc > 1 && last_flag < argc - 1) {
6,749 ✔
372
    settings::path_input = std::string(argv[last_flag + 1]);
72 ✔
373

374
    // check that the path is either a valid directory or file
375
    if (!dir_exists(settings::path_input) &&
136 ✔
376
        !file_exists(settings::path_input)) {
64 ✔
377
      fatal_error(fmt::format(
27 ✔
378
        "The path specified to the OpenMC executable '{}' does not exist.",
379
        settings::path_input));
380
    }
381

382
    // Add slash at end of directory if it isn't there
383
    if (!ends_with(settings::path_input, "/") &&
144 !
384
        dir_exists(settings::path_input)) {
48 ✔
385
      settings::path_input += "/";
6,733 ✔
386
    }
387
  }
388

389
  return 0;
390
}
391

392
// TODO: Pulse-height tallies require per-history scoring across the full
393
// particle tree (parent + all descendants). The shared secondary bank
394
// transports each secondary as an independent Particle, breaking this
395
// assumption. A proper fix would defer pulse-height scoring: save
396
// (root_source_id, cell, pht_storage) per particle, then aggregate by
397
// root_source_id after all secondary generations complete before scoring
398
// into the histogram. For now, disable shared secondary when pulse-height
399
// tallies are present.
400
static void check_pulse_height_compatibility()
6,662 ✔
401
{
402
  if (settings::use_shared_secondary_bank) {
6,662 ✔
403
    for (const auto& t : model::tallies) {
523 ✔
404
      if (t->type_ == TallyType::PULSE_HEIGHT) {
313 ✔
405
        settings::use_shared_secondary_bank = false;
33 ✔
406
        warning("Pulse-height tallies are not yet compatible with the shared "
33 ✔
407
                "secondary bank. Disabling shared secondary bank.");
408
        break;
33 ✔
409
      }
410
    }
411
  }
412
}
6,662 ✔
413

414
bool read_model_xml()
6,725 ✔
415
{
416
  std::string model_filename = settings::path_input;
6,725 ✔
417

418
  // if the current filename is a directory, append the default model filename
419
  if (model_filename.empty() || dir_exists(model_filename))
6,725 ✔
420
    model_filename += "model.xml";
6,685 ✔
421

422
  // if this file doesn't exist, stop here
423
  if (!file_exists(model_filename))
6,725 ✔
424
    return false;
425

426
  // try to process the path input as an XML file
427
  pugi::xml_document doc;
5,698 ✔
428
  if (!doc.load_file(model_filename.c_str())) {
5,698 !
429
    fatal_error(fmt::format(
×
430
      "Error reading from single XML input file '{}'", model_filename));
431
  }
432

433
  pugi::xml_node root = doc.document_element();
5,698 ✔
434

435
  // Read settings
436
  if (!check_for_node(root, "settings")) {
5,698 !
437
    fatal_error("No <settings> node present in the model.xml file.");
×
438
  }
439
  auto settings_root = root.child("settings");
5,698 ✔
440

441
  // Verbosity
442
  if (check_for_node(settings_root, "verbosity") && settings::verbosity == -1) {
5,698 !
443
    settings::verbosity = std::stoi(get_node_value(settings_root, "verbosity"));
44 ✔
444
  } else if (settings::verbosity == -1) {
5,676 !
445
    settings::verbosity = 7;
5,676 ✔
446
  }
447

448
  // To this point, we haven't displayed any output since we didn't know what
449
  // the verbosity is. Now that we checked for it, show the title if necessary
450
  if (mpi::master) {
5,698 ✔
451
    if (settings::verbosity >= 2)
5,084 ✔
452
      title();
5,068 ✔
453
  }
454

455
  write_message(
5,698 ✔
456
    fmt::format("Reading model XML file '{}' ...", model_filename), 5);
6,536 ✔
457

458
  // Read chain data before settings so DecaySpectrum source distributions can
459
  // resolve nuclides while sources are constructed.
460
  read_chain_file_xml();
5,698 ✔
461

462
  read_settings_xml(settings_root);
5,698 ✔
463

464
  // If other XML files are present, display warning
465
  // that they will be ignored
466
  auto other_inputs = {"materials.xml", "geometry.xml", "settings.xml",
5,656 ✔
467
    "tallies.xml", "plots.xml"};
5,656 ✔
468
  for (const auto& input : other_inputs) {
33,333 ✔
469
    if (file_exists(settings::path_input + input)) {
27,822 ✔
470
      warning((fmt::format("Other XML file input(s) are present. These files "
165 ✔
471
                           "may be ignored in favor of the {} file.",
472
        model_filename)));
473
      break;
145 ✔
474
    }
475
  }
476

477
  // Read materials and cross sections
478
  if (!check_for_node(root, "materials")) {
5,656 !
479
    fatal_error(fmt::format(
×
480
      "No <materials> node present in the {} file.", model_filename));
481
  }
482

483
  if (settings::run_mode != RunMode::PLOTTING) {
5,656 ✔
484
    read_cross_sections_xml(root.child("materials"));
5,593 ✔
485
  }
486
  read_materials_xml(root.child("materials"));
5,656 ✔
487

488
  // Read geometry
489
  if (!check_for_node(root, "geometry")) {
5,656 !
490
    fatal_error(fmt::format(
×
491
      "No <geometry> node present in the {} file.", model_filename));
492
  }
493
  read_geometry_xml(root.child("geometry"));
5,656 ✔
494

495
  // Final geometry setup and assign temperatures
496
  finalize_geometry();
5,656 ✔
497

498
  // Finalize cross sections having assigned temperatures
499
  finalize_cross_sections();
5,656 ✔
500

501
  // Compute cell density multipliers now that material densities
502
  // have been finalized (from geometry_aux.h)
503
  finalize_cell_densities();
5,656 ✔
504

505
  if (check_for_node(root, "tallies"))
5,656 ✔
506
    read_tallies_xml(root.child("tallies"));
3,333 ✔
507

508
  check_pulse_height_compatibility();
5,642 ✔
509

510
  // Initialize distribcell_filters
511
  prepare_distribcell();
5,642 ✔
512

513
  if (check_for_node(root, "plots")) {
5,642 ✔
514
    read_plots_xml(root.child("plots"));
354 ✔
515
  } else {
516
    // When no <plots> element is present in the model.xml file, check for a
517
    // regular plots.xml file
518
    std::string filename = settings::path_input + "plots.xml";
5,288 ✔
519
    if (file_exists(filename)) {
5,288 !
520
      read_plots_xml();
×
521
    }
522
  }
5,288 ✔
523

524
  finalize_variance_reduction();
5,635 ✔
525

526
  return true;
5,635 ✔
527
}
12,297 ✔
528

529
void read_separate_xml_files()
1,027 ✔
530
{
531
  // Read chain data before settings so DecaySpectrum source distributions can
532
  // resolve nuclides while sources are constructed.
533
  read_chain_file_xml();
1,027 ✔
534

535
  read_settings_xml();
1,027 ✔
536
  if (settings::run_mode != RunMode::PLOTTING) {
1,020 ✔
537
    read_cross_sections_xml();
996 ✔
538
  }
539

540
  read_materials_xml();
1,020 ✔
541
  read_geometry_xml();
1,020 ✔
542

543
  // Final geometry setup and assign temperatures
544
  finalize_geometry();
1,020 ✔
545

546
  // Finalize cross sections having assigned temperatures
547
  finalize_cross_sections();
1,020 ✔
548

549
  // Compute cell density multipliers now that material densities
550
  // have been finalized (from geometry_aux.h)
551
  finalize_cell_densities();
1,020 ✔
552

553
  read_tallies_xml();
1,020 ✔
554

555
  check_pulse_height_compatibility();
1,020 ✔
556

557
  // Initialize distribcell_filters
558
  prepare_distribcell();
1,020 ✔
559

560
  // Read the plots.xml regardless of plot mode in case plots are requested
561
  // via the API
562
  read_plots_xml();
1,020 ✔
563

564
  finalize_variance_reduction();
1,020 ✔
565
}
1,020 ✔
566

567
void initial_output()
6,655 ✔
568
{
569
  // write initial output
570
  if (settings::run_mode == RunMode::PLOTTING) {
6,655 ✔
571
    // Read plots.xml if it exists
572
    if (mpi::master && settings::verbosity >= 5)
80 !
573
      print_plot();
64 ✔
574

575
  } else {
576
    // Write summary information
577
    if (mpi::master && settings::output_summary)
6,575 ✔
578
      write_summary();
5,540 ✔
579

580
    // Warn if overlap checking is on
581
    if (mpi::master && settings::check_overlaps) {
6,575 !
582
      warning("Cell overlap checking is ON.");
×
583
    }
584
  }
585
}
6,655 ✔
586

587
} // namespace openmc
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc