Files
MeanField/libmeanfield/interface/deformation/descriptors.cppm

112 lines
4.2 KiB
Plaintext
Raw Normal View History

module;
#include <cstdint>
#include <string_view>
export module mean_field:deformation.descriptors;
export namespace mean_field::deformation {
enum class SurfaceMotionKind : std::uint8_t { Radial, Normal, GeneralVector };
enum class GeometricGaugeTreatment : std::uint8_t {
Retained,
ExcludedByParameterization,
ConstrainedByPrescription
};
enum class InteriorCenterBehavior : std::uint8_t { Unspecified, FixedAtReferenceCenter, DeterminedBySurfaceMotion };
enum class VacuumOuterBoundaryBehavior : std::uint8_t {
Unspecified,
FixedAtReferenceInfinity,
DeterminedBySurfaceMotion
};
struct SurfaceDeformationDescriptor final {
std::string_view name;
int spatialDimension;
SurfaceMotionKind motionKind;
bool linearOnReferenceGeometry;
bool requiresStarShapedReferenceSurface;
bool hasExactDerivativeTranspose;
bool hasExactPullbackDerivative;
GeometricGaugeTreatment translationTreatment;
GeometricGaugeTreatment orientationTreatment;
[[nodiscard]] constexpr bool isValid() const noexcept {
return !name.empty() && spatialDimension > 0;
}
[[nodiscard]] constexpr bool supportsExactNewtonLinearization() const noexcept {
return hasExactDerivativeTranspose && hasExactPullbackDerivative;
}
constexpr bool operator==(const SurfaceDeformationDescriptor &) const = default;
};
struct InteriorDeformationExtensionDescriptor final {
std::string_view name;
int spatialDimension;
bool linearOnReferenceGeometry;
bool requiresRadialFoliation;
bool requiresAuxiliarySolve;
bool hasExactDerivativeTranspose;
bool hasExactPullbackDerivative;
InteriorCenterBehavior centerBehavior;
[[nodiscard]] constexpr bool isValid() const noexcept {
return !name.empty() && spatialDimension > 0 && centerBehavior != InteriorCenterBehavior::Unspecified;
}
[[nodiscard]] constexpr bool supportsExactNewtonLinearization() const noexcept {
return hasExactDerivativeTranspose && hasExactPullbackDerivative;
}
constexpr bool operator==(const InteriorDeformationExtensionDescriptor &) const = default;
};
struct VacuumDeformationExtensionDescriptor final {
std::string_view name;
int spatialDimension;
bool linearOnReferenceGeometry;
bool requiresRadialFoliation;
bool requiresAuxiliarySolve;
bool hasExactDerivativeTranspose;
bool hasExactPullbackDerivative;
VacuumOuterBoundaryBehavior outerBoundaryBehavior;
[[nodiscard]] constexpr bool isValid() const noexcept {
return !name.empty() && spatialDimension > 0 &&
outerBoundaryBehavior != VacuumOuterBoundaryBehavior::Unspecified;
}
[[nodiscard]] constexpr bool supportsExactNewtonLinearization() const noexcept {
return hasExactDerivativeTranspose && hasExactPullbackDerivative;
}
constexpr bool operator==(const VacuumDeformationExtensionDescriptor &) const = default;
};
struct DomainDeformationDescriptor final {
SurfaceDeformationDescriptor surfaceDeformation;
InteriorDeformationExtensionDescriptor stellarInteriorExtension;
VacuumDeformationExtensionDescriptor vacuumExtension;
bool linearOnReferenceGeometry;
bool requiresAuxiliarySolve;
bool hasExactDerivativeTranspose;
bool hasExactPullbackDerivative;
[[nodiscard]] constexpr bool isValid() const noexcept {
return surfaceDeformation.isValid() && stellarInteriorExtension.isValid() && vacuumExtension.isValid() &&
surfaceDeformation.spatialDimension == stellarInteriorExtension.spatialDimension &&
surfaceDeformation.spatialDimension == vacuumExtension.spatialDimension;
}
[[nodiscard]] constexpr bool supportsExactNewtonLinearization() const noexcept {
return hasExactDerivativeTranspose && hasExactPullbackDerivative;
}
constexpr bool operator==(const DomainDeformationDescriptor &) const = default;
};
} // namespace mean_field::deformation