perf(hex8): defer optional paired tangent until a valid linear trial

This commit is contained in:
KOKO\Mimi
2026-10-14 17:38:27 +09:00
parent 774bfbcbdd
commit 6a6c8c33c8
5 changed files with 167 additions and 22 deletions
+4 -8
View File
@@ -7,6 +7,7 @@
#include "../math/dense_blas_internal.h"
#include "hex8_geometry.h"
#include "hex8_linear_tangent_cache.h"
namespace fesa {
namespace {
@@ -116,7 +117,9 @@ Hex8Element::Hex8Element(EntityIndex index, ElementDofLayout layout,
kappa_{kappa},
mu_{mu},
density_{density},
location_{std::move(location)} {}
location_{std::move(location)},
paired_linear_tangent_{
std::make_shared<hex8_internal::LinearTangentCache>()} {}
Status Hex8Element::Failure(const char* message) const {
return Status::Failure(FailureCategory::kModel,
@@ -273,13 +276,6 @@ Result<Hex8Element> Hex8Element::Create(EntityIndex index,
if (backend_inputs_failed)
return Result<Hex8Element>::Failure(candidate.Failure(
"Hex8 dense MKL operands failed finite validation."));
const Vector zero{24U};
const auto paired = candidate.EvaluateHighLow(zero, zero, false);
if (paired.HasValue()) {
candidate.paired_linear_tangent_high_ = paired.Value().high.tangent;
candidate.paired_linear_tangent_low_ = paired.Value().tangent_low;
candidate.paired_linear_tangent_ready_ = true;
}
return Result<Hex8Element>::Success(std::move(candidate));
}