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

openmc-dev / openmc / 33839339223

04 Sep 2026 05:07AM UTC coverage: 81.421% (+0.06%) from 81.366%
33839339223

push

github

web-flow
Replace exported settings globals with typed accessors (#4080)

18122 of 26031 branches covered (69.62%)

Branch coverage included in aggregate %.

178 of 213 new or added lines in 11 files covered. (83.57%)

179 existing lines in 21 files now uncovered.

59695 of 69543 relevant lines covered (85.84%)

45602725.93 hits per line

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

88.46
/src/openmc.cpp
1
#include "openmc/capi.h"
2

3
#ifdef OPENMC_MPI
4
#include <mpi.h>
5
#endif
6

7
#include "openmc/constants.h"
8
#include "openmc/error.h"
9
#include "openmc/message_passing.h"
10
#include "openmc/particle_restart.h"
11
#include "openmc/random_ray/random_ray_simulation.h"
12
#include "openmc/settings.h"
13

14
extern "C" int openmc_main(int argc, char* argv[])
3,325 ✔
15
{
16
  using namespace openmc;
3,325 ✔
17
  int err;
3,325 ✔
18

19
  // Initialize run -- when run with MPI, pass communicator
20
#ifdef OPENMC_MPI
21
  MPI_Comm world {MPI_COMM_WORLD};
22
  err = openmc_init(argc, argv, &world);
23
#else
24
  err = openmc_init(argc, argv, nullptr);
3,325 ✔
25
#endif
26
  if (err == -1) {
3,257 ✔
27
    // This happens for the -h and -v flags
28
    return 0;
29
  } else if (err) {
3,251 !
NEW
30
    fatal_error(get_errmsg());
×
31
  }
32

33
  // Start problem based on mode
34
  switch (settings::run_mode) {
3,251 !
35
  case RunMode::FIXED_SOURCE:
3,110 ✔
36
  case RunMode::EIGENVALUE:
3,110 ✔
37
    switch (settings::solver_type) {
3,110 !
38
    case SolverType::MONTE_CARLO:
2,786 ✔
39
      err = openmc_run();
2,786 ✔
40
      break;
2,786 ✔
41
    case SolverType::RANDOM_RAY:
324 ✔
42
      openmc_run_random_ray();
324 ✔
43
      err = 0;
324 ✔
44
      break;
324 ✔
45
    }
46
    break;
47
  case RunMode::PLOTTING:
60 ✔
48
    err = openmc_plot_geometry();
60 ✔
49
    break;
60 ✔
50
  case RunMode::PARTICLE:
24 ✔
51
    if (mpi::master)
24 ✔
52
      run_particle_restart();
24 ✔
53
    err = 0;
54
    break;
55
  case RunMode::VOLUME:
57 ✔
56
    err = openmc_calculate_volumes();
57 ✔
57
    break;
57 ✔
58
  default:
59
    break;
60
  }
61
  if (err)
3,219 ✔
62
    fatal_error(get_errmsg());
15 ✔
63

64
  // Finalize and free up memory
65
  err = openmc_finalize();
3,228 ✔
66
  if (err)
3,228 !
NEW
67
    fatal_error(get_errmsg());
×
68

69
    // If MPI is in use and enabled, terminate it
70
#ifdef OPENMC_MPI
71
  MPI_Finalize();
72
#endif
73

74
  return 0;
75
}
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