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

openmc-dev / openmc / 33994779277

05 Sep 2026 10:02PM UTC coverage: 81.36% (+0.06%) from 81.301%
33994779277

Pull #4012

github

web-flow
Merge 88cb6833e into 33eaa7cf2
Pull Request #4012: Geometry debug function

18690 of 27173 branches covered (68.78%)

Branch coverage included in aggregate %.

89 of 102 new or added lines in 1 file covered. (87.25%)

2309 existing lines in 73 files now uncovered.

60586 of 70265 relevant lines covered (86.23%)

49880313.57 hits per line

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

75.44
/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)
9,384 ✔
46
{
47
  using namespace openmc;
9,384 ✔
48

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

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

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

67
#ifdef OPENMC_LIBMESH_ENABLED
68
  const int n_threads = num_threads();
1,753 ✔
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()) {
1,753 !
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 =
1,003 ✔
78
      make_unique<libMesh::LibMeshInit>(argc, argv, comm, n_threads);
2,006 ✔
79
#else
80
    // libMesh was built without MPI, so use its serial communicator.
81
    settings::libmesh_init =
750 ✔
82
      make_unique<libMesh::LibMeshInit>(argc, argv, 0, n_threads);
1,500 ✔
83
#endif
84

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

88
#endif
89

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

94
#ifdef _OPENMP
95
  // If OMP_SCHEDULE is not set, default to a static schedule
96
  char* envvar = std::getenv("OMP_SCHEDULE");
5,318 ✔
97
  if (!envvar) {
5,318 !
98
    omp_set_schedule(omp_sched_static, 0);
5,318 ✔
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);
9,340 ✔
105
  openmc::openmc_set_stride(DEFAULT_STRIDE);
9,340 ✔
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);
9,340 ✔
113
  if (std::setlocale(LC_ALL, "C") == NULL) {
9,340 !
114
    fatal_error("Cannot set locale to C.");
×
115
  }
116

117
  // Read XML input files
118
  if (!read_model_xml())
9,340 ✔
119
    read_separate_xml_files();
1,423 ✔
120

121
  if (!settings::properties_file.empty()) {
9,247 ✔
122
    openmc_properties_import(settings::properties_file.c_str());
11 ✔
123
  }
124

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

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

133
  // Check for particle restart run
134
  if (settings::particle_restart_run)
9,247 ✔
135
    settings::run_mode = RunMode::PARTICLE;
56 ✔
136

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

141
  return 0;
9,247 ✔
142
}
9,258 ✔
143

144
namespace openmc {
145

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

151
  // Initialize MPI
152
  int flag;
4,097 ✔
153
  MPI_Initialized(&flag);
4,097 ✔
154
  if (!flag)
4,097 ✔
155
    MPI_Init(nullptr, nullptr);
3,280 ✔
156

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

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

187
  // Types for each field
188
  MPI_Datatype types[] = {
4,097 ✔
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);
4,097 ✔
207
  MPI_Type_commit(&mpi::source_site);
4,097 ✔
208

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

231
  int blocksc[] = {3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
4,097 ✔
232
  MPI_Datatype typesc[] = {MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE,
4,097 ✔
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(
4,097 ✔
237
    16, blocksc, dispc, typesc, &mpi::collision_track_site);
238
  MPI_Type_commit(&mpi::collision_track_site);
4,097 ✔
239
}
4,097 ✔
240
#endif // OPENMC_MPI
241

242
int parse_command_line(int argc, char* argv[])
9,384 ✔
243
{
244
  int last_flag = 0;
9,384 ✔
245
  for (int i = 1; i < argc; ++i) {
11,025 ✔
246
    std::string arg {argv[i]};
1,652 ✔
247
    if (arg[0] == '-') {
1,652 ✔
248
      if (arg == "-p" || arg == "--plot") {
2,979 !
249
        settings::run_mode = RunMode::PLOTTING;
119 ✔
250
        settings::check_overlaps = true;
119 ✔
251

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

256
      } else if (arg == "-q" || arg == "--verbosity") {
2,838 !
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);
×
UNCOV
262
          return OPENMC_E_INVALID_ARGUMENT;
×
UNCOV
263
        }
×
264

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

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

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

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

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

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

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

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

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

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

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

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

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

365
      last_flag = i;
366
    }
367
  }
1,652 ✔
368

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

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

381
    // Add slash at end of directory if it isn't there
382
    if (!ends_with(settings::path_input, "/") &&
210 !
383
        dir_exists(settings::path_input)) {
70 ✔
384
      settings::path_input += "/";
9,351 ✔
385
    }
386
  }
387

388
  return 0;
389
}
390

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

413
bool read_model_xml()
9,340 ✔
414
{
415
  std::string model_filename = settings::path_input;
9,340 ✔
416

417
  // if the current filename is a directory, append the default model filename
418
  if (model_filename.empty() || dir_exists(model_filename))
9,340 ✔
419
    model_filename += "model.xml";
9,283 ✔
420

421
  // if this file doesn't exist, stop here
422
  if (!file_exists(model_filename))
9,340 ✔
423
    return false;
424

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

432
  pugi::xml_node root = doc.document_element();
7,917 ✔
433

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

440
  // Verbosity
441
  if (check_for_node(settings_root, "verbosity") && settings::verbosity == -1) {
7,917 !
442
    settings::verbosity = std::stoi(get_node_value(settings_root, "verbosity"));
60 ✔
443
  } else if (settings::verbosity == -1) {
7,887 !
444
    settings::verbosity = 7;
7,887 ✔
445
  }
446

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

454
  write_message(
7,917 ✔
455
    fmt::format("Reading model XML file '{}' ...", model_filename), 5);
9,400 ✔
456

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

461
  read_settings_xml(settings_root);
7,917 ✔
462

463
  // If other XML files are present, display warning
464
  // that they will be ignored
465
  auto other_inputs = {"materials.xml", "geometry.xml", "settings.xml",
7,863 ✔
466
    "tallies.xml", "plots.xml"};
7,863 ✔
467
  for (const auto& input : other_inputs) {
46,340 ✔
468
    if (file_exists(settings::path_input + input)) {
38,678 ✔
469
      warning((fmt::format("Other XML file input(s) are present. These files "
238 ✔
470
                           "may be ignored in favor of the {} file.",
471
        model_filename)));
472
      break;
201 ✔
473
    }
474
  }
475

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

482
  if (settings::run_mode != RunMode::PLOTTING) {
7,863 ✔
483
    read_cross_sections_xml(root.child("materials"));
7,777 ✔
484
  }
485
  read_materials_xml(root.child("materials"));
7,863 ✔
486

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

494
  // Final geometry setup and assign temperatures
495
  finalize_geometry();
7,861 ✔
496

497
  // Finalize cross sections having assigned temperatures
498
  finalize_cross_sections();
7,861 ✔
499

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

504
  if (check_for_node(root, "tallies"))
7,861 ✔
505
    read_tallies_xml(root.child("tallies"));
4,603 ✔
506

507
  check_pulse_height_compatibility();
7,843 ✔
508

509
  // Initialize distribcell_filters
510
  prepare_distribcell();
7,843 ✔
511

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

523
  finalize_variance_reduction();
7,834 ✔
524

525
  return true;
7,834 ✔
526
}
17,091 ✔
527

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

534
  read_settings_xml();
1,423 ✔
535
  if (settings::run_mode != RunMode::PLOTTING) {
1,413 ✔
536
    read_cross_sections_xml();
1,380 ✔
537
  }
538

539
  read_materials_xml();
1,413 ✔
540
  read_geometry_xml();
1,413 ✔
541

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

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

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

552
  read_tallies_xml();
1,413 ✔
553

554
  check_pulse_height_compatibility();
1,413 ✔
555

556
  // Initialize distribcell_filters
557
  prepare_distribcell();
1,413 ✔
558

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

563
  finalize_variance_reduction();
1,413 ✔
564
}
1,413 ✔
565

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

574
  } else {
575
    // Write summary information
576
    if (mpi::master && settings::output_summary)
9,137 ✔
577
      write_summary();
7,729 ✔
578

579
    // Warn if overlap checking is on
580
    if (mpi::master && settings::check_overlaps) {
9,137 !
UNCOV
581
      warning("Cell overlap checking is ON.");
×
582
    }
583
  }
584
}
9,247 ✔
585

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