Ported and dramatically cleaned up the quadrature system. This includes centralizing all field definitions
121 lines
3.2 KiB
C++
121 lines
3.2 KiB
C++
#include "serif/discretization/quadrature/rules.hpp"
|
|
#include "serif/discretization/quadrature/query.hpp"
|
|
|
|
#include "serif/discretization/forms/concept.hpp"
|
|
#include "serif/discretization/forms/forms.hpp"
|
|
#include "serif/discretization/quadrature/rules.hpp"
|
|
#include "serif/discretization/quadrature/policy.hpp"
|
|
#include "serif/discretization/quadrature/backend/mfem/mfem_static_order.hpp"
|
|
#include "serif/discretization/quadrature/backend/order.hpp"
|
|
#include "serif/discretization/quadrature/backend/mfem/concepts.hpp"
|
|
#include "serif/discretization/quadrature/backend/mfem/configure.hpp"
|
|
#include "serif/discretization/quadrature/backend/mfem/mfem_resolver.hpp"
|
|
|
|
#include <print>
|
|
|
|
int main() {
|
|
using namespace serif::discretization::quadrature;
|
|
using namespace serif::discretization::domain;
|
|
using namespace serif::discretization::forms;
|
|
|
|
using GravityMassForm = divergence<serif::discretization::blocks::gravity::gradient, serif::discretization::blocks::gravity::gradient>;
|
|
|
|
auto query = make_query<GravityMassForm>(
|
|
QuadratureRole::discretization,
|
|
AllDomains{},
|
|
MappingKind::affine,
|
|
3,
|
|
-4,
|
|
0,
|
|
0
|
|
);
|
|
|
|
|
|
std::println("{}", query);
|
|
|
|
RuleSet defaultRuleSet;
|
|
Policy defaultPolicy(defaultRuleSet);
|
|
|
|
const auto [base_order, boost, order, used_fixed_order] = defaultPolicy.resolve(query);
|
|
|
|
std::println(
|
|
"Default policy: base_order={}, boost={}, order={}, used_fixed_order={}",
|
|
base_order,
|
|
boost,
|
|
order,
|
|
used_fixed_order
|
|
);
|
|
|
|
|
|
RuleSet boostedRuleSet;
|
|
boostedRuleSet.set_fallback_control(
|
|
RuleControl{
|
|
.fixed_order = std::nullopt,
|
|
.boost = 1
|
|
}
|
|
);
|
|
|
|
boostedRuleSet.set_role_control(
|
|
QuadratureRole::discretization,
|
|
RuleControl{
|
|
.fixed_order = std::nullopt,
|
|
.boost = 2
|
|
}
|
|
);
|
|
|
|
boostedRuleSet.set_form_control<GravityMassForm>(
|
|
RuleControl{
|
|
.fixed_order = std::nullopt,
|
|
.boost = 3
|
|
}
|
|
);
|
|
|
|
Policy boostedPolicy(boostedRuleSet);
|
|
|
|
const Resolution boostedResolution = boostedPolicy.resolve(query);
|
|
|
|
std::println(
|
|
"Boosted policy: base_order={}, boost={}, order={}, used_fixed_order={}",
|
|
boostedResolution.base_order,
|
|
boostedResolution.boost,
|
|
boostedResolution.order,
|
|
boostedResolution.used_fixed_order
|
|
);
|
|
|
|
RuleSet fixedRuleSet;
|
|
|
|
fixedRuleSet.set_fallback_control(
|
|
RuleControl{
|
|
.fixed_order = std::nullopt,
|
|
.boost = 1
|
|
}
|
|
);
|
|
|
|
fixedRuleSet.set_role_control(
|
|
QuadratureRole::discretization,
|
|
RuleControl{
|
|
.fixed_order = std::nullopt,
|
|
.boost = 2
|
|
}
|
|
);
|
|
|
|
fixedRuleSet.set_form_control<GravityMassForm>(
|
|
RuleControl{
|
|
.fixed_order = 11,
|
|
.boost = 3
|
|
}
|
|
);
|
|
|
|
Policy fixedPolicy(fixedRuleSet);
|
|
|
|
const Resolution fixedResolution = fixedPolicy.resolve(query);
|
|
|
|
std::println(
|
|
"Fixed policy: base_order={}, boost={}, order={}, used_fixed_order={}",
|
|
fixedResolution.base_order,
|
|
fixedResolution.boost,
|
|
fixedResolution.order,
|
|
fixedResolution.used_fixed_order
|
|
);
|
|
}
|