diff --git a/MaterialLib/MPL/Component.cpp b/MaterialLib/MPL/Component.cpp index 6393d4a009ef8802ff2514bac0d9fe017f38ee27..52f5d79e659ec238e14237e84a0669bac2fa62c9 100644 --- a/MaterialLib/MPL/Component.cpp +++ b/MaterialLib/MPL/Component.cpp @@ -39,4 +39,9 @@ bool Component::hasProperty(PropertyType const& p) const { return properties_[p] != nullptr; } + +std::string Component::description() const +{ + return "component '" + name + "'"; +} } // namespace MaterialPropertyLib diff --git a/MaterialLib/MPL/Component.h b/MaterialLib/MPL/Component.h index 3e9774089a8ba744e9654641b6146c61295d22fa..68541fe00354037644cbaa334e71fee897a4ebc4 100644 --- a/MaterialLib/MPL/Component.h +++ b/MaterialLib/MPL/Component.h @@ -66,6 +66,9 @@ public: variable2); } + /// Short description of the component with its name. + std::string description() const; + public: std::string const name; diff --git a/MaterialLib/MPL/Medium.cpp b/MaterialLib/MPL/Medium.cpp index 1527c1372d2c4c5daf0690ef2109da12ac8bc23d..094bb66d2b473db2941a94a8fa65e2b51e04fcb3 100644 --- a/MaterialLib/MPL/Medium.cpp +++ b/MaterialLib/MPL/Medium.cpp @@ -56,4 +56,9 @@ std::size_t Medium::numberOfPhases() const { return phases_.size(); } + +std::string Medium::description() const +{ + return "medium"; +} } // namespace MaterialPropertyLib diff --git a/MaterialLib/MPL/Medium.h b/MaterialLib/MPL/Medium.h index 8cec072d86e66cb3b29dbfa4b85cc3887fadbc19..d060004a034b4519083dc04b26377280fba21743 100644 --- a/MaterialLib/MPL/Medium.h +++ b/MaterialLib/MPL/Medium.h @@ -47,6 +47,9 @@ public: /// consists of. std::size_t numberOfPhases() const; + /// Short description of the medium. + std::string description() const; + template <typename T> T value(PropertyType const p) const { diff --git a/MaterialLib/MPL/Phase.cpp b/MaterialLib/MPL/Phase.cpp index a729893bc6f8d8fd7ccf47d0ae6565ff952cb1d4..5df50b8c08947a75f8e2ec54b80f5d78829a10a3 100644 --- a/MaterialLib/MPL/Phase.cpp +++ b/MaterialLib/MPL/Phase.cpp @@ -70,4 +70,8 @@ std::size_t Phase::numberOfComponents() const return components_.size(); } +std::string Phase::description() const +{ + return "phase '" + name + "'"; +} } // namespace MaterialPropertyLib diff --git a/MaterialLib/MPL/Phase.h b/MaterialLib/MPL/Phase.h index 0efa37f6558727ea449f32c3d8f1332bd16cf131..f7c94bb7fd33992823bfe35d833a61888f5c1bc2 100644 --- a/MaterialLib/MPL/Phase.h +++ b/MaterialLib/MPL/Phase.h @@ -51,6 +51,9 @@ public: /// A get-function for retrieving the number of components in this phase. std::size_t numberOfComponents() const; + /// Short description of the phase with its name. + std::string description() const; + public: std::string const name; diff --git a/MaterialLib/MPL/Property.cpp b/MaterialLib/MPL/Property.cpp index 2754e8e2f39fa1dc8cb5432e39faa2bf37d8a3d1..6c500292442c7dde865df4a56c6a76081bbbc031 100644 --- a/MaterialLib/MPL/Property.cpp +++ b/MaterialLib/MPL/Property.cpp @@ -14,6 +14,10 @@ #include <string> +#include "Component.h" +#include "Medium.h" +#include "Phase.h" + namespace MaterialPropertyLib { PropertyDataType fromVector(std::vector<double> const& values) @@ -99,4 +103,12 @@ PropertyDataType Property::d2Value(VariableArray const& /*variable_array*/, { return 0.0; } + +std::string Property::description() const +{ + return "property '" + name_ + "' defined for " + + std::visit( + [](auto&& scale) -> std::string { return scale->description(); }, + scale_); +} } // namespace MaterialPropertyLib diff --git a/MaterialLib/MPL/Property.h b/MaterialLib/MPL/Property.h index 890e38bcc4380d9acb2ec25494a3b142482ff6a9..9650d086b3754a305d4f5646a533b781f6f31266 100644 --- a/MaterialLib/MPL/Property.h +++ b/MaterialLib/MPL/Property.h @@ -197,6 +197,7 @@ private: // Empty check for properties which can be defined on every scale, // medium, phase or component } + std::string description() const; private: /// Corresponds to the PropertyDataType