feat(cpp-object-oriented-modular-refactoring): step 8 - element-geometry-vector3

This commit is contained in:
KOKO\Mimi
2026-08-16 07:27:51 +09:00
parent cbad5c3592
commit a9ff75b3fa
9 changed files with 320 additions and 233 deletions
@@ -12,6 +12,8 @@
#include <utility>
#include <vector>
#include "fesa/math/vector3.h"
namespace fesa {
namespace {
@@ -720,6 +722,40 @@ TEST(EulerBeam3D, RotatedTransformPreservesWorkAndEnergy) {
(local_displacement[6U] - local_displacement[0U]) / 3.0, 1.0e-14);
}
TEST(EulerBeam3D, PreservesExactRotatedResultsAcrossVector3Migration) {
const auto section = MakeSection({-2.0, 2.0, 0.0});
const auto material = MakeMaterial();
const Node first_node = MakeNode({1.0, -2.0, 0.5}, 1U);
const Node second_node = MakeNode({3.0, 0.0, 1.5}, 2U);
const Vector3 delta =
Vector3(second_node.coordinates) - Vector3(first_node.coordinates);
EXPECT_DOUBLE_EQ(delta.Norm(), 3.0);
const auto beam = RequireBeam(first_node, second_node, section, material);
const Matrix global = beam.GlobalStiffness();
Vector displacement{kElementDofCount};
for (std::size_t index = 0U; index < displacement.Size(); ++index) {
displacement[index] = 0.01 * static_cast<double>(index + 1U) - 0.04;
}
const BeamRecovery recovery = beam.Recover(displacement);
EXPECT_DOUBLE_EQ(global(0U, 0U), 0x1.65f135da12f68p+28);
EXPECT_DOUBLE_EQ(global(0U, 1U), 0x1.6261c084bda12p+28);
EXPECT_DOUBLE_EQ(global(0U, 2U), 0x1.630ca684bda13p+27);
EXPECT_DOUBLE_EQ(global(4U, 4U), 0x1.068e359b59b58p+22);
EXPECT_DOUBLE_EQ(global(5U, 11U), 0x1.2d14a7ee7ee7bp+22);
EXPECT_DOUBLE_EQ(recovery.gauss_generalized_strains[0U][0U],
0x1.1111111111110p-5);
EXPECT_DOUBLE_EQ(recovery.gauss_generalized_strains[0U][1U],
0x1.1111111111111p-5);
EXPECT_DOUBLE_EQ(recovery.gauss_generalized_strains[0U][2U],
-0x1.382425a7d2473p-6);
EXPECT_DOUBLE_EQ(recovery.gauss_generalized_strains[0U][3U],
-0x1.a9389137b051dp-6);
EXPECT_DOUBLE_EQ(recovery.endpoint_section_resultants[1U][2U],
0x1.525c94a87359fp+17);
}
TEST(EulerBeam3D, ConstantLineLoadMatchesAllSignedComponents) {
const double length = 4.0;
const ConstantLocalLineLoad load{2.5, -3.0, 5.5, -7.0};