Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <cstddef> 7 : #include <memory> 8 : #include <string> 9 : #include <unordered_map> 10 : #include <variant> 11 : #include <vector> 12 : 13 : #include "DataStructures/DataBox/Tag.hpp" 14 : #include "Options/String.hpp" 15 : #include "PointwiseFunctions/Elasticity/ConstitutiveRelations/ConstitutiveRelation.hpp" 16 : #include "Utilities/Serialization/Serialize.hpp" 17 : #include "Utilities/TMPL.hpp" 18 : 19 : namespace Elasticity { 20 : 21 0 : namespace OptionTags { 22 : template <size_t Dim> 23 0 : struct ConstitutiveRelation : db::SimpleTag { 24 0 : static std::string name() { return "Material"; } 25 0 : static constexpr Options::String help = 26 : "The constitutive relation of the elastic material."; 27 0 : using type = 28 : std::unique_ptr<ConstitutiveRelations::ConstitutiveRelation<Dim>>; 29 : }; 30 : 31 : template <size_t Dim> 32 0 : struct ConstitutiveRelationPerBlock { 33 0 : static std::string name() { return "Material"; } 34 0 : using ConstRelPtr = 35 : std::unique_ptr<ConstitutiveRelations::ConstitutiveRelation<Dim>>; 36 0 : using type = std::variant<ConstRelPtr, std::vector<ConstRelPtr>, 37 : std::unordered_map<std::string, ConstRelPtr>>; 38 0 : static constexpr Options::String help = 39 : "A constitutive relation in every block of the domain."; 40 : }; 41 : } // namespace OptionTags 42 : 43 : namespace Tags { 44 : 45 : /*! 46 : * \brief The elastic material's constitutive relation. 47 : * 48 : * \see `Elasticity::ConstitutiveRelations::ConstitutiveRelation` 49 : */ 50 : template <size_t Dim> 51 1 : struct ConstitutiveRelation : db::SimpleTag { 52 0 : using type = 53 : std::unique_ptr<ConstitutiveRelations::ConstitutiveRelation<Dim>>; 54 : 55 0 : using option_tags = tmpl::list<OptionTags::ConstitutiveRelation<Dim>>; 56 0 : static constexpr bool pass_metavariables = false; 57 0 : static type create_from_options(const type& value) { 58 : return deserialize<type>(serialize<type>(value).data()); 59 : } 60 : }; 61 : 62 : /// A constitutive relation in every block of the domain 63 1 : struct ConstitutiveRelationPerBlockBase : db::BaseTag {}; 64 : 65 : } // namespace Tags 66 : } // namespace Elasticity