mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Make sure cpp_driver test works with MPI
This commit is contained in:
parent
dea0a0e21f
commit
e5715946c2
1 changed files with 16 additions and 1 deletions
|
|
@ -1,6 +1,10 @@
|
|||
#ifdef OPENMC_MPI
|
||||
#include <mpi.h>
|
||||
#endif
|
||||
|
||||
#include "openmc/capi.h"
|
||||
#include "openmc/cell.h"
|
||||
#include "openmc/error.h"
|
||||
#include "openmc/geometry.h"
|
||||
#include "openmc/message_passing.h"
|
||||
#include "openmc/summary.h"
|
||||
|
|
@ -11,7 +15,13 @@
|
|||
using namespace openmc;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
openmc_init(argc, argv, nullptr);
|
||||
#ifdef OPENMC_MPI
|
||||
MPI_Comm world {MPI_COMM_WORLD};
|
||||
int err = openmc_init(argc, argv, &world);
|
||||
#else
|
||||
int err = openmc_init(argc, argv, nullptr);
|
||||
#endif
|
||||
if (err) fatal_error(openmc_err_msg);
|
||||
|
||||
// create a new cell filter
|
||||
auto cell_filter = Filter::create<CellFilter>();
|
||||
|
|
@ -57,5 +67,10 @@ int main(int argc, char** argv) {
|
|||
|
||||
openmc_run();
|
||||
openmc_finalize();
|
||||
|
||||
#ifdef OPENMC_MPI
|
||||
MPI_Finalize();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue