Skip to content

Commit

Permalink
sync up react_state's return type (#2570)
Browse files Browse the repository at this point in the history
react_state says it returns bool, but we always return an int
shouldn't matter, but this makes it consistent
  • Loading branch information
zingale authored Sep 24, 2023
1 parent 69d0d8c commit 28e646a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
12 changes: 6 additions & 6 deletions Source/reactions/Castro_react.H
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
/// @param time current time
/// @param dt reaction timestep
///
bool react_state(amrex::MultiFab& state,
amrex::MultiFab& reactions,
amrex::Real time,
amrex::Real dt,
const int strang_half);
int react_state(amrex::MultiFab& state,
amrex::MultiFab& reactions,
amrex::Real time,
amrex::Real dt,
const int strang_half);

///
/// Simplified SDC version of react_state. Reacts the current state through a single timestep.
///
/// @param time current time
/// @param dt timestep
///
bool react_state(amrex::Real time, amrex::Real dt);
int react_state(amrex::Real time, amrex::Real dt);

///
/// Are there any zones in ``State`` that can burn?
Expand Down
24 changes: 11 additions & 13 deletions Source/reactions/Castro_react.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Castro::do_old_reactions (Real time, Real dt)
advance_status status {};

#ifndef SIMPLIFIED_SDC
bool burn_success = true;
int burn_success{1};

MultiFab& R_old = get_old_data(Reactions_Type);
MultiFab& R_new = get_new_data(Reactions_Type);
Expand All @@ -29,7 +29,7 @@ Castro::do_old_reactions (Real time, Real dt)
// The result of the reactions is added directly to Sborder.
burn_success = react_state(Sborder, R_old, time, 0.5 * dt, 0);

if (!burn_success) {
if (burn_success != 1) {
status.success = false;
status.reason = "burn unsuccessful";

Expand Down Expand Up @@ -57,7 +57,7 @@ Castro::do_new_reactions (Real time, Real dt)

advance_status status {};

bool burn_success = true;
int burn_success{1};

MultiFab& R_new = get_new_data(Reactions_Type);
MultiFab& S_new = get_new_data(State_Type);
Expand All @@ -73,7 +73,7 @@ Castro::do_new_reactions (Real time, Real dt)

burn_success = react_state(time, dt);

if (!burn_success) {
if (burn_success != 1) {
status.success = false;
status.reason = "burn unsuccessful";

Expand Down Expand Up @@ -107,7 +107,7 @@ Castro::do_new_reactions (Real time, Real dt)

burn_success = react_state(S_new, R_new, time - 0.5 * dt, 0.5 * dt, 1);

if (!burn_success) {
if (burn_success != 1) {
status.success = false;
status.reason = "burn unsuccessful";

Expand All @@ -129,7 +129,7 @@ Castro::do_new_reactions (Real time, Real dt)

// Strang version

bool
int
Castro::react_state(MultiFab& s, MultiFab& r, Real time, Real dt, const int strang_half)
{

Expand Down Expand Up @@ -452,7 +452,7 @@ Castro::react_state(MultiFab& s, MultiFab& r, Real time, Real dt, const int stra
#ifdef SIMPLIFIED_SDC
// Simplified SDC version

bool
int
Castro::react_state(Real time, Real dt)
{

Expand Down Expand Up @@ -804,7 +804,9 @@ Castro::react_state(Real time, Real dt)
ReduceTuple hv = reduce_data.value();
Real burn_failed = amrex::get<0>(hv);

if (burn_failed != 0.0) burn_success = 0;
if (burn_failed != 0.0) {
burn_success = 0;
}

ParallelDescriptor::ReduceIntMin(burn_success);

Expand Down Expand Up @@ -843,11 +845,7 @@ Castro::react_state(Real time, Real dt)

}

if (burn_success) {
return true;
} else {
return false;
}
return burn_success;

}
#endif
Expand Down

0 comments on commit 28e646a

Please sign in to comment.