Skip to content

Commit 60788f2

Browse files
throw if requested storage region is empty
1 parent ccc1d66 commit 60788f2

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

eisvogel/core/Geometry.hh

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ public:
1313
CylinderRegion();
1414
CylinderRegion(scalar_t r_min, scalar_t r_max, scalar_t z_min, scalar_t z_max);
1515
void SetRegion(scalar_t r_min, scalar_t r_max, scalar_t z_min, scalar_t z_max);
16+
17+
bool IsEmpty();
1618

1719
scalar_t GetRMin() const {return m_r_min;};
1820
scalar_t GetRMax() const {return m_r_max;};

eisvogel/core/impl/Geometry.hxx

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ void CylinderRegion::throw_if_unphysical() {
2626
}
2727
}
2828

29+
bool CylinderRegion::IsEmpty() {
30+
return ((m_r_min == m_r_max) || (m_z_min == m_z_max));
31+
}
32+
2933
CylinderGeometry::CylinderGeometry(scalar_t r_max, scalar_t z_min, scalar_t z_max,
3034
std::function<scalar_t(scalar_t r, scalar_t z)> eps_func) :
3135
m_r_max(r_max), m_z_min(z_min), m_z_max(z_max), m_eps_func(eps_func) {

eisvogel/meep/impl/MEEPCylindricalGreensFunctionCalculator.hxx

+5-1
Original file line numberDiff line numberDiff line change
@@ -613,9 +613,13 @@ namespace GreensFunctionCalculator::MEEP {
613613
m_t_end(t_end), m_geom(geom), m_request_to_store(request_to_store), m_antenna(antenna) {
614614

615615
// Sanity checks
616-
if(!m_geom.contains(request_to_store)) {
616+
if(!m_geom.contains(m_request_to_store)) {
617617
throw std::runtime_error("Error: requested storage region contains undefined domain!");
618618
}
619+
620+
if(m_request_to_store.IsEmpty()) {
621+
throw std::runtime_error("Error: requested storage region is empty!");
622+
}
619623
}
620624

621625
void CylindricalGreensFunctionCalculator::merge_mpi_chunks(std::filesystem::path outdir, const std::vector<std::filesystem::path>& indirs) {

0 commit comments

Comments
 (0)