feat(preconditioner): major work on preconditioner system
first preconditioner MVP
This commit is contained in:
@@ -29,6 +29,25 @@ export namespace mean_field::surface {
|
||||
InputQuantities>)) &&
|
||||
...)> { };
|
||||
|
||||
template <typename RelationType, typename Bindings, typename EquationOfState>
|
||||
struct PressureSurfaceRelationMatchesBindings : std::false_type { };
|
||||
|
||||
template <typename OutputQuantity, typename... InputQuantities, typename Bindings, typename EquationOfState>
|
||||
struct PressureSurfaceRelationMatchesBindings<
|
||||
eos::Relation<OutputQuantity, InputQuantities...>,
|
||||
Bindings,
|
||||
EquationOfState>
|
||||
: std::bool_constant<
|
||||
(surfaceBindingCount<Bindings, OutputQuantity> == 1) &&
|
||||
(std::same_as<eos::quantity::Pressure, InputQuantities> || ...) &&
|
||||
((std::same_as<eos::quantity::Pressure, InputQuantities> ||
|
||||
(surfaceBindingCount<Bindings, InputQuantities> == 1 &&
|
||||
eos::SupportsPartialDerivative<
|
||||
EquationOfState,
|
||||
eos::Relation<OutputQuantity, InputQuantities...>,
|
||||
InputQuantities>)) &&
|
||||
...)> { };
|
||||
|
||||
template <typename Catalog, typename Formulation, typename EquationOfState>
|
||||
struct MatchingPressureSurfaceRelations;
|
||||
|
||||
@@ -44,6 +63,24 @@ export namespace mean_field::surface {
|
||||
static constexpr std::size_t count = std::tuple_size_v<Tuple>;
|
||||
};
|
||||
|
||||
template <typename Catalog, typename Bindings, typename EquationOfState>
|
||||
struct MatchingPressureSurfaceRelationsForBindings;
|
||||
|
||||
template <typename... Relations, typename Bindings, typename EquationOfState>
|
||||
struct MatchingPressureSurfaceRelationsForBindings<
|
||||
eos::RelationCatalog<Relations...>,
|
||||
Bindings,
|
||||
EquationOfState> {
|
||||
using Tuple = decltype(std::tuple_cat(
|
||||
std::conditional_t<
|
||||
PressureSurfaceRelationMatchesBindings<Relations, Bindings, EquationOfState>::value,
|
||||
std::tuple<Relations>,
|
||||
std::tuple<>>{}...
|
||||
));
|
||||
|
||||
static constexpr std::size_t count = std::tuple_size_v<Tuple>;
|
||||
};
|
||||
|
||||
template <std::size_t Count, typename Tuple> struct UniquePressureSurfaceRelation {
|
||||
using Type = void;
|
||||
};
|
||||
@@ -52,6 +89,17 @@ export namespace mean_field::surface {
|
||||
using Type = std::tuple_element_t<0, Tuple>;
|
||||
};
|
||||
|
||||
template <std::size_t Count, typename Tuple, typename Bindings> struct UniquePressureSurfaceFormulation {
|
||||
using Type = void;
|
||||
};
|
||||
|
||||
template <typename Tuple, typename Bindings> struct UniquePressureSurfaceFormulation<1, Tuple, Bindings> {
|
||||
using Relation = std::tuple_element_t<0, Tuple>;
|
||||
using CarrierQuantity = eos::RelationOutputT<Relation>;
|
||||
using CarrierField = SurfaceFieldForQuantityT<Bindings, CarrierQuantity>;
|
||||
using Type = SurfaceConstraintFormulation<CarrierQuantity, CarrierField, Bindings>;
|
||||
};
|
||||
|
||||
template <typename Dependencies, typename Field> struct AppendSurfaceDependency;
|
||||
|
||||
template <typename RowField, typename... StateFields, typename Field>
|
||||
@@ -103,6 +151,16 @@ export namespace mean_field::surface {
|
||||
using Relation = typename UniquePressureSurfaceRelation<Matches::count, typename Matches::Tuple>::Type;
|
||||
};
|
||||
|
||||
template <ValidSurfaceStateBindings Bindings, eos::EquationOfStateModel EquationOfState>
|
||||
struct PressureSurfaceFormulationCompilation {
|
||||
using Matches = MatchingPressureSurfaceRelationsForBindings<
|
||||
typename EquationOfState::Relations,
|
||||
Bindings,
|
||||
EquationOfState>;
|
||||
using Formulation =
|
||||
typename UniquePressureSurfaceFormulation<Matches::count, typename Matches::Tuple, Bindings>::Type;
|
||||
};
|
||||
|
||||
template <SurfaceConstraintFormulationType Formulation, eos::EquationOfStateModel EquationOfState>
|
||||
requires(PressureSurfaceCompilation<Formulation, EquationOfState>::Matches::count == 1)
|
||||
struct CompiledPressureSurfaceConstraintType {
|
||||
@@ -119,6 +177,19 @@ export namespace mean_field::surface {
|
||||
(detail::PressureSurfaceCompilation<std::remove_cvref_t<Formulation>, std::remove_cvref_t<EquationOfState>>::
|
||||
Matches::count == 1);
|
||||
|
||||
template <typename Bindings, typename EquationOfState>
|
||||
concept PressureSurfaceFormulationCompilable =
|
||||
ValidSurfaceStateBindings<Bindings> && eos::EquationOfStateModel<EquationOfState> &&
|
||||
(detail::PressureSurfaceFormulationCompilation<
|
||||
std::remove_cvref_t<Bindings>,
|
||||
std::remove_cvref_t<EquationOfState>>::Matches::count == 1);
|
||||
|
||||
template <ValidSurfaceStateBindings Bindings, eos::EquationOfStateModel EquationOfState>
|
||||
requires PressureSurfaceFormulationCompilable<Bindings, EquationOfState>
|
||||
using CompiledPressureSurfaceFormulationT = typename detail::PressureSurfaceFormulationCompilation<
|
||||
std::remove_cvref_t<Bindings>,
|
||||
std::remove_cvref_t<EquationOfState>>::Formulation;
|
||||
|
||||
template <SurfaceConstraintFormulationType Formulation, eos::EquationOfStateModel EquationOfState>
|
||||
requires PressureSurfaceCompilable<Formulation, EquationOfState>
|
||||
using CompiledPressureSurfaceConstraintT = typename detail::CompiledPressureSurfaceConstraintType<
|
||||
|
||||
Reference in New Issue
Block a user