Skip to content

Commit 3496790

Browse files
committed
fix incorrect header printed
1 parent e9f5348 commit 3496790

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

include/openmc/random_ray/random_ray_simulation.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ class RandomRaySimulation {
2121
// Methods
2222
void apply_fixed_sources_and_mesh_domains();
2323
void prepare_fixed_sources_adjoint();
24-
void print_random_ray_headers();
2524
void run_single_simulation();
2625
void random_ray_adjoint();
2726
void kinetic_initial_condition();
@@ -82,7 +81,7 @@ void openmc_reset_random_ray();
8281
//! Write data related to randaom ray to statepoint
8382
//! \param[in] group HDF5 group
8483
void write_random_ray_hdf5(hid_t group);
85-
void print_random_ray_headers(bool& adjoint_needed);
84+
void print_adjoint_header();
8685

8786
// Functions for kinetic simulations
8887
void set_time_dependent_settings();

src/random_ray/random_ray_simulation.cpp

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@ void openmc_run_random_ray()
2929
//////////////////////////////////////////////////////////
3030

3131
if (mpi::master) {
32-
bool adjoint_needed = FlatSourceDomain::adjoint_;
33-
print_random_ray_headers(adjoint_needed);
32+
if (FlatSourceDomain::adjoint_) {
33+
FlatSourceDomain::adjoint_ = false;
34+
openmc::print_adjoint_header();
35+
FlatSourceDomain::adjoint_ = true;
36+
}
3437
}
3538

3639
// Initialize OpenMC general data structures
@@ -383,15 +386,14 @@ void write_random_ray_hdf5(hid_t group)
383386
close_group(random_ray_group);
384387
}
385388

386-
void print_random_ray_headers(bool& adjoint_needed)
389+
void print_adjoint_header()
387390
{
388-
// If we're going to do an adjoint simulation afterwards, report that this is
389-
// the initial forward flux solve.
390-
if (adjoint_needed && !FlatSourceDomain::adjoint_)
391+
if (!FlatSourceDomain::adjoint_)
392+
// If we're going to do an adjoint simulation afterwards, report that this
393+
// is the initial forward flux solve.
391394
header("FORWARD FLUX SOLVE", 3);
392-
393-
// Otherwise report that we are doing the adjoint simulation
394-
if (adjoint_needed && FlatSourceDomain::adjoint_)
395+
else
396+
// Otherwise report that we are doing the adjoint simulation
395397
header("ADJOINT FLUX SOLVE", 3);
396398
}
397399

@@ -482,16 +484,11 @@ void RandomRaySimulation::prepare_fixed_sources_adjoint()
482484
}
483485
}
484486

485-
void RandomRaySimulation::print_random_ray_headers()
486-
{
487-
openmc::print_random_ray_headers(adjoint_needed_);
488-
}
489-
490487
void RandomRaySimulation::run_single_simulation()
491488
{
492489
if (!is_first_simulation_) {
493-
if (mpi::master)
494-
print_random_ray_headers();
490+
if (mpi::master && adjoint_needed_)
491+
openmc::print_adjoint_header();
495492

496493
// Reset the timers and reinitialize the general OpenMC datastructures if
497494
// this is after the first simulation

0 commit comments

Comments
 (0)