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:
@@ -0,0 +1,28 @@
|
||||
#include "serif/discretization/blocks/concepts.hpp"
|
||||
#include "serif/discretization/blocks/traits.hpp"
|
||||
#include "serif/dimensions/dimensions.hpp"
|
||||
|
||||
namespace {
|
||||
using namespace serif::discretization;
|
||||
|
||||
using Density = blocks::density::mass;
|
||||
using Displacement = blocks::displacement::vector;
|
||||
using Coefficients = blocks::surface_deformation::coefficients;
|
||||
|
||||
static_assert(blocks::SpatialTerm<Density>, "Density should be a spatial term");
|
||||
static_assert(blocks::SpatialTerm<Displacement>, "Displacement should be a spatial term");
|
||||
static_assert(!blocks::SpatialTerm<Coefficients>, "Coefficients should not be a spatial term");
|
||||
|
||||
static_assert(blocks::HasQuantity<Density>, "Density should have a quantity");
|
||||
static_assert(blocks::HasValueBlock<Coefficients>, "Coefficients should have a value block");
|
||||
static_assert(!blocks::HasResidualBlock<Coefficients>, "Coefficients should not have a residual block");
|
||||
|
||||
using DensitySpace = blocks::FunctionalSpaceOf<Density>;
|
||||
|
||||
static_assert(DensitySpace::functional_space.family == functional_space::Family::l2, "Density should be in an L2 space");
|
||||
|
||||
static_assert(DensitySpace::order == 2, "Density should be in a second order space");
|
||||
static_assert(DensitySpace::rank::value == 0, "Density should be a scalar field");
|
||||
static_assert(std::same_as<blocks::SupportOf<Density>, domain::StellarDomains>, "Density should be supported on stellar domains");
|
||||
static_assert(std::same_as<blocks::QuantityOf<Density>, serif::dimensions::Density>, "Density should have a quantity of type Density");
|
||||
}
|
||||
26
src/compile_time_checks/serif/discretization/forms/forms.cpp
Normal file
26
src/compile_time_checks/serif/discretization/forms/forms.cpp
Normal 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");
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
#include "serif/discretization/quadrature/backend/mfem/mfem_resolver.hpp"
|
||||
#include "serif/discretization/quadrature/backend/mfem/mfem_static_order.hpp"
|
||||
|
||||
#include "serif/utils/error/errors.hpp"
|
||||
|
||||
namespace {
|
||||
using namespace serif::discretization;
|
||||
using namespace serif::utils::errors;
|
||||
using namespace quadrature::backend::mfem;
|
||||
|
||||
using GravityMassForm = forms::mass<blocks::gravity::gradient, blocks::gravity::gradient>;
|
||||
using GravityDivergenceForm = forms::divergence<blocks::gravity::gradient, blocks::gravity::potential>;
|
||||
using GravityBoundaryForm = forms::boundary_flux<blocks::gravity::gradient, blocks::gravity::gradient>;
|
||||
|
||||
using DensityProjectionForm = forms::projection<blocks::density::mass, blocks::density::mass>;
|
||||
|
||||
|
||||
// Note when using serif_assert (since it is a consteval function) it must be within
|
||||
// a function (C++ does not allow arbitrary calls to consteval functions outside of a function context). This is why we have this function here. It is not called, but it is used to force the compiler to evaluate the consteval function and thus trigger the compile time checks.
|
||||
consteval void compile_checks() {
|
||||
serif::utils::errors::serif_assert<SERiFErrorCode::FAILED_TYPE_INVARIANT, "Gravity Mass Form should have a static, compile time, order of 6", mfem_form_static_order<GravityMassForm> == 6>();
|
||||
serif::utils::errors::serif_assert<SERiFErrorCode::FAILED_TYPE_INVARIANT, "Gravity Divergence Form should have a static, compile time, order of 4", mfem_form_static_order<GravityDivergenceForm> == 4>();
|
||||
serif::utils::errors::serif_assert<SERiFErrorCode::FAILED_TYPE_INVARIANT, "Gravity Boundary Form should have a static, compile time, order of 4", mfem_form_static_order<GravityBoundaryForm> == 4>();
|
||||
serif::utils::errors::serif_assert<SERiFErrorCode::FAILED_TYPE_INVARIANT, "Density Projection Form should have a static, compile time, order of 4", mfem_form_static_order<DensityProjectionForm> == 4>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user