feat(newton): first newton solver implementation
This commit is contained in:
@@ -27,10 +27,10 @@ export namespace mean_field::normalization {
|
||||
|
||||
template <
|
||||
RieszGeometryPolicy GeometryPolicy = ReferenceGeometry,
|
||||
ReferenceScalePolicy ScalePolicy = FixedMassBranchReference>
|
||||
ReferenceScalePolicy ScalePolicy = FixedMassBranchReference>
|
||||
class PhysicalRieszDiagonal final : public NormalizationPrescriptionTag {
|
||||
public:
|
||||
using Geometry = GeometryPolicy;
|
||||
using Geometry = GeometryPolicy;
|
||||
using ScaleSource = ScalePolicy;
|
||||
|
||||
explicit PhysicalRieszDiagonal(
|
||||
@@ -62,8 +62,13 @@ export namespace mean_field::normalization {
|
||||
double m_gravitationalConstant;
|
||||
};
|
||||
|
||||
PhysicalRieszDiagonal(dimensions::LengthValue, double = 1.0)
|
||||
-> PhysicalRieszDiagonal<ReferenceGeometry, FixedMassBranchReference>;
|
||||
PhysicalRieszDiagonal(
|
||||
dimensions::LengthValue,
|
||||
double = 1.0
|
||||
)
|
||||
-> PhysicalRieszDiagonal<
|
||||
ReferenceGeometry,
|
||||
FixedMassBranchReference>;
|
||||
|
||||
template <typename Candidate> struct IsPhysicalRieszDiagonal : std::false_type { };
|
||||
|
||||
@@ -71,8 +76,7 @@ export namespace mean_field::normalization {
|
||||
struct IsPhysicalRieszDiagonal<PhysicalRieszDiagonal<Geometry, ScaleSource>> : std::true_type { };
|
||||
|
||||
template <typename Candidate>
|
||||
concept PhysicalRieszDiagonalPrescription =
|
||||
IsPhysicalRieszDiagonal<std::remove_cvref_t<Candidate>>::value;
|
||||
concept PhysicalRieszDiagonalPrescription = IsPhysicalRieszDiagonal<std::remove_cvref_t<Candidate>>::value;
|
||||
|
||||
struct StellarCharacteristicScales final {
|
||||
dimensions::MassValue mass;
|
||||
@@ -93,7 +97,7 @@ export namespace mean_field::normalization {
|
||||
const dimensions::LengthValue radius,
|
||||
const double gravitationalConstant = 1.0
|
||||
) {
|
||||
const double massValue = mass.value();
|
||||
const double massValue = mass.value();
|
||||
const double radiusValue = radius.value();
|
||||
if (!std::isfinite(massValue) || massValue <= 0.0) {
|
||||
throw std::invalid_argument("Characteristic stellar scales require a finite, positive mass.");
|
||||
@@ -107,28 +111,19 @@ export namespace mean_field::normalization {
|
||||
);
|
||||
}
|
||||
|
||||
const double radiusSquared = radiusValue * radiusValue;
|
||||
const double radiusCubed = radiusSquared * radiusValue;
|
||||
const double density = massValue / radiusCubed;
|
||||
const double acceleration = gravitationalConstant * massValue / radiusSquared;
|
||||
const double radiusSquared = radiusValue * radiusValue;
|
||||
const double radiusCubed = radiusSquared * radiusValue;
|
||||
const double density = massValue / radiusCubed;
|
||||
const double acceleration = gravitationalConstant * massValue / radiusSquared;
|
||||
const double inverseTimeSquared = gravitationalConstant * massValue / radiusCubed;
|
||||
const double specificEnergy = gravitationalConstant * massValue / radiusValue;
|
||||
const double pressure = gravitationalConstant * massValue * massValue /
|
||||
(radiusSquared * radiusSquared);
|
||||
const double specificEnergy = gravitationalConstant * massValue / radiusValue;
|
||||
const double pressure = gravitationalConstant * massValue * massValue / (radiusSquared * radiusSquared);
|
||||
const double angularVelocity = std::sqrt(inverseTimeSquared);
|
||||
const double angularMomentum = massValue * std::sqrt(gravitationalConstant * massValue * radiusValue);
|
||||
const double force = gravitationalConstant * massValue * massValue / radiusSquared;
|
||||
const double force = gravitationalConstant * massValue * massValue / radiusSquared;
|
||||
|
||||
const double derived[] = {
|
||||
density,
|
||||
acceleration,
|
||||
inverseTimeSquared,
|
||||
specificEnergy,
|
||||
pressure,
|
||||
angularVelocity,
|
||||
angularMomentum,
|
||||
force
|
||||
};
|
||||
const double derived[] = {density, acceleration, inverseTimeSquared, specificEnergy,
|
||||
pressure, angularVelocity, angularMomentum, force};
|
||||
for (const double value : derived) {
|
||||
if (!std::isfinite(value) || value <= 0.0) {
|
||||
throw std::overflow_error("A derived characteristic stellar scale is not finite and positive.");
|
||||
@@ -136,36 +131,38 @@ export namespace mean_field::normalization {
|
||||
}
|
||||
|
||||
return {
|
||||
.mass = mass,
|
||||
.radius = radius,
|
||||
.mass = mass,
|
||||
.radius = radius,
|
||||
.gravitationalConstant = gravitationalConstant,
|
||||
.density = density,
|
||||
.acceleration = acceleration,
|
||||
.inverseTimeSquared = inverseTimeSquared,
|
||||
.specificEnergy = specificEnergy,
|
||||
.pressure = pressure,
|
||||
.angularVelocity = angularVelocity,
|
||||
.angularMomentum = angularMomentum,
|
||||
.force = force
|
||||
.density = density,
|
||||
.acceleration = acceleration,
|
||||
.inverseTimeSquared = inverseTimeSquared,
|
||||
.specificEnergy = specificEnergy,
|
||||
.pressure = pressure,
|
||||
.angularVelocity = angularVelocity,
|
||||
.angularMomentum = angularMomentum,
|
||||
.force = force
|
||||
};
|
||||
}
|
||||
|
||||
template <RieszGeometryPolicy Geometry, ReferenceScalePolicy ScaleSource, typename Model>
|
||||
template <
|
||||
RieszGeometryPolicy Geometry,
|
||||
ReferenceScalePolicy ScaleSource,
|
||||
typename Model>
|
||||
requires requires(const Model &model) {
|
||||
{
|
||||
model.template specification<models::FixedTotalMass>()
|
||||
} -> std::same_as<const models::FixedTotalMass &>;
|
||||
{ model.template specification<models::FixedTotalMass>() } -> std::same_as<const models::FixedTotalMass &>;
|
||||
{
|
||||
model.template specification<models::FixedTotalMass>().targetMass()
|
||||
} -> std::same_as<dimensions::MassValue>;
|
||||
}
|
||||
[[nodiscard]] StellarCharacteristicScales deriveStellarCharacteristicScales(
|
||||
const PhysicalRieszDiagonal<Geometry, ScaleSource> &prescription,
|
||||
const PhysicalRieszDiagonal<
|
||||
Geometry,
|
||||
ScaleSource> &prescription,
|
||||
const Model &model
|
||||
) {
|
||||
return deriveStellarCharacteristicScales(
|
||||
model.template specification<models::FixedTotalMass>().targetMass(),
|
||||
prescription.referenceRadius(),
|
||||
model.template specification<models::FixedTotalMass>().targetMass(), prescription.referenceRadius(),
|
||||
prescription.gravitationalConstant()
|
||||
);
|
||||
}
|
||||
@@ -179,14 +176,14 @@ export namespace mean_field::normalization {
|
||||
* normalization plan used by the discretization.
|
||||
*/
|
||||
template <models::RieszTopology Topology> struct DeclaredRieszTopology {
|
||||
static constexpr bool available = false;
|
||||
static constexpr bool available = false;
|
||||
static constexpr RieszTopology value = RieszTopology::identity;
|
||||
};
|
||||
|
||||
#define MEAN_FIELD_DECLARED_RIESZ_TOPOLOGY(Name) \
|
||||
template <> struct DeclaredRieszTopology<models::RieszTopology::Name> { \
|
||||
static constexpr bool available = true; \
|
||||
static constexpr RieszTopology value = RieszTopology::Name; \
|
||||
#define MEAN_FIELD_DECLARED_RIESZ_TOPOLOGY(Name) \
|
||||
template <> struct DeclaredRieszTopology<models::RieszTopology::Name> { \
|
||||
static constexpr bool available = true; \
|
||||
static constexpr RieszTopology value = RieszTopology::Name; \
|
||||
}
|
||||
|
||||
MEAN_FIELD_DECLARED_RIESZ_TOPOLOGY(identity);
|
||||
@@ -199,14 +196,14 @@ export namespace mean_field::normalization {
|
||||
#undef MEAN_FIELD_DECLARED_RIESZ_TOPOLOGY
|
||||
|
||||
template <models::PhysicalScaleLaw Scale> struct DeclaredPhysicalScale {
|
||||
static constexpr bool available = false;
|
||||
static constexpr bool available = false;
|
||||
static constexpr PhysicalScaleKind value = PhysicalScaleKind::dimensionless;
|
||||
};
|
||||
|
||||
#define MEAN_FIELD_DECLARED_PHYSICAL_SCALE(Name) \
|
||||
template <> struct DeclaredPhysicalScale<models::PhysicalScaleLaw::Name> { \
|
||||
static constexpr bool available = true; \
|
||||
static constexpr PhysicalScaleKind value = PhysicalScaleKind::Name; \
|
||||
#define MEAN_FIELD_DECLARED_PHYSICAL_SCALE(Name) \
|
||||
template <> struct DeclaredPhysicalScale<models::PhysicalScaleLaw::Name> { \
|
||||
static constexpr bool available = true; \
|
||||
static constexpr PhysicalScaleKind value = PhysicalScaleKind::Name; \
|
||||
}
|
||||
|
||||
MEAN_FIELD_DECLARED_PHYSICAL_SCALE(dimensionless);
|
||||
@@ -223,9 +220,8 @@ export namespace mean_field::normalization {
|
||||
|
||||
#undef MEAN_FIELD_DECLARED_PHYSICAL_SCALE
|
||||
|
||||
template <typename Declaration, typename = void>
|
||||
struct CompileDeclaredPhysicalRieszCoordinate {
|
||||
using Method = UnsupportedPhysicalRieszCoordinate;
|
||||
template <typename Declaration, typename = void> struct CompileDeclaredPhysicalRieszCoordinate {
|
||||
using Method = UnsupportedPhysicalRieszCoordinate;
|
||||
static constexpr bool registered = false;
|
||||
};
|
||||
|
||||
@@ -246,11 +242,11 @@ export namespace mean_field::normalization {
|
||||
static constexpr models::PhysicalScaleLaw declaredScale =
|
||||
static_cast<models::PhysicalScaleLaw>(Declaration::scale);
|
||||
using Topology = DeclaredRieszTopology<declaredTopology>;
|
||||
using Scale = DeclaredPhysicalScale<declaredScale>;
|
||||
using Scale = DeclaredPhysicalScale<declaredScale>;
|
||||
|
||||
public:
|
||||
static constexpr bool registered = static_cast<bool>(Declaration::available) &&
|
||||
Topology::available && Scale::available;
|
||||
static constexpr bool registered =
|
||||
static_cast<bool>(Declaration::available) && Topology::available && Scale::available;
|
||||
using Method = std::conditional_t<
|
||||
registered,
|
||||
PhysicalRieszCoordinate<Topology::value, Scale::value>,
|
||||
@@ -259,7 +255,7 @@ export namespace mean_field::normalization {
|
||||
|
||||
template <typename Generated, CoordinateKind Kind, typename = void>
|
||||
struct DeclaredGeneratedPhysicalRieszCoordinate {
|
||||
using Method = UnsupportedPhysicalRieszCoordinate;
|
||||
using Method = UnsupportedPhysicalRieszCoordinate;
|
||||
static constexpr bool registered = false;
|
||||
};
|
||||
|
||||
@@ -271,9 +267,8 @@ export namespace mean_field::normalization {
|
||||
typename Generated::SpecificationType,
|
||||
typename models::SpecificationContribution<
|
||||
typename Generated::SpecificationType>::Normalization::Value>>
|
||||
: CompileDeclaredPhysicalRieszCoordinate<
|
||||
typename models::SpecificationContribution<
|
||||
typename Generated::SpecificationType>::Normalization::Value> { };
|
||||
: CompileDeclaredPhysicalRieszCoordinate<typename models::SpecificationContribution<
|
||||
typename Generated::SpecificationType>::Normalization::Value> { };
|
||||
|
||||
template <typename Generated>
|
||||
struct DeclaredGeneratedPhysicalRieszCoordinate<
|
||||
@@ -283,12 +278,10 @@ export namespace mean_field::normalization {
|
||||
typename Generated::SpecificationType,
|
||||
typename models::SpecificationContribution<
|
||||
typename Generated::SpecificationType>::Normalization::Residual>>
|
||||
: CompileDeclaredPhysicalRieszCoordinate<
|
||||
typename models::SpecificationContribution<
|
||||
typename Generated::SpecificationType>::Normalization::Residual> { };
|
||||
: CompileDeclaredPhysicalRieszCoordinate<typename models::SpecificationContribution<
|
||||
typename Generated::SpecificationType>::Normalization::Residual> { };
|
||||
|
||||
template <typename GeneratedValues, typename GeneratedResiduals>
|
||||
struct GeneratedPhysicalRieszCoverage {
|
||||
template <typename GeneratedValues, typename GeneratedResiduals> struct GeneratedPhysicalRieszCoverage {
|
||||
static constexpr bool complete = false;
|
||||
};
|
||||
|
||||
@@ -297,16 +290,12 @@ export namespace mean_field::normalization {
|
||||
models::ModelTypeList<GeneratedValues...>,
|
||||
models::ModelTypeList<GeneratedResiduals...>> {
|
||||
static constexpr bool complete =
|
||||
(DeclaredGeneratedPhysicalRieszCoordinate<
|
||||
GeneratedValues,
|
||||
CoordinateKind::value>::registered && ...) &&
|
||||
(DeclaredGeneratedPhysicalRieszCoordinate<
|
||||
GeneratedResiduals,
|
||||
CoordinateKind::residual>::registered && ...);
|
||||
(DeclaredGeneratedPhysicalRieszCoordinate<GeneratedValues, CoordinateKind::value>::registered && ...) &&
|
||||
(DeclaredGeneratedPhysicalRieszCoordinate<GeneratedResiduals, CoordinateKind::residual>::registered &&
|
||||
...);
|
||||
};
|
||||
|
||||
template <typename Specification, typename = void>
|
||||
struct SpecificationPhysicalRieszCoverage {
|
||||
template <typename Specification, typename = void> struct SpecificationPhysicalRieszCoverage {
|
||||
static constexpr bool complete = false;
|
||||
};
|
||||
|
||||
@@ -355,29 +344,17 @@ export namespace mean_field::normalization {
|
||||
* adapter can consult the same authority without importing one another.
|
||||
*/
|
||||
template <typename Candidate>
|
||||
concept PhysicalRieszCoreRuntime =
|
||||
requires(const std::remove_cvref_t<Candidate> &core) {
|
||||
{
|
||||
core.GetGravityContext().GetDensityMap()
|
||||
} -> std::same_as<const field::FieldDofMap &>;
|
||||
{
|
||||
core.GetGravityContext().GetGravityGradientMap()
|
||||
} -> std::same_as<const field::FieldDofMap &>;
|
||||
{
|
||||
core.GetGravityContext().GetGravityPotentialMap()
|
||||
} -> std::same_as<const field::FieldDofMap &>;
|
||||
{
|
||||
core.GetHydrostaticOperator().GetEnthalpyMap()
|
||||
} -> std::same_as<const field::FieldDofMap &>;
|
||||
{
|
||||
core.GetDomainDeformation().parameterCount()
|
||||
} -> std::same_as<int>;
|
||||
};
|
||||
concept PhysicalRieszCoreRuntime = requires(const std::remove_cvref_t<Candidate> &core) {
|
||||
{ core.GetGravityContext().GetDensityMap() } -> std::same_as<const field::FieldDofMap &>;
|
||||
{ core.GetGravityContext().GetGravityGradientMap() } -> std::same_as<const field::FieldDofMap &>;
|
||||
{ core.GetGravityContext().GetGravityPotentialMap() } -> std::same_as<const field::FieldDofMap &>;
|
||||
{ core.GetHydrostaticOperator().GetEnthalpyMap() } -> std::same_as<const field::FieldDofMap &>;
|
||||
{ core.GetDomainDeformation().parameterCount() } -> std::same_as<int>;
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
template <typename Generated, CoordinateKind Kind>
|
||||
using GeneratedPhysicalRieszMethod =
|
||||
typename DeclaredGeneratedPhysicalRieszCoordinate<Generated, Kind>::Method;
|
||||
using GeneratedPhysicalRieszMethod = typename DeclaredGeneratedPhysicalRieszCoordinate<Generated, Kind>::Method;
|
||||
|
||||
template <typename Generated, CoordinateKind Kind, typename = void>
|
||||
struct GeneratedPhysicalRieszRuntimeCoordinate : std::false_type { };
|
||||
@@ -389,8 +366,7 @@ export namespace mean_field::normalization {
|
||||
std::void_t<decltype(GeneratedPhysicalRieszMethod<Generated, Kind>::topology)>>
|
||||
: std::bool_constant<
|
||||
DeclaredGeneratedPhysicalRieszCoordinate<Generated, Kind>::registered &&
|
||||
GeneratedPhysicalRieszMethod<Generated, Kind>::topology ==
|
||||
RieszTopology::global_scalar> { };
|
||||
GeneratedPhysicalRieszMethod<Generated, Kind>::topology == RieszTopology::global_scalar> { };
|
||||
|
||||
template <typename Specification, typename = void>
|
||||
struct SpecificationPhysicalRieszRuntimeCoverage : std::false_type { };
|
||||
@@ -420,21 +396,18 @@ export namespace mean_field::normalization {
|
||||
struct SpecificationSetPhysicalRieszRuntimeCoverage : std::false_type { };
|
||||
|
||||
template <models::ModelSpecification... Specifications>
|
||||
struct SpecificationSetPhysicalRieszRuntimeCoverage<
|
||||
models::detail::SpecificationSetStorage<Specifications...>>
|
||||
: std::bool_constant<
|
||||
(SpecificationPhysicalRieszRuntimeCoverage<Specifications>::value && ...)> { };
|
||||
struct SpecificationSetPhysicalRieszRuntimeCoverage<models::detail::SpecificationSetStorage<Specifications...>>
|
||||
: std::bool_constant<(SpecificationPhysicalRieszRuntimeCoverage<Specifications>::value && ...)> { };
|
||||
} // namespace detail
|
||||
|
||||
template <typename Specification>
|
||||
concept CompleteGeneratedPhysicalRieszRuntimeNormalizationFor =
|
||||
detail::SpecificationPhysicalRieszRuntimeCoverage<
|
||||
std::remove_cvref_t<Specification>>::value;
|
||||
detail::SpecificationPhysicalRieszRuntimeCoverage<std::remove_cvref_t<Specification>>::value;
|
||||
|
||||
#define MEAN_FIELD_PHYSICAL_RIESZ_TRAIT(BlockType, TopologyValue, ScaleValue) \
|
||||
template <> struct PhysicalRieszBlockTraits<BlockType> { \
|
||||
using Method = PhysicalRieszCoordinate<RieszTopology::TopologyValue, PhysicalScaleKind::ScaleValue>; \
|
||||
static constexpr bool registered = true; \
|
||||
#define MEAN_FIELD_PHYSICAL_RIESZ_TRAIT(BlockType, TopologyValue, ScaleValue) \
|
||||
template <> struct PhysicalRieszBlockTraits<BlockType> { \
|
||||
using Method = PhysicalRieszCoordinate<RieszTopology::TopologyValue, PhysicalScaleKind::ScaleValue>; \
|
||||
static constexpr bool registered = true; \
|
||||
}
|
||||
|
||||
MEAN_FIELD_PHYSICAL_RIESZ_TRAIT(
|
||||
@@ -490,12 +463,9 @@ export namespace mean_field::normalization {
|
||||
);
|
||||
#undef MEAN_FIELD_PHYSICAL_RIESZ_TRAIT
|
||||
|
||||
template <typename Block>
|
||||
[[nodiscard]] double physicalScale(
|
||||
const StellarCharacteristicScales &scales
|
||||
) {
|
||||
template <typename Block> [[nodiscard]] double physicalScale(const StellarCharacteristicScales &scales) {
|
||||
static_assert(PhysicalRieszBlockTraits<Block>::registered, "The block has no Physical Riesz normalization.");
|
||||
using Method = typename PhysicalRieszBlockTraits<Block>::Method;
|
||||
using Method = typename PhysicalRieszBlockTraits<Block>::Method;
|
||||
constexpr PhysicalScaleKind scale = Method::scale;
|
||||
if constexpr (scale == PhysicalScaleKind::dimensionless) {
|
||||
return 1.0;
|
||||
@@ -527,9 +497,7 @@ export namespace mean_field::normalization {
|
||||
template <typename Values, typename Residuals> struct MakePhysicalRieszPlan;
|
||||
|
||||
template <typename... Values, typename... Residuals>
|
||||
struct MakePhysicalRieszPlan<
|
||||
utils::blocks::type_list<Values...>,
|
||||
utils::blocks::type_list<Residuals...>> {
|
||||
struct MakePhysicalRieszPlan<utils::blocks::type_list<Values...>, utils::blocks::type_list<Residuals...>> {
|
||||
using Type = NormalizationPlan<
|
||||
CoordinateComponent<
|
||||
CoordinateKind::value,
|
||||
@@ -544,9 +512,8 @@ export namespace mean_field::normalization {
|
||||
|
||||
template <typename Form>
|
||||
requires utils::blocks::block_form_is_valid_v<Form>
|
||||
using PhysicalRieszNormalizationPlanFor = typename detail::MakePhysicalRieszPlan<
|
||||
typename Form::value_blocks,
|
||||
typename Form::residual_blocks>::Type;
|
||||
using PhysicalRieszNormalizationPlanFor =
|
||||
typename detail::MakePhysicalRieszPlan<typename Form::value_blocks, typename Form::residual_blocks>::Type;
|
||||
|
||||
/*
|
||||
* Public compile-time extension point for a normalization prescription.
|
||||
@@ -557,11 +524,10 @@ export namespace mean_field::normalization {
|
||||
* actually prepare.
|
||||
*/
|
||||
template <typename Prescription, typename Form> struct NormalizationCompilation {
|
||||
using Plan = NormalizationPlan<>;
|
||||
using Plan = NormalizationPlan<>;
|
||||
static constexpr bool registered = false;
|
||||
|
||||
template <typename PhysicalCore, typename SpecificationTypes>
|
||||
static constexpr bool runtimeAvailableFor = false;
|
||||
template <typename PhysicalCore, typename SpecificationTypes> static constexpr bool runtimeAvailableFor = false;
|
||||
};
|
||||
|
||||
/* Astronomy/numerics-facing package for a policy which prepares one
|
||||
@@ -571,7 +537,7 @@ export namespace mean_field::normalization {
|
||||
template <NormalizationPrescription Prescription, typename Form>
|
||||
requires utils::blocks::block_form_is_valid_v<Form>
|
||||
struct RuntimePreparedNormalizationCompilation {
|
||||
using Plan = RuntimePreparedNormalizationPlanFor<Prescription, Form>;
|
||||
using Plan = RuntimePreparedNormalizationPlanFor<Prescription, Form>;
|
||||
static constexpr bool registered = CompleteNormalizationFor<Plan, Form>;
|
||||
|
||||
template <typename PhysicalCore, typename SpecificationTypes>
|
||||
@@ -581,7 +547,7 @@ export namespace mean_field::normalization {
|
||||
template <typename Form>
|
||||
requires utils::blocks::block_form_is_valid_v<Form>
|
||||
struct NormalizationCompilation<Unnormalized, Form> {
|
||||
using Plan = IdentityNormalizationPlanFor<Form>;
|
||||
using Plan = IdentityNormalizationPlanFor<Form>;
|
||||
static constexpr bool registered = CompleteNormalizationFor<Plan, Form>;
|
||||
|
||||
template <typename PhysicalCore, typename SpecificationTypes>
|
||||
@@ -591,21 +557,18 @@ export namespace mean_field::normalization {
|
||||
template <RieszGeometryPolicy Geometry, ReferenceScalePolicy ScaleSource, typename Form>
|
||||
requires utils::blocks::block_form_is_valid_v<Form>
|
||||
struct NormalizationCompilation<PhysicalRieszDiagonal<Geometry, ScaleSource>, Form> {
|
||||
using Plan = PhysicalRieszNormalizationPlanFor<Form>;
|
||||
using Plan = PhysicalRieszNormalizationPlanFor<Form>;
|
||||
static constexpr bool registered = CompleteNormalizationFor<Plan, Form>;
|
||||
|
||||
template <typename PhysicalCore, typename SpecificationTypes>
|
||||
static constexpr bool runtimeAvailableFor =
|
||||
registered &&
|
||||
PhysicalRieszCoreRuntime<std::remove_cvref_t<PhysicalCore>> &&
|
||||
detail::SpecificationSetPhysicalRieszRuntimeCoverage<
|
||||
std::remove_cvref_t<SpecificationTypes>>::value;
|
||||
registered && PhysicalRieszCoreRuntime<std::remove_cvref_t<PhysicalCore>> &&
|
||||
detail::SpecificationSetPhysicalRieszRuntimeCoverage<std::remove_cvref_t<SpecificationTypes>>::value;
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
template <typename Prescription, typename Form, typename = void>
|
||||
struct NormalizationCompilationAudit {
|
||||
using Plan = NormalizationPlan<>;
|
||||
template <typename Prescription, typename Form, typename = void> struct NormalizationCompilationAudit {
|
||||
using Plan = NormalizationPlan<>;
|
||||
static constexpr bool registered = false;
|
||||
};
|
||||
|
||||
@@ -616,34 +579,25 @@ export namespace mean_field::normalization {
|
||||
Prescription,
|
||||
Form,
|
||||
std::void_t<
|
||||
typename NormalizationCompilation<
|
||||
std::remove_cvref_t<Prescription>,
|
||||
std::remove_cvref_t<Form>>::Plan,
|
||||
decltype(std::bool_constant<static_cast<bool>(
|
||||
NormalizationCompilation<
|
||||
std::remove_cvref_t<Prescription>,
|
||||
std::remove_cvref_t<Form>>::registered)>{})>> {
|
||||
using Compilation = NormalizationCompilation<
|
||||
std::remove_cvref_t<Prescription>,
|
||||
std::remove_cvref_t<Form>>;
|
||||
using Plan = typename Compilation::Plan;
|
||||
typename NormalizationCompilation<std::remove_cvref_t<Prescription>, std::remove_cvref_t<Form>>::Plan,
|
||||
decltype(std::bool_constant<static_cast<bool>(NormalizationCompilation<
|
||||
std::remove_cvref_t<Prescription>,
|
||||
std::remove_cvref_t<Form>>::registered)>{})>> {
|
||||
using Compilation = NormalizationCompilation<std::remove_cvref_t<Prescription>, std::remove_cvref_t<Form>>;
|
||||
using Plan = typename Compilation::Plan;
|
||||
|
||||
static constexpr bool registered =
|
||||
static_cast<bool>(Compilation::registered) &&
|
||||
CompleteNormalizationFor<Plan, std::remove_cvref_t<Form>>;
|
||||
static_cast<bool>(Compilation::registered) && CompleteNormalizationFor<Plan, std::remove_cvref_t<Form>>;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
template <NormalizationPrescription Prescription, typename Form>
|
||||
using NormalizationPlanFor = typename detail::NormalizationCompilationAudit<
|
||||
std::remove_cvref_t<Prescription>,
|
||||
Form>::Plan;
|
||||
using NormalizationPlanFor =
|
||||
typename detail::NormalizationCompilationAudit<std::remove_cvref_t<Prescription>, Form>::Plan;
|
||||
|
||||
template <typename Prescription, typename Form>
|
||||
concept CompilableNormalizationFor =
|
||||
detail::NormalizationCompilationAudit<
|
||||
std::remove_cvref_t<Prescription>,
|
||||
std::remove_cvref_t<Form>>::registered;
|
||||
detail::NormalizationCompilationAudit<std::remove_cvref_t<Prescription>, std::remove_cvref_t<Form>>::registered;
|
||||
|
||||
/* The public runtime-preparation adapter is intentionally narrower than
|
||||
* an arbitrary complete plan: every coordinate must name the exact policy
|
||||
@@ -654,16 +608,10 @@ export namespace mean_field::normalization {
|
||||
concept RuntimePreparedNormalizationFor =
|
||||
NormalizationPrescription<std::remove_cvref_t<Prescription>> &&
|
||||
utils::blocks::block_form_is_valid_v<std::remove_cvref_t<Form>> &&
|
||||
CompilableNormalizationFor<
|
||||
std::remove_cvref_t<Prescription>,
|
||||
std::remove_cvref_t<Form>> &&
|
||||
CompilableNormalizationFor<std::remove_cvref_t<Prescription>, std::remove_cvref_t<Form>> &&
|
||||
std::same_as<
|
||||
NormalizationPlanFor<
|
||||
std::remove_cvref_t<Prescription>,
|
||||
std::remove_cvref_t<Form>>,
|
||||
RuntimePreparedNormalizationPlanFor<
|
||||
std::remove_cvref_t<Prescription>,
|
||||
std::remove_cvref_t<Form>>>;
|
||||
NormalizationPlanFor<std::remove_cvref_t<Prescription>, std::remove_cvref_t<Form>>,
|
||||
RuntimePreparedNormalizationPlanFor<std::remove_cvref_t<Prescription>, std::remove_cvref_t<Form>>>;
|
||||
|
||||
namespace detail {
|
||||
template <
|
||||
@@ -674,35 +622,22 @@ export namespace mean_field::normalization {
|
||||
typename = void>
|
||||
struct StellarNormalizationRuntimeAudit : std::false_type { };
|
||||
|
||||
template <
|
||||
typename Prescription,
|
||||
typename Form,
|
||||
typename PhysicalCore,
|
||||
typename SpecificationTypes>
|
||||
template <typename Prescription, typename Form, typename PhysicalCore, typename SpecificationTypes>
|
||||
struct StellarNormalizationRuntimeAudit<
|
||||
Prescription,
|
||||
Form,
|
||||
PhysicalCore,
|
||||
SpecificationTypes,
|
||||
std::void_t<
|
||||
std::enable_if_t<NormalizationCompilationAudit<
|
||||
Prescription,
|
||||
Form>::registered>,
|
||||
decltype(std::bool_constant<static_cast<bool>(
|
||||
NormalizationCompilation<
|
||||
Prescription,
|
||||
Form>::template runtimeAvailableFor<
|
||||
PhysicalCore,
|
||||
SpecificationTypes>)>{})>>
|
||||
std::enable_if_t<NormalizationCompilationAudit<Prescription, Form>::registered>,
|
||||
decltype(std::bool_constant<
|
||||
static_cast<bool>(NormalizationCompilation<Prescription, Form>::
|
||||
template runtimeAvailableFor<PhysicalCore, SpecificationTypes>)>{})>>
|
||||
: std::bool_constant<
|
||||
(std::same_as<Prescription, Unnormalized> ||
|
||||
PhysicalRieszDiagonalPrescription<Prescription> ||
|
||||
(std::same_as<Prescription, Unnormalized> || PhysicalRieszDiagonalPrescription<Prescription> ||
|
||||
RuntimePreparedNormalizationFor<Prescription, Form>) &&
|
||||
static_cast<bool>(NormalizationCompilation<
|
||||
Prescription,
|
||||
Form>::template runtimeAvailableFor<
|
||||
PhysicalCore,
|
||||
SpecificationTypes>)> { };
|
||||
static_cast<bool>(NormalizationCompilation<Prescription, Form>::
|
||||
template runtimeAvailableFor<PhysicalCore, SpecificationTypes>)> { };
|
||||
} // namespace detail
|
||||
|
||||
/*
|
||||
@@ -714,15 +649,10 @@ export namespace mean_field::normalization {
|
||||
* assembly and global-scalar runtime preparation for every generated
|
||||
* coordinate in the specification pack.
|
||||
*/
|
||||
template <
|
||||
typename Prescription,
|
||||
typename Form,
|
||||
typename PhysicalCore,
|
||||
typename SpecificationTypes>
|
||||
concept StellarNormalizationRuntimeAvailableFor =
|
||||
detail::StellarNormalizationRuntimeAudit<
|
||||
std::remove_cvref_t<Prescription>,
|
||||
std::remove_cvref_t<Form>,
|
||||
std::remove_cvref_t<PhysicalCore>,
|
||||
std::remove_cvref_t<SpecificationTypes>>::value;
|
||||
template <typename Prescription, typename Form, typename PhysicalCore, typename SpecificationTypes>
|
||||
concept StellarNormalizationRuntimeAvailableFor = detail::StellarNormalizationRuntimeAudit<
|
||||
std::remove_cvref_t<Prescription>,
|
||||
std::remove_cvref_t<Form>,
|
||||
std::remove_cvref_t<PhysicalCore>,
|
||||
std::remove_cvref_t<SpecificationTypes>>::value;
|
||||
} // namespace mean_field::normalization
|
||||
|
||||
Reference in New Issue
Block a user