test(compile_time_checks): added robust compile time checking library. Note that the compile time checks were developed with the assistance of a large language model. All LLM generated code has been manually reviewed

This commit is contained in:
2026-11-09 13:54:34 -05:00
parent 7472caea54
commit 65761a3689
45 changed files with 4034 additions and 44 deletions

View File

@@ -0,0 +1,25 @@
#include "serif/equations/mass_normalization.hpp"
#include "serif/backend/mfem/model/computations/scalar_row.hpp"
namespace {
namespace blocks = serif::discretization::blocks;
namespace computations = serif::model::computations;
namespace dependencies = serif::utils::dependencies;
using Density = blocks::density::mass;
using MassRow = blocks::barotropic_constant::mass_normalization;
using Shape = blocks::surface_deformation::coefficients;
using Volume = serif::operators::backend::mfem::volume_keys::Scoped<MassRow>::Linearization;
/** @brief Spatial equations must retain their ordinary volume representation. */
template <typename Row>
concept CacheableRow = requires { typename computations::ScalarResidualRow<Row>; };
static_assert(CacheableRow<MassRow>);
static_assert(!CacheableRow<Density>);
using FixedLayout = blocks::SystemLayout<dependencies::KeyList<Density, MassRow>, dependencies::KeyList<MassRow>>;
using MovingLayout = blocks::SystemLayout<dependencies::KeyList<Density, Shape, MassRow>, dependencies::KeyList<MassRow>>;
using Fixed = decltype(computations::scalar_residual_row<serif::equations::MassNormalization>(std::declval<FixedLayout>()));
using Moving = decltype(computations::scalar_residual_row<serif::equations::MassNormalization>(std::declval<MovingLayout>()));
static_assert(std::same_as<Fixed::Inputs, dependencies::KeyList<Volume>>);
static_assert(std::same_as<Moving::Inputs, dependencies::KeyList<Volume, computations::ShapeDerivatives>>);
}