From 5e0b093b1a7b8f599e437fba01852cb997e93d0d Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Tue, 28 Jan 2020 06:41:05 +0100 Subject: [PATCH] [Mat/MPL] Impl. checkRequiredProperties for Medium. --- MaterialLib/MPL/Medium.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/MaterialLib/MPL/Medium.h b/MaterialLib/MPL/Medium.h index 02ca470aee7..f3defca3d60 100644 --- a/MaterialLib/MPL/Medium.h +++ b/MaterialLib/MPL/Medium.h @@ -88,4 +88,19 @@ private: /// special-defaults are allowed as well... PropertyArray _properties; }; + +template <typename Container> +void checkRequiredProperties(Medium const& medium, + Container const& required_properties) +{ + for (auto const& p : required_properties) + { + if (!medium.hasProperty(p)) + { + OGS_FATAL("The property '%s' is missing in the medium definition.", + property_enum_to_string[p].c_str()); + } + } +} + } // namespace MaterialPropertyLib -- GitLab