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:
25
src/compile_time_checks/serif/model/scalar_row.cpp
Normal file
25
src/compile_time_checks/serif/model/scalar_row.cpp
Normal 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>>);
|
||||
}
|
||||
Reference in New Issue
Block a user