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

openmc-dev / openmc / 27379008849

11 Jun 2026 09:36PM UTC coverage: 81.235% (-0.09%) from 81.326%
27379008849

Pull #3899

github

web-flow
Merge 0dcc91a2c into 02eb999af
Pull Request #3899: Spatial Fourier Functional Expansion Tally

18168 of 26374 branches covered (68.89%)

Branch coverage included in aggregate %.

111 of 180 new or added lines in 9 files covered. (61.67%)

2376 existing lines in 55 files now uncovered.

59311 of 69002 relevant lines covered (85.96%)

48337371.76 hits per line

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

76.58
/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)
8,836✔
46
{
47
  using namespace openmc;
8,836✔
48

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

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

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

67
#ifdef OPENMC_LIBMESH_ENABLED
68
  const int n_threads = num_threads();
1,653✔
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,653!
73
#ifdef OPENMC_MPI
74
    // pass command line args, empty MPI communicator, and number of threads.
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 =
951✔
78
      make_unique<libMesh::LibMeshInit>(argc, argv, comm, n_threads);
1,902✔
79
#else
80
    // pass command line args, empty MPI communicator, and number of threads
81
    settings::libmesh_init =
702✔
82
      make_unique<libMesh::LibMeshInit>(argc, argv, 0, n_threads);
1,404✔
83
#endif
84

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

88
#endif
89

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

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

117
  // Read XML input files
118
  if (!read_model_xml())
8,792✔
119
    read_separate_xml_files();
1,409✔
120

121
  if (!settings::properties_file.empty()) {
8,699✔
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) {
8,699!
127
    fatal_error("Cannot reset locale.");
×
128
  }
129

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

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

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

141
  return 0;
8,699✔
142
}
8,710✔
143

144
namespace openmc {
145

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

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

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

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

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

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

204
  MPI_Type_create_struct(14, blocks, disp, types, &mpi::source_site);
3,885✔
205
  MPI_Type_commit(&mpi::source_site);
3,885✔
206

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

229
  int blocksc[] = {3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
3,885✔
230
  MPI_Datatype typesc[] = {MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE,
3,885✔
231
    MPI_DOUBLE, MPI_DOUBLE, MPI_INT, MPI_INT, MPI_INT, MPI_INT, MPI_INT,
232
    MPI_INT, MPI_INT, MPI_INT, MPI_INT64_T, MPI_INT64_T};
233

234
  MPI_Type_create_struct(
3,885✔
235
    16, blocksc, dispc, typesc, &mpi::collision_track_site);
236
  MPI_Type_commit(&mpi::collision_track_site);
3,885✔
237
}
3,885✔
238
#endif // OPENMC_MPI
239

240
int parse_command_line(int argc, char* argv[])
8,836✔
241
{
242
  int last_flag = 0;
8,836✔
243
  for (int i = 1; i < argc; ++i) {
10,318✔
244
    std::string arg {argv[i]};
1,493✔
245
    if (arg[0] == '-') {
1,493✔
246
      if (arg == "-p" || arg == "--plot") {
2,661!
247
        settings::run_mode = RunMode::PLOTTING;
119✔
248
        settings::check_overlaps = true;
119✔
249

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

254
      } else if (arg == "-q" || arg == "--verbosity") {
2,520!
UNCOV
255
        i += 1;
×
UNCOV
256
        settings::verbosity = std::stoi(argv[i]);
×
UNCOV
257
        if (settings::verbosity > 10 || settings::verbosity < 1) {
×
UNCOV
258
          auto msg = fmt::format("Invalid verbosity: {}.", settings::verbosity);
×
UNCOV
259
          strcpy(openmc_err_msg, msg.c_str());
×
UNCOV
260
          return OPENMC_E_INVALID_ARGUMENT;
×
261
        }
×
262

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

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

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

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

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

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

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

318
      } else if (arg == "-g" || arg == "--geometry-debug") {
1,967!
UNCOV
319
        settings::check_overlaps = true;
×
320
      } else if (arg == "-c" || arg == "--volume") {
1,108✔
321
        settings::run_mode = RunMode::VOLUME;
822✔
322
      } else if (arg == "-s" || arg == "--threads") {
169!
323
        // Read number of threads
324
        if (i + 1 >= argc) {
35!
UNCOV
325
          std::string msg {"Number of threads not specified."};
×
UNCOV
326
          strcpy(openmc_err_msg, msg.c_str());
×
UNCOV
327
          return OPENMC_E_INVALID_ARGUMENT;
×
UNCOV
328
        }
×
329
        i += 1;
35✔
330

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

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

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

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

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

364
      last_flag = i;
365
    }
366
  }
1,493✔
367

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

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

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

387
  return 0;
388
}
389

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

412
bool read_model_xml()
8,792✔
413
{
414
  std::string model_filename = settings::path_input;
8,792✔
415

416
  // if the current filename is a directory, append the default model filename
417
  if (model_filename.empty() || dir_exists(model_filename))
8,792✔
418
    model_filename += "model.xml";
8,735✔
419

420
  // if this file doesn't exist, stop here
421
  if (!file_exists(model_filename))
8,792✔
422
    return false;
423

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

431
  pugi::xml_node root = doc.document_element();
7,383✔
432

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

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

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

453
  write_message(
7,383✔
454
    fmt::format("Reading model XML file '{}' ...", model_filename), 5);
8,768✔
455

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

460
  read_settings_xml(settings_root);
7,383✔
461

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

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

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

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

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

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

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

503
  if (check_for_node(root, "tallies"))
7,327✔
504
    read_tallies_xml(root.child("tallies"));
4,311✔
505

506
  check_pulse_height_compatibility();
7,309✔
507

508
  // Initialize distribcell_filters
509
  prepare_distribcell();
7,309✔
510

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

522
  finalize_variance_reduction();
7,300✔
523

524
  return true;
7,300✔
525
}
16,009✔
526

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

533
  read_settings_xml();
1,409✔
534
  if (settings::run_mode != RunMode::PLOTTING) {
1,399✔
535
    read_cross_sections_xml();
1,366✔
536
  }
537

538
  read_materials_xml();
1,399✔
539
  read_geometry_xml();
1,399✔
540

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

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

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

551
  read_tallies_xml();
1,399✔
552

553
  check_pulse_height_compatibility();
1,399✔
554

555
  // Initialize distribcell_filters
556
  prepare_distribcell();
1,399✔
557

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

562
  finalize_variance_reduction();
1,399✔
563
}
1,399✔
564

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

573
  } else {
574
    // Write summary information
575
    if (mpi::master && settings::output_summary)
8,589✔
576
      write_summary();
7,230✔
577

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

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