feat(linear-static-mitc4-shell): step 6 - shell-dof-scatter
This commit is contained in:
@@ -46,6 +46,32 @@ fesa::ModelDefinition makeDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
fesa::ModelDefinition makeShellDefinition() {
|
||||
const std::filesystem::path source{"models/shell-dof-manager.inp"};
|
||||
fesa::ModelDefinition definition{};
|
||||
definition.sourcePath = source;
|
||||
definition.sourceContentIdentity = "fnv1a64:1122334455667788";
|
||||
definition.nodes = {
|
||||
{{"Shell-1", 10, "10"}, {0.0, 0.0, 0.0}, {source, 10U}},
|
||||
{{"Shell-1", 20, "20"}, {1.0, 0.0, 0.0}, {source, 11U}},
|
||||
{{"Shell-1", 30, "30"}, {1.0, 1.0, 0.0}, {source, 12U}},
|
||||
{{"Shell-1", 40, "40"}, {0.0, 1.0, 0.0}, {source, 13U}}};
|
||||
definition.materials = {
|
||||
{"Material", 1000.0, 0.25, {source, 20U}}};
|
||||
definition.shellSections = {
|
||||
{"ShellSection", 0.1, 0U, {source, 30U}}};
|
||||
definition.shellElements = {{
|
||||
{"Shell-1", 100, "100"},
|
||||
fesa::ShellSourceElementType::s4,
|
||||
{2U, 0U, 3U, 1U},
|
||||
0U,
|
||||
0U,
|
||||
{source, 40U}}};
|
||||
definition.steps = {{
|
||||
"Step-1", {}, {}, 0.1, 1.0, 0.01, 1.0, {source, 50U}}};
|
||||
return definition;
|
||||
}
|
||||
|
||||
struct DofFixture {
|
||||
fesa::DofManager dofs;
|
||||
};
|
||||
@@ -161,6 +187,42 @@ TEST(DofManager, BuildsTwelveDofScatterAndSortedUniquePattern) {
|
||||
}
|
||||
}
|
||||
|
||||
// MITC4-DOF-001
|
||||
TEST(DofManager, BuildsShellScatterInSourceNodeAndComponentOrder) {
|
||||
const auto fixture = makeDofFixture(makeShellDefinition());
|
||||
const auto& dofs = fixture.dofs;
|
||||
|
||||
EXPECT_EQ(dofs.fullDofCount(), 24U);
|
||||
EXPECT_EQ(
|
||||
dofs.shellElementScatter(0U),
|
||||
(std::array<std::size_t, 24>{
|
||||
12U, 13U, 14U, 15U, 16U, 17U,
|
||||
0U, 1U, 2U, 3U, 4U, 5U,
|
||||
18U, 19U, 20U, 21U, 22U, 23U,
|
||||
6U, 7U, 8U, 9U, 10U, 11U}));
|
||||
}
|
||||
|
||||
// MITC4-DOF-002
|
||||
TEST(DofManager, IncludesShellConnectivityInSortedUniqueSparsePattern) {
|
||||
const auto fixture = makeDofFixture(makeShellDefinition());
|
||||
const auto& dofs = fixture.dofs;
|
||||
const auto& pattern = dofs.sparsePattern();
|
||||
|
||||
ASSERT_EQ(pattern.rowOffsets.size(), 25U);
|
||||
ASSERT_EQ(pattern.columnIndices.size(), 24U * 24U);
|
||||
for (std::size_t row = 0U; row < dofs.fullDofCount(); ++row) {
|
||||
EXPECT_EQ(pattern.rowOffsets[row], row * 24U);
|
||||
EXPECT_EQ(pattern.rowOffsets[row + 1U], (row + 1U) * 24U);
|
||||
const auto columns = rowColumns(pattern, row);
|
||||
ASSERT_EQ(columns.size(), 24U);
|
||||
for (std::size_t column = 0U; column < columns.size(); ++column) {
|
||||
EXPECT_EQ(columns[column], column);
|
||||
}
|
||||
EXPECT_TRUE(std::binary_search(columns.begin(), columns.end(), row));
|
||||
EXPECT_EQ(std::adjacent_find(columns.begin(), columns.end()), columns.end());
|
||||
}
|
||||
}
|
||||
|
||||
TEST(DofManager, ReconstructsFullReducedRoundTrip) {
|
||||
const auto fixture = makeDofFixture();
|
||||
const auto& dofs = fixture.dofs;
|
||||
|
||||
Reference in New Issue
Block a user