module; #include #include #include #include export module mean_field:eos.relations; export import :eos.quantities; export namespace mean_field::eos { template struct QuantityList final { }; template struct Relation final { using OutputQuantity = Output; using InputQuantities = QuantityList; static constexpr std::size_t inputCount = sizeof...(Inputs); }; template struct RelationCatalog final { static constexpr std::size_t size = sizeof...(Relations); }; namespace detail { template struct TypesAreUnique; template struct IsThermodynamicRelation : std::false_type { }; template struct IsThermodynamicRelation> : std::bool_constant< ThermodynamicQuantityType && (ThermodynamicQuantityType && ...) && TypesAreUnique::value> { }; template struct TypesAreUnique : std::true_type { }; template struct TypesAreUnique : std::bool_constant<(!std::same_as && ...) && TypesAreUnique::value> { }; template struct IsValidRelationCatalog : std::false_type { }; template struct IsValidRelationCatalog> : std::bool_constant< (sizeof...(Relations) > 0) && (IsThermodynamicRelation::value && ...) && TypesAreUnique::value> { }; template struct CatalogContainsRelation : std::false_type { }; template struct CatalogContainsRelation, RelationType> : std::bool_constant<(std::same_as || ...)> { }; template struct RelationContainsInput : std::false_type { }; template struct RelationContainsInput, Quantity> : std::bool_constant<(std::same_as || ...)> { }; template struct QuantityAt; template struct QuantityAt> { using Type = std::tuple_element_t>; }; } // namespace detail template concept ThermodynamicRelationType = detail::IsThermodynamicRelation>::value; template concept ValidRelationCatalog = detail::IsValidRelationCatalog>::value; template inline constexpr bool relationCatalogContains = detail::CatalogContainsRelation, std::remove_cv_t>::value; template inline constexpr bool relationContainsInput = detail::RelationContainsInput, std::remove_cv_t>::value; template using RelationOutputT = typename RelationType::OutputQuantity; template using RelationInputT = typename detail::QuantityAt::Type; using PressureFromDensity = Relation; using PressureFromSpecificEnthalpy = Relation; using SpecificEnthalpyFromDensity = Relation; using SpecificEnthalpyFromPressure = Relation; using DensityFromSpecificEnthalpy = Relation; } // namespace mean_field::eos