Skip to content

Commit

Permalink
Escape code in BeamMonitor when openPMD is off (#631)
Browse files Browse the repository at this point in the history
This fixes an issue where the code could not be compiled.
  • Loading branch information
n01r committed Jun 10, 2024
1 parent 184cf56 commit b5506c2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/particles/elements/diagnostics/openPMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ namespace detail

void BeamMonitor::finalize ()
{
#ifdef ImpactX_USE_OPENPMD
// close shared series alias
if (m_series.has_value())
{
Expand All @@ -150,6 +151,7 @@ namespace detail
// remove from unique series map
if (m_unique_series.count(m_series_name) != 0u)
m_unique_series.erase(m_series_name);
#endif // ImpactX_USE_OPENPMD
}

BeamMonitor::BeamMonitor (std::string series_name, std::string backend, std::string encoding) :
Expand Down Expand Up @@ -303,7 +305,7 @@ namespace detail
throw std::runtime_error("BeamMonitor: int_soa_names output not yet implemented!");
#else
amrex::ignore_unused(pc, step);
#endif
#endif // ImpactX_USE_OPENPMD
}

void
Expand All @@ -312,6 +314,7 @@ namespace detail
int step
)
{
#ifdef ImpactX_USE_OPENPMD
std::string profile_name = "impactx::Push::" + std::string(BeamMonitor::name);
BL_PROFILE(profile_name);

Expand Down Expand Up @@ -368,6 +371,9 @@ namespace detail

// close iteration
iteration.close();
#else
amrex::ignore_unused(pc, step);
#endif // ImpactX_USE_OPENPMD
}

void
Expand Down Expand Up @@ -446,7 +452,7 @@ namespace detail
series.flush();
#else
amrex::ignore_unused(pti, ref_part);
#endif
#endif // ImpactX_USE_OPENPMD
}

} // namespace impactx::diagnostics

0 comments on commit b5506c2

Please sign in to comment.