12#ifndef DUMUX_PYTHON_MATERIAL_COMPONENT_HH 
   13#define DUMUX_PYTHON_MATERIAL_COMPONENT_HH 
   15#include <dune/python/pybind11/pybind11.h> 
   16#include <dune/python/pybind11/stl.h> 
   43struct Name { 
template<
class C> 
auto operator()(C&& c) -> 
decltype(C::template name<DisableStaticAssert>()) {} };
 
   44struct MolarMass { 
template<
class C> 
auto operator()(C&& c) -> 
decltype(C::template molarMass<DisableStaticAssert>()) {} };
 
   45struct VaporPressure { 
template<
class C> 
auto operator()(C&& c) -> 
decltype(C::template vaporPressure<DisableStaticAssert>(0.0)) {} };
 
   48struct LiquidDensity { 
template<
class C> 
auto operator()(C&& c) -> 
decltype(C::template liquidDensity<DisableStaticAssert>(0.0, 0.0)) {} };
 
   49struct LiquidMolarDensity { 
template<
class C> 
auto operator()(C&& c) -> 
decltype(C::template liquidMolarDensity<DisableStaticAssert>(0.0, 0.0)) {} };
 
   50struct LiquidViscosity { 
template<
class C> 
auto operator()(C&& c) -> 
decltype(C::template liquidViscosity<DisableStaticAssert>(0.0, 0.0)) {} };
 
   51struct LiquidEnthalpy { 
template<
class C> 
auto operator()(C&& c) -> 
decltype(C::template liquidEnthalpy<DisableStaticAssert>(0.0, 0.0)) {} };
 
   53struct LiquidHeatCapacity { 
template<
class C> 
auto operator()(C&& c) -> 
decltype(C::template liquidHeatCapacity<DisableStaticAssert>(0.0, 0.0)) {} };
 
   56struct GasIsIdeal { 
template<
class C> 
auto operator()(C&& c) -> 
decltype(C::template gasIsIdeal<DisableStaticAssert>()) {} };
 
   58struct GasDensity { 
template<
class C> 
auto operator()(C&& c) -> 
decltype(C::template gasDensity<DisableStaticAssert>(0.0, 0.0)) {} };
 
   59struct GasMolarDensity { 
template<
class C> 
auto operator()(C&& c) -> 
decltype(C::template gasMolarDensity<DisableStaticAssert>(0.0, 0.0)) {} };
 
   60struct GasViscosity { 
template<
class C> 
auto operator()(C&& c) -> 
decltype(C::template gasViscosity<DisableStaticAssert>(0.0, 0.0)) {} };
 
   61struct GasEnthalpy { 
template<
class C> 
auto operator()(C&& c) -> 
decltype(C::template gasEnthalpy<DisableStaticAssert>(0.0, 0.0)) {} };
 
   62struct GasInternalEnergy { 
template<
class C> 
auto operator()(C&& c) -> 
decltype(C::template gasInternalEnergy<DisableStaticAssert>(0.0, 0.0)) {} };
 
   63struct GasHeatCapacity { 
template<
class C> 
auto operator()(C&& c) -> 
decltype(C::template gasHeatCapacity<DisableStaticAssert>(0.0, 0.0)) {} };
 
   67struct SolidDensity { 
template<
class C> 
auto operator()(C&& c) -> 
decltype(C::template solidDensity<DisableStaticAssert>(0.0)) {} };
 
   71struct Charge { 
template<
class C> 
auto operator()(C&& c) -> 
decltype(C::template charge<DisableStaticAssert>()) {} };
 
   80template <
class Comp, 
class... options>
 
   82                       pybind11::class_<Comp, options...> cls)
 
   84    using pybind11::operator
""_a;
 
   86    cls.def(pybind11::init());
 
   89    constexpr auto implements = [](
const auto& c)
 
   91        return !
decltype(
isValid(c)(std::declval<Comp>()))::value;
 
   95        cls.def_property_readonly_static(
"name", &Comp::name);
 
   97        cls.def_property_readonly_static(
"molarMass", &Comp::molarMass);
 
  102            cls.def_property_readonly_static(
"liquidIsCompressible", &Comp::liquidIsCompressible);
 
  104            cls.def_static(
"liquidDensity", &Comp::liquidDensity, 
"temperature"_a, 
"pressure"_a);
 
  106            cls.def_static(
"liquidMolarDensity", &Comp::liquidMolarDensity, 
"temperature"_a, 
"pressure"_a);
 
  108            cls.def_static(
"liquidViscosity", &Comp::liquidViscosity, 
"temperature"_a, 
"pressure"_a);
 
  110            cls.def_static(
"liquidEnthalpy", &Comp::liquidEnthalpy, 
"temperature"_a, 
"pressure"_a);
 
  112            cls.def_static(
"liquidInternalEnergy", &Comp::liquidInternalEnergy, 
"temperature"_a, 
"pressure"_a);
 
  114            cls.def_static(
"liquidHeatCapacity", &Comp::liquidHeatCapacity, 
"temperature"_a, 
"pressure"_a);
 
  116            cls.def_static(
"liquidThermalConductivity", &Comp::liquidThermalConductivity, 
"temperature"_a, 
"pressure"_a);
 
  118            cls.def_static(
"vaporPressure", &Comp::vaporPressure, 
"temperature"_a);
 
  124            cls.def_static(
"gasDensity", &Comp::gasDensity, 
"temperature"_a, 
"pressure"_a);
 
  126            cls.def_static(
"gasMolarDensity", &Comp::gasMolarDensity, 
"temperature"_a, 
"pressure"_a);
 
  128            cls.def_property_readonly_static(
"gasIsCompressible", &Comp::gasIsCompressible);
 
  130            cls.def_property_readonly_static(
"gasIsIdeal", &Comp::gasIsIdeal);
 
  132            cls.def_static(
"gasViscosity", &Comp::gasViscosity, 
"temperature"_a, 
"pressure"_a);
 
  134            cls.def_static(
"gasEnthalpy", &Comp::gasEnthalpy, 
"temperature"_a, 
"pressure"_a);
 
  136            cls.def_static(
"gasInternalEnergy", &Comp::gasInternalEnergy, 
"temperature"_a, 
"pressure"_a);
 
  138            cls.def_static(
"gasHeatCapacity", &Comp::gasHeatCapacity, 
"temperature"_a, 
"pressure"_a);
 
  140            cls.def_static(
"gasThermalConductivity", &Comp::gasThermalConductivity, 
"temperature"_a, 
"pressure"_a);
 
  146            cls.def_property_readonly_static(
"solidIsCompressible", &Comp::solidIsCompressible);
 
  148            cls.def_property_readonly_static(
"solidDensity", &Comp::solidDensity, 
"temperature_a");
 
  150            cls.def_static(
"solidThermalConductivity", &Comp::solidThermalConductivity, 
"temperature_a");
 
  152            cls.def_static(
"solidHeatCapacity", &Comp::solidHeatCapacity, 
"temperature_a");
 
  158            cls.def_property_readonly_static(
"charge", &Comp::charge);
 
  164            cls.def_property_readonly_static(
"criticalTemperature", &Comp::criticalTemperature);
 
  166            cls.def_property_readonly_static(
"criticalPressure", &Comp::criticalPressure);
 
 
Component traits, i.e. information extracted from components.
constexpr auto isValid(const Expression &t)
A function that creates a test functor to do class member introspection at compile time.
Definition isvalid.hh:81
A helper function for class member function introspection.
Definition component.hh:23
Definition python/assembly/fvassembler.hh:18
void registerComponent(pybind11::handle scope, pybind11::class_< Comp, options... > cls)
Definition component.hh:81
Template which always yields a false value.
Definition common/typetraits/typetraits.hh:24
static constexpr bool hasLiquidState
if the component implements a liquid state
Definition componenttraits.hh:38
static constexpr bool isIon
if the component implements an ion
Definition componenttraits.hh:44
static constexpr bool hasSolidState
if the component implements a solid state
Definition componenttraits.hh:35
static constexpr bool hasGasState
if the component implements a gaseous state
Definition componenttraits.hh:41
Definition component.hh:71
auto operator()(C &&c) -> decltype(C::template charge< DisableStaticAssert >())
Definition component.hh:71
Definition component.hh:73
auto operator()(C &&c) -> decltype(C::template criticalPressure< DisableStaticAssert >())
Definition component.hh:73
Definition component.hh:72
auto operator()(C &&c) -> decltype(C::template criticalTemperature< DisableStaticAssert >())
Definition component.hh:72
Helper struct to deactivate static assertions in component's base classes.
Definition component.hh:25
Definition component.hh:58
auto operator()(C &&c) -> decltype(C::template gasDensity< DisableStaticAssert >(0.0, 0.0))
Definition component.hh:58
Definition component.hh:61
auto operator()(C &&c) -> decltype(C::template gasEnthalpy< DisableStaticAssert >(0.0, 0.0))
Definition component.hh:61
Definition component.hh:63
auto operator()(C &&c) -> decltype(C::template gasHeatCapacity< DisableStaticAssert >(0.0, 0.0))
Definition component.hh:63
Definition component.hh:62
auto operator()(C &&c) -> decltype(C::template gasInternalEnergy< DisableStaticAssert >(0.0, 0.0))
Definition component.hh:62
Definition component.hh:57
auto operator()(C &&c) -> decltype(C::template gasIsCompressible< DisableStaticAssert >())
Definition component.hh:57
Definition component.hh:56
auto operator()(C &&c) -> decltype(C::template gasIsIdeal< DisableStaticAssert >())
Definition component.hh:56
Definition component.hh:59
auto operator()(C &&c) -> decltype(C::template gasMolarDensity< DisableStaticAssert >(0.0, 0.0))
Definition component.hh:59
Definition component.hh:64
auto operator()(C &&c) -> decltype(C::template gasThermalConductivity< DisableStaticAssert >(0.0, 0.0))
Definition component.hh:64
Definition component.hh:60
auto operator()(C &&c) -> decltype(C::template gasViscosity< DisableStaticAssert >(0.0, 0.0))
Definition component.hh:60
Definition component.hh:48
auto operator()(C &&c) -> decltype(C::template liquidDensity< DisableStaticAssert >(0.0, 0.0))
Definition component.hh:48
Definition component.hh:51
auto operator()(C &&c) -> decltype(C::template liquidEnthalpy< DisableStaticAssert >(0.0, 0.0))
Definition component.hh:51
Definition component.hh:53
auto operator()(C &&c) -> decltype(C::template liquidHeatCapacity< DisableStaticAssert >(0.0, 0.0))
Definition component.hh:53
Definition component.hh:52
auto operator()(C &&c) -> decltype(C::template liquidInternalEnergy< DisableStaticAssert >(0.0, 0.0))
Definition component.hh:52
Definition component.hh:47
auto operator()(C &&c) -> decltype(C::template liquidIsCompressible< DisableStaticAssert >())
Definition component.hh:47
Definition component.hh:49
auto operator()(C &&c) -> decltype(C::template liquidMolarDensity< DisableStaticAssert >(0.0, 0.0))
Definition component.hh:49
Definition component.hh:54
auto operator()(C &&c) -> decltype(C::template liquidThermalConductivity< DisableStaticAssert >(0.0, 0.0))
Definition component.hh:54
Definition component.hh:50
auto operator()(C &&c) -> decltype(C::template liquidViscosity< DisableStaticAssert >(0.0, 0.0))
Definition component.hh:50
Definition component.hh:44
auto operator()(C &&c) -> decltype(C::template molarMass< DisableStaticAssert >())
Definition component.hh:44
Definition component.hh:43
auto operator()(C &&c) -> decltype(C::template name< DisableStaticAssert >())
Definition component.hh:43
Definition component.hh:67
auto operator()(C &&c) -> decltype(C::template solidDensity< DisableStaticAssert >(0.0))
Definition component.hh:67
Definition component.hh:69
auto operator()(C &&c) -> decltype(C::template solidHeatCapacity< DisableStaticAssert >(0.0))
Definition component.hh:69
Definition component.hh:66
auto operator()(C &&c) -> decltype(C::template solidIsCompressible< DisableStaticAssert >())
Definition component.hh:66
Definition component.hh:68
auto operator()(C &&c) -> decltype(C::template solidThermalConductivity< DisableStaticAssert >(0.0))
Definition component.hh:68
Definition component.hh:45
auto operator()(C &&c) -> decltype(C::template vaporPressure< DisableStaticAssert >(0.0))
Definition component.hh:45