Make density approximation order an independent compile-time choice
This commit is contained in:
@@ -14,6 +14,12 @@ if (NOT MEAN_FIELD_UNIFORM_POLYNOMIAL_ORDER_INCREMENT MATCHES "^[0-9]+$")
|
||||
message(FATAL_ERROR "MEAN_FIELD_UNIFORM_POLYNOMIAL_ORDER_INCREMENT must be a non-negative integer")
|
||||
endif ()
|
||||
|
||||
set(MEAN_FIELD_DENSITY_POLYNOMIAL_ORDER 2 CACHE STRING
|
||||
"Density family order before the uniform increment; other fields retain their registered orders")
|
||||
if (NOT MEAN_FIELD_DENSITY_POLYNOMIAL_ORDER MATCHES "^[0-9]+$")
|
||||
message(FATAL_ERROR "MEAN_FIELD_DENSITY_POLYNOMIAL_ORDER must be a non-negative integer")
|
||||
endif ()
|
||||
|
||||
add_compile_options(
|
||||
-gdwarf-4
|
||||
-Wno-unused-parameter
|
||||
@@ -47,6 +53,7 @@ add_library(mean_field)
|
||||
target_compile_definitions(mean_field
|
||||
PUBLIC
|
||||
MEAN_FIELD_UNIFORM_POLYNOMIAL_ORDER_INCREMENT=${MEAN_FIELD_UNIFORM_POLYNOMIAL_ORDER_INCREMENT}
|
||||
MEAN_FIELD_DENSITY_POLYNOMIAL_ORDER=${MEAN_FIELD_DENSITY_POLYNOMIAL_ORDER}
|
||||
MEAN_FIELD_ENABLE_PROFILING=$<BOOL:${MEAN_FIELD_ENABLE_PROFILING}>
|
||||
)
|
||||
|
||||
|
||||
@@ -7,6 +7,10 @@ module;
|
||||
#define MEAN_FIELD_UNIFORM_POLYNOMIAL_ORDER_INCREMENT 0
|
||||
#endif
|
||||
|
||||
#ifndef MEAN_FIELD_DENSITY_POLYNOMIAL_ORDER
|
||||
#define MEAN_FIELD_DENSITY_POLYNOMIAL_ORDER 2
|
||||
#endif
|
||||
|
||||
export module mean_field:field.registry;
|
||||
|
||||
export import :dimensions.quantities;
|
||||
@@ -24,7 +28,12 @@ export namespace mean_field::field {
|
||||
|
||||
struct Density {
|
||||
static constexpr std::string_view name = "density";
|
||||
static constexpr int scalarOrder = 2 + uniformPolynomialOrderIncrement;
|
||||
// Density need not share the gravity potential's approximation order.
|
||||
// Keeping this choice in the registry also updates every form query and
|
||||
// compiled block layout, unlike changing only the runtime FE collection.
|
||||
static constexpr int baseScalarOrder = MEAN_FIELD_DENSITY_POLYNOMIAL_ORDER;
|
||||
static_assert(baseScalarOrder >= 0);
|
||||
static constexpr int scalarOrder = baseScalarOrder + uniformPolynomialOrderIncrement;
|
||||
|
||||
using PhysicalQuantity = dimensions::quantity::Density;
|
||||
using Support = DomainSupport<utils::domain::Stellar>;
|
||||
|
||||
@@ -143,7 +143,8 @@ TEST_CASE(
|
||||
|
||||
CHECK(field::Density::Scalar::symbol == std::string_view{"ρ"});
|
||||
|
||||
STATIC_REQUIRE(field::Density::scalarOrder == 2);
|
||||
STATIC_REQUIRE(field::Density::scalarOrder ==
|
||||
MEAN_FIELD_DENSITY_POLYNOMIAL_ORDER + field::uniformPolynomialOrderIncrement);
|
||||
|
||||
STATIC_REQUIRE(field::Density::Scalar::rankValue == 0);
|
||||
|
||||
|
||||
@@ -448,7 +448,8 @@ TEST_CASE(
|
||||
"Field Registry Encodes Spaces Orders And Stable Pair Constraints",
|
||||
tags::unit &tags::quadrature &tags::initialization
|
||||
) {
|
||||
CHECK(mean_field::field::Density::Scalar::familyOrder == 2);
|
||||
CHECK(mean_field::field::Density::Scalar::familyOrder ==
|
||||
MEAN_FIELD_DENSITY_POLYNOMIAL_ORDER + mean_field::field::uniformPolynomialOrderIncrement);
|
||||
CHECK(mean_field::field::Gravity::Potential::familyOrder == 2);
|
||||
CHECK(mean_field::field::Gravity::Flux::familyOrder == 2);
|
||||
CHECK(mean_field::field::Displacement::Vector::familyOrder == 3);
|
||||
|
||||
Reference in New Issue
Block a user