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

openmc-dev / openmc / 13703779155

06 Mar 2025 04:45PM UTC coverage: 85.674% (+0.5%) from 85.129%
13703779155

Pull #3087

github

web-flow
Merge 20c292e2a into e360cb467
Pull Request #3087: wheel building with scikit build core

47261 of 55164 relevant lines covered (85.67%)

29624867.19 hits per line

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

0.0
/src/main.cpp
1
#ifdef OPENMC_MPI
2
#include <mpi.h>
3
#endif
4
#include "openmc/capi.h"
5
#include "openmc/constants.h"
6
#include "openmc/error.h"
7
#include "openmc/message_passing.h"
8
#include "openmc/particle_restart.h"
9
#include "openmc/random_ray/random_ray_simulation.h"
10
#include "openmc/settings.h"
11

12
int main(int argc, char* argv[])
×
13
{
14
  using namespace openmc;
15
  int err;
16

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

31
  // start problem based on mode
32
  switch (settings::run_mode) {
×
33
  case RunMode::FIXED_SOURCE:
×
34
  case RunMode::EIGENVALUE:
35
    switch (settings::solver_type) {
×
36
    case SolverType::MONTE_CARLO:
×
37
      err = openmc_run();
×
38
      break;
×
39
    case SolverType::RANDOM_RAY:
×
40
      openmc_run_random_ray();
×
41
      err = 0;
×
42
      break;
×
43
    }
44
    break;
×
45
  case RunMode::PLOTTING:
×
46
    err = openmc_plot_geometry();
×
47
    break;
×
48
  case RunMode::PARTICLE:
×
49
    if (mpi::master)
×
50
      run_particle_restart();
×
51
    err = 0;
×
52
    break;
×
53
  case RunMode::VOLUME:
×
54
    err = openmc_calculate_volumes();
×
55
    break;
×
56
  default:
×
57
    break;
×
58
  }
59
  if (err)
×
60
    fatal_error(openmc_err_msg);
×
61

62
  // Finalize and free up memory
63
  err = openmc_finalize();
×
64
  if (err)
×
65
    fatal_error(openmc_err_msg);
×
66

67
    // If MPI is in use and enabled, terminate it
68
#ifdef OPENMC_MPI
69
  MPI_Finalize();
70
#endif
71
}
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

© 2025 Coveralls, Inc