From 9da13a9087c8bd9feea65f32723f9b72174ebb69 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Tue, 21 Mar 2023 16:44:12 -0500 Subject: [PATCH] Adding function for root universe comparison --- include/openmc/geometry_aux.h | 8 ++++++++ src/geometry_aux.cpp | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/include/openmc/geometry_aux.h b/include/openmc/geometry_aux.h index cf62debc04..0c870c9fb8 100644 --- a/include/openmc/geometry_aux.h +++ b/include/openmc/geometry_aux.h @@ -126,6 +126,14 @@ std::string distribcell_path( int maximum_levels(int32_t univ); +//============================================================================== +//! Check whether or not a universe is the root universe using its ID. +//! \param univ_id The ID of the universe to check. +//! \return Whether or not it is the root universe. +//============================================================================== + +bool is_root_universe(int32_t univ_id); + //============================================================================== //! Deallocates global vectors and maps for cells, universes, and lattices. //============================================================================== diff --git a/src/geometry_aux.cpp b/src/geometry_aux.cpp index eabdc9f70d..3ab5fcc2d8 100644 --- a/src/geometry_aux.cpp +++ b/src/geometry_aux.cpp @@ -610,6 +610,11 @@ int maximum_levels(int32_t univ) return levels_below; } +bool is_root_universe(int32_t univ_id) +{ + return model::universe_map[univ_id] == model::root_universe; +} + //============================================================================== void free_memory_geometry()