diff --git a/include/xdg/constants.h b/include/xdg/constants.h index b3d97ce5..e6e08354 100644 --- a/include/xdg/constants.h +++ b/include/xdg/constants.h @@ -77,12 +77,15 @@ constexpr int BVH_MAX_DEPTH = 64; // geometric property type (e.g. material assignment or boundary condition) // TODO: separate into VolumeProperty and SurfaceProperty enum class PropertyType { + NOT_FOUND = -2, BOUNDARY_CONDITION = -1, MATERIAL = 0, DENSITY = 1, TEMPERATURE = 2 }; +static const Property PROPERTY_NOT_FOUND {PropertyType::NOT_FOUND, "NOT_FOUND"}; + static const std::map PROP_TYPE_TO_STR = { {PropertyType::BOUNDARY_CONDITION, "BOUNDARY_CONDITION"}, diff --git a/src/mesh_manager_interface.cpp b/src/mesh_manager_interface.cpp index a0f461f0..b59b9199 100644 --- a/src/mesh_manager_interface.cpp +++ b/src/mesh_manager_interface.cpp @@ -71,13 +71,15 @@ MeshManager::surface_has_property(MeshID surface, PropertyType type) const Property MeshManager::get_volume_property(MeshID volume, PropertyType type) const { + if (surface_metadata_.count({volume, type}) == 0) + return PROPERTY_NOT_FOUND; return volume_metadata_.at({volume, type}); } Property MeshManager::get_surface_property(MeshID surface, PropertyType type) const { - if (surface_metadata_.count({surface, type}) == 0) + if (surface_metadata_.count({surface, type}) == 0) return {PropertyType::BOUNDARY_CONDITION, "transmission"}; return surface_metadata_.at({surface, type}); }