feat(preconditioner): major work on preconditioner system
first preconditioner MVP
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <cstdint>
|
||||
#include <mfem.hpp>
|
||||
|
||||
import mean_field;
|
||||
@@ -50,6 +51,8 @@ TEST_CASE(
|
||||
CHECK(initial_report.DidAnyWork());
|
||||
|
||||
const auto &geometry_context = context.GetGeometryContext();
|
||||
CHECK(geometry_context.GetMassOperator().HasVariationData());
|
||||
CHECK(geometry_context.GetSourceOperator().HasVariationData());
|
||||
CHECK(geometry_context.GetDivergenceOperator().Width() == f.gravityFluxFes->GetTrueVSize());
|
||||
CHECK(geometry_context.GetDivergenceOperator().Height() == f.gravityPotentialFes->GetTrueVSize());
|
||||
CHECK(geometry_context.GetTransposeDivergenceOperator().Width() == f.gravityPotentialFes->GetTrueVSize());
|
||||
@@ -122,6 +125,51 @@ TEST_CASE(
|
||||
CHECK(context.GetGeometryContext().GetSourceOperator().GetPreparationCount() == 1);
|
||||
}
|
||||
|
||||
TEST_CASE(
|
||||
"Gravity Field Geometry Context Distinguishes Primal And Linearization Preparation",
|
||||
tags::gravity_context
|
||||
) {
|
||||
auto args = test_utils::setup_args();
|
||||
fem::FEM f = fem::setup_fem(args.mesh_file, args, 0);
|
||||
|
||||
gravity_context::GravityFieldGeometryContext context(f, *f.domainMapperStateless);
|
||||
const mfem::Vector displacement = context.GetDisplacementMap().gather(prepared_test::make_displacement(f, 0.25));
|
||||
|
||||
const gravity_context::GravityFieldGeometryPreparation primal_report =
|
||||
context.PreparePrimal(displacement, {.value = 0}, {.value = 0});
|
||||
|
||||
REQUIRE(context.IsPrepared());
|
||||
CHECK(primal_report.reconstructed_operators);
|
||||
CHECK(primal_report.rebuilt_mass_operator);
|
||||
CHECK(primal_report.rebuilt_source_operator);
|
||||
CHECK(primal_report.rebuilt_divergence_operator);
|
||||
CHECK_FALSE(primal_report.refreshed_variation_state);
|
||||
CHECK_FALSE(context.GetMassOperator().HasVariationData());
|
||||
CHECK_FALSE(context.GetSourceOperator().HasVariationData());
|
||||
|
||||
const std::uint64_t primal_mass_preparations = context.GetMassOperator().GetPreparationCount();
|
||||
const std::uint64_t primal_source_preparations = context.GetSourceOperator().GetPreparationCount();
|
||||
const gravity_context::GravityFieldGeometryPreparation repeated_primal_report =
|
||||
context.PreparePrimal(displacement, {.value = 0}, {.value = 0});
|
||||
|
||||
CHECK_FALSE(repeated_primal_report.DidAnyWork());
|
||||
CHECK(context.GetMassOperator().GetPreparationCount() == primal_mass_preparations);
|
||||
CHECK(context.GetSourceOperator().GetPreparationCount() == primal_source_preparations);
|
||||
|
||||
const gravity_context::GravityFieldGeometryPreparation upgrade_report =
|
||||
context.Prepare(displacement, {.value = 0}, {.value = 0});
|
||||
|
||||
CHECK_FALSE(upgrade_report.reconstructed_operators);
|
||||
CHECK(upgrade_report.rebuilt_mass_operator);
|
||||
CHECK(upgrade_report.rebuilt_source_operator);
|
||||
CHECK_FALSE(upgrade_report.rebuilt_divergence_operator);
|
||||
CHECK(upgrade_report.refreshed_variation_state);
|
||||
CHECK(context.GetMassOperator().HasVariationData());
|
||||
CHECK(context.GetSourceOperator().HasVariationData());
|
||||
CHECK(context.GetMassOperator().GetPreparationCount() == primal_mass_preparations + 1);
|
||||
CHECK(context.GetSourceOperator().GetPreparationCount() == primal_source_preparations + 1);
|
||||
}
|
||||
|
||||
TEST_CASE(
|
||||
"Gravity Field Linearization Context Owns Frozen Base Fields",
|
||||
tags::gravity_context
|
||||
|
||||
Reference in New Issue
Block a user