feat(linear-static-mitc4-shell): step 0 - shell-semantic-model

This commit is contained in:
KOKO\Mimi
2026-08-12 18:46:02 +09:00
parent 0d50625a81
commit b671759663
5 changed files with 171 additions and 0 deletions
+79
View File
@@ -182,3 +182,82 @@ TEST(DomainModel, MultipleIdentityInstancesDoNotMerge) {
EXPECT_EQ(domain.elements()[0].nodeIndices[0], 0U);
EXPECT_EQ(domain.elements()[1].nodeIndices[0], 2U);
}
// MITC4-MODEL-002
TEST(DomainModel, ShellOwnershipPreservesResolvedAssignmentsAndOptionalFrames) {
fesa::ModelDefinition definition{};
definition.sourcePath = "models/shell-owned.inp";
definition.sourceContentIdentity = "fnv1a64:1234567890abcdef";
definition.materials = {
{"Material-B", 70.0e9, 0.33, {"models/shell-owned.inp", 31U}},
{"Material-A", 210.0e9, 0.3, {"models/shell-owned.inp", 30U}}};
definition.shellSections = {
{"Section-B", 0.02, 0U, {"models/shell-owned.inp", 41U}},
{"Section-A", 0.01, 1U, {"models/shell-owned.inp", 40U}}};
definition.shellElements = {
{{"Shell-Instance", 20, "0020"},
fesa::ShellSourceElementType::s4r,
{4U, 5U, 6U, 7U},
0U,
0U,
{"models/shell-owned.inp", 21U}},
{{"Shell-Instance", 10, "0010"},
fesa::ShellSourceElementType::s4,
{0U, 1U, 2U, 3U},
1U,
1U,
{"models/shell-owned.inp", 20U}}};
definition.shellNodeInitialFrames = {
{4U, {0.0, 0.0, 1.0}, {1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}},
{0U, {0.0, 1.0, 0.0}, {1.0, 0.0, 0.0}, {0.0, 0.0, -1.0}}};
auto result = fesa::Domain::create(definition);
ASSERT_TRUE(result.hasValue());
definition.shellSections[0].thickness = -1.0;
definition.shellElements[0].sourceId.sourceLabelText = "mutated";
definition.shellNodeInitialFrames[0].director[2] = -1.0;
const fesa::Domain& domain = result.value();
static_assert(std::is_same_v<
decltype(std::declval<const fesa::Domain&>().shellElements()),
const std::vector<fesa::Mitc4ShellDefinition>&>);
static_assert(std::is_same_v<
decltype(std::declval<const fesa::Domain&>().shellSections()),
const std::vector<fesa::ShellSection>&>);
static_assert(std::is_same_v<
decltype(std::declval<const fesa::Domain&>().shellNodeInitialFrames()),
const std::vector<fesa::ShellNodeInitialFrame>&>);
ASSERT_EQ(domain.shellElements().size(), 2U);
EXPECT_EQ(domain.shellElements()[0].sourceId.sourceLabel, 20);
EXPECT_EQ(domain.shellElements()[0].sourceId.sourceLabelText, "0020");
EXPECT_EQ(domain.shellElements()[1].sourceId.sourceLabel, 10);
EXPECT_EQ(domain.shellElements()[0].sourceType, fesa::ShellSourceElementType::s4r);
EXPECT_EQ(domain.shellElements()[1].sourceType, fesa::ShellSourceElementType::s4);
EXPECT_EQ(domain.shellElements()[0].nodeIndices[3], 7U);
EXPECT_EQ(domain.shellElements()[0].materialIndex, 0U);
EXPECT_EQ(domain.shellElements()[0].sectionIndex, 0U);
ASSERT_EQ(domain.shellSections().size(), 2U);
EXPECT_EQ(domain.shellSections()[0].name, "Section-B");
EXPECT_DOUBLE_EQ(domain.shellSections()[0].thickness, 0.02);
EXPECT_EQ(domain.shellSections()[0].materialIndex, 0U);
EXPECT_EQ(domain.shellSections()[1].name, "Section-A");
ASSERT_EQ(domain.shellNodeInitialFrames().size(), 2U);
EXPECT_EQ(domain.shellNodeInitialFrames()[0].nodeIndex, 4U);
EXPECT_EQ(
domain.shellNodeInitialFrames()[0].director,
(std::array<double, 3>{0.0, 0.0, 1.0}));
EXPECT_EQ(
domain.shellNodeInitialFrames()[0].tangentA,
(std::array<double, 3>{1.0, 0.0, 0.0}));
EXPECT_EQ(
domain.shellNodeInitialFrames()[0].tangentB,
(std::array<double, 3>{0.0, 1.0, 0.0}));
auto noFramesResult = fesa::Domain::create(fesa::ModelDefinition{});
ASSERT_TRUE(noFramesResult.hasValue());
EXPECT_TRUE(noFramesResult.value().shellNodeInitialFrames().empty());
}