feat(linear-static-mitc4-shell): step 0 - shell-semantic-model
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
@@ -142,3 +143,45 @@ TEST(DomainModel, SourceAndInternalIdentityRemainDistinct) {
|
||||
static_assert(!HasEquationId<fesa::EulerBeam3DDefinition>::value);
|
||||
static_assert(!HasEquationIds<fesa::EulerBeam3DDefinition>::value);
|
||||
}
|
||||
|
||||
// MITC4-MODEL-001
|
||||
TEST(DomainModel, Mitc4ShellRecordsPreserveSourceAndInternalIdentity) {
|
||||
const fesa::Mitc4ShellDefinition s4Element{
|
||||
{"Shell-Instance", 41, "0041"},
|
||||
fesa::ShellSourceElementType::s4,
|
||||
{fesa::EntityIndex{3},
|
||||
fesa::EntityIndex{5},
|
||||
fesa::EntityIndex{8},
|
||||
fesa::EntityIndex{13}},
|
||||
fesa::EntityIndex{2},
|
||||
fesa::EntityIndex{7},
|
||||
{"models/shell.inp", 20U}};
|
||||
const fesa::Mitc4ShellDefinition s4rElement{
|
||||
{"Shell-Instance", 42, "0042"},
|
||||
fesa::ShellSourceElementType::s4r,
|
||||
{fesa::EntityIndex{13},
|
||||
fesa::EntityIndex{8},
|
||||
fesa::EntityIndex{5},
|
||||
fesa::EntityIndex{3}},
|
||||
fesa::EntityIndex{2},
|
||||
fesa::EntityIndex{7},
|
||||
{"models/shell.inp", 21U}};
|
||||
|
||||
EXPECT_EQ(s4Element.sourceId.instanceName, "Shell-Instance");
|
||||
EXPECT_EQ(s4Element.sourceId.sourceLabel, 41);
|
||||
EXPECT_EQ(s4Element.sourceId.sourceLabelText, "0041");
|
||||
EXPECT_EQ(s4Element.sourceType, fesa::ShellSourceElementType::s4);
|
||||
EXPECT_EQ(s4rElement.sourceType, fesa::ShellSourceElementType::s4r);
|
||||
EXPECT_NE(s4Element.sourceType, s4rElement.sourceType);
|
||||
EXPECT_EQ(
|
||||
fesa::kMitc4InternalFormulation,
|
||||
std::string_view{"FESA-MITC4"});
|
||||
EXPECT_EQ(
|
||||
s4Element.nodeIndices,
|
||||
(std::array<fesa::EntityIndex, 4>{3U, 5U, 8U, 13U}));
|
||||
EXPECT_EQ(s4Element.materialIndex, 2U);
|
||||
EXPECT_EQ(s4Element.sectionIndex, 7U);
|
||||
|
||||
static_assert(!HasEquationId<fesa::Mitc4ShellDefinition>::value);
|
||||
static_assert(!HasEquationIds<fesa::Mitc4ShellDefinition>::value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user