feat(quadrature): quadrature system brought over

Ported and dramatically cleaned up the quadrature system. This includes centralizing all field definitions
This commit is contained in:
2026-09-19 07:35:57 -04:00
parent 7b4f30d945
commit c44584c1e7
75 changed files with 8936 additions and 172 deletions

View File

@@ -0,0 +1,26 @@
#include <type_traits>
#include "serif/discretization/forms/runtime.hpp"
#include "serif/discretization/forms/concept.hpp"
#include "serif/discretization/forms/forms.hpp"
// These are left in an anonymous namespace to avoid polluting the global namespace with these symbols at link time.
namespace {
using namespace serif::discretization::forms;
using namespace serif::discretization::blocks;
// Note we define custom versions of forms that likely exist in the codebase. We are not here testing that the
// forms have a particular structure; rather, we are testing that given some known structure
// the form system behaves as we expect it to.
using HypotheticalTestingGravityMass = mass<gravity::gradient, gravity::gradient>;
using HypotheticalTestingGravityDivergence = divergence<gravity::gradient, gravity::potential>;
static_assert(Form<HypotheticalTestingGravityMass>, "GravityMass should satisfy the Form concept. A failure here indicates that the mass form is not properly defined for the gravity field. Please check out the forms submodule");
static_assert(Form<HypotheticalTestingGravityDivergence>, "GravityDivergence should satisfy the Form concept. A failure here indicates that the divergence form is not properly defined for the gravity field. Please check out the forms submodule");
static_assert(std::same_as<HypotheticalTestingGravityMass::test_type, gravity::gradient>, "GravityMass::test_type should be gravity::gradient. A failure here indicates that the mass form is not properly defined for the gravity field. Please check out the forms submodule");
static_assert(std::same_as<HypotheticalTestingGravityMass::trial_type, gravity::gradient>, "GravityMass::trial_type should be gravity::gradient. A failure here indicates that the mass form is not properly defined for the gravity field. Please check out the forms submodule");
static_assert(std::same_as<HypotheticalTestingGravityDivergence::trial_type, gravity::gradient>, "GravityDivergence::trial_type should be gravity::gradient. A failure here indicates that the divergence form is not properly defined for the gravity field. Please check out the forms submodule");
static_assert(std::same_as<HypotheticalTestingGravityDivergence::test_type, gravity::potential>, "GravityDivergence::test_type should be gravity::potential. A failure here indicates that the divergence form is not properly defined for the gravity field. Please check out the forms submodule");
}

View File

@@ -0,0 +1,23 @@
#include "serif/discretization/forms/operands.hpp"
#include <type_traits>
#include <concepts>
namespace {
using namespace serif::discretization;
using DensityValue = forms::Operand<blocks::density::mass>;
using GravityValue = forms::Operand<blocks::gravity::gradient>;
using GravityDivergence = forms::Operand<blocks::gravity::gradient, forms::Operation::Divergence>;
using GravityNormalTrace = forms::Operand<blocks::gravity::gradient, forms::Operation::NormalTrace>;
using DisplacementGradient = forms::Operand<blocks::displacement::vector, forms::Operation::Gradient>;
static_assert(forms::IsOperand<DensityValue>, "DensityValue should be a valid operand");
static_assert(forms::IsOperand<GravityValue>, "GravityValue should be a valid operand");
static_assert(forms::IsOperand<GravityDivergence>, "GravityDivergence should be a valid operand");
static_assert(forms::IsOperand<GravityNormalTrace>, "GravityNormalTrace should be a valid operand");
static_assert(forms::IsOperand<DisplacementGradient>, "DisplacementGradient should be a valid operand");
static_assert(std::same_as<GravityDivergence::term_type, blocks::gravity::gradient>, "GravityDivergence should have the correct term type");
static_assert(std::same_as<GravityDivergence::operation_type, forms::Operation::Divergence>, "GravityDivergence should have the correct operation type");
}