feat(cpp-object-oriented-modular-refactoring): step 3 - foundation-google-style

This commit is contained in:
KOKO\Mimi
2026-08-16 04:26:14 +09:00
parent 2628ed3488
commit 042edadffb
93 changed files with 3144 additions and 3175 deletions
+113 -113
View File
@@ -84,10 +84,10 @@ void expectMatrixNear(
const fesa::Matrix& actual,
const fesa::Matrix& expected,
double tolerance = 1.0e-12) {
ASSERT_EQ(actual.rows(), expected.rows());
ASSERT_EQ(actual.columns(), expected.columns());
for (std::size_t row = 0U; row < actual.rows(); ++row) {
for (std::size_t column = 0U; column < actual.columns(); ++column) {
ASSERT_EQ(actual.Rows(), expected.Rows());
ASSERT_EQ(actual.Columns(), expected.Columns());
for (std::size_t row = 0U; row < actual.Rows(); ++row) {
for (std::size_t column = 0U; column < actual.Columns(); ++column) {
EXPECT_NEAR(actual(row, column), expected(row, column), tolerance)
<< "at (" << row << ", " << column << ")";
}
@@ -95,20 +95,20 @@ void expectMatrixNear(
}
void expectSymmetric(const fesa::Matrix& matrix) {
ASSERT_EQ(matrix.rows(), matrix.columns());
for (std::size_t row = 0U; row < matrix.rows(); ++row) {
for (std::size_t column = 0U; column < matrix.columns(); ++column) {
ASSERT_EQ(matrix.Rows(), matrix.Columns());
for (std::size_t row = 0U; row < matrix.Rows(); ++row) {
for (std::size_t column = 0U; column < matrix.Columns(); ++column) {
EXPECT_NEAR(matrix(row, column), matrix(column, row), 1.0e-12);
}
}
}
bool hasPositiveCholeskyPivots(const fesa::Matrix& matrix) {
if (matrix.rows() != matrix.columns()) {
if (matrix.Rows() != matrix.Columns()) {
return false;
}
fesa::Matrix lower{matrix.rows(), matrix.columns()};
for (std::size_t row = 0U; row < matrix.rows(); ++row) {
fesa::Matrix lower{matrix.Rows(), matrix.Columns()};
for (std::size_t row = 0U; row < matrix.Rows(); ++row) {
for (std::size_t column = 0U; column <= row; ++column) {
double value = matrix(row, column);
for (std::size_t inner = 0U; inner < column; ++inner) {
@@ -129,8 +129,8 @@ bool hasPositiveCholeskyPivots(const fesa::Matrix& matrix) {
double frobeniusNorm(const fesa::Matrix& matrix) {
double squaredNorm = 0.0;
for (std::size_t row = 0U; row < matrix.rows(); ++row) {
for (std::size_t column = 0U; column < matrix.columns(); ++column) {
for (std::size_t row = 0U; row < matrix.Rows(); ++row) {
for (std::size_t column = 0U; column < matrix.Columns(); ++column) {
squaredNorm += matrix(row, column) * matrix(row, column);
}
}
@@ -141,11 +141,11 @@ double scaledSymmetryError(
const fesa::Matrix& matrix,
std::size_t dofsPerNode,
double elementLength) {
fesa::Matrix difference{matrix.rows(), matrix.columns()};
fesa::Matrix scaled{matrix.rows(), matrix.columns()};
for (std::size_t row = 0U; row < matrix.rows(); ++row) {
fesa::Matrix difference{matrix.Rows(), matrix.Columns()};
fesa::Matrix scaled{matrix.Rows(), matrix.Columns()};
for (std::size_t row = 0U; row < matrix.Rows(); ++row) {
const double rowScale = row % dofsPerNode < 3U ? elementLength : 1.0;
for (std::size_t column = 0U; column < matrix.columns(); ++column) {
for (std::size_t column = 0U; column < matrix.Columns(); ++column) {
const double columnScale =
column % dofsPerNode < 3U ? elementLength : 1.0;
scaled(row, column) =
@@ -161,10 +161,10 @@ fesa::Matrix scaledStiffness(
const fesa::Matrix& matrix,
std::size_t dofsPerNode,
double elementLength) {
fesa::Matrix scaled{matrix.rows(), matrix.columns()};
for (std::size_t row = 0U; row < matrix.rows(); ++row) {
fesa::Matrix scaled{matrix.Rows(), matrix.Columns()};
for (std::size_t row = 0U; row < matrix.Rows(); ++row) {
const double rowScale = row % dofsPerNode < 3U ? elementLength : 1.0;
for (std::size_t column = 0U; column < matrix.columns(); ++column) {
for (std::size_t column = 0U; column < matrix.Columns(); ++column) {
const double columnScale =
column % dofsPerNode < 3U ? elementLength : 1.0;
scaled(row, column) =
@@ -175,10 +175,10 @@ fesa::Matrix scaledStiffness(
}
std::vector<double> symmetricEigenvalues(fesa::Matrix matrix) {
if (matrix.rows() != matrix.columns()) {
if (matrix.Rows() != matrix.Columns()) {
throw std::invalid_argument{"Symmetric eigensolve requires a square matrix."};
}
const std::size_t size = matrix.rows();
const std::size_t size = matrix.Rows();
double matrixScale = 0.0;
for (std::size_t row = 0U; row < size; ++row) {
for (std::size_t column = 0U; column < size; ++column) {
@@ -266,7 +266,7 @@ double symmetricOperatorNorm(const fesa::Matrix& matrix) {
}
double quadraticEnergy(const fesa::Matrix& stiffness, const fesa::Vector& vector) {
return 0.5 * vector.dot(stiffness.multiply(vector));
return 0.5 * vector.Dot(stiffness.Multiply(vector));
}
fesa::Vector physicalField(const std::array<std::array<double, 5>, 4>& values) {
@@ -286,7 +286,7 @@ void expectStrain(
double eta,
double zeta,
const std::array<double, 5>& expected) {
const auto actual = shell.strainDisplacement20(xi, eta, zeta).multiply(field);
const auto actual = shell.strainDisplacement20(xi, eta, zeta).Multiply(field);
for (std::size_t component = 0U; component < expected.size(); ++component) {
EXPECT_NEAR(actual[component], expected[component], 1.0e-12)
<< "component " << component;
@@ -367,8 +367,8 @@ TEST(Mitc4ShellKinematics, BuildsRightHandedFramesAndSeparatePhysicalDrillingMap
node(4, {0.0, -1.0, 1.0})};
const auto candidate = fesa::Mitc4Shell::create(
nodePointers(nodes), directors({1.0, 0.0, 0.0}), section(), material());
ASSERT_TRUE(candidate.hasValue());
const auto& shell = candidate.value();
ASSERT_TRUE(candidate.HasValue());
const auto& shell = candidate.Value();
const auto frame = shell.localFrame(0.0, 0.0);
expectVectorNear(frame.e1, {0.0, 1.0, 0.0});
@@ -378,10 +378,10 @@ TEST(Mitc4ShellKinematics, BuildsRightHandedFramesAndSeparatePhysicalDrillingMap
const auto physical = shell.physicalTransformation20();
const auto drilling = shell.drillingTransformation4();
ASSERT_EQ(physical.rows(), 20U);
ASSERT_EQ(physical.columns(), 24U);
ASSERT_EQ(drilling.rows(), 4U);
ASSERT_EQ(drilling.columns(), 24U);
ASSERT_EQ(physical.Rows(), 20U);
ASSERT_EQ(physical.Columns(), 24U);
ASSERT_EQ(drilling.Rows(), 4U);
ASSERT_EQ(drilling.Columns(), 24U);
for (std::size_t nodeIndex = 0U; nodeIndex < 4U; ++nodeIndex) {
const std::size_t physicalOffset = 5U * nodeIndex;
const std::size_t globalOffset = 6U * nodeIndex;
@@ -411,7 +411,7 @@ TEST(Mitc4ShellKinematics, BuildsRightHandedFramesAndSeparatePhysicalDrillingMap
invalidDirectors[2] = {0.0, 0.0, 0.0};
EXPECT_FALSE(fesa::Mitc4Shell::create(
nodePointers(nodes), invalidDirectors, section(), material())
.hasValue());
.HasValue());
}
// MITC4-KIN-003
@@ -419,12 +419,12 @@ TEST(Mitc4ShellKinematics, FormsDirectColumnsAndAllCovariantTyingSamples) {
const auto nodes = planarNodes();
const auto candidate = fesa::Mitc4Shell::create(
nodePointers(nodes), directors(), section(), material());
ASSERT_TRUE(candidate.hasValue());
const auto& shell = candidate.value();
ASSERT_TRUE(candidate.HasValue());
const auto& shell = candidate.Value();
const auto direct = shell.directStrainDisplacement20(0.0, 0.0, 0.5);
ASSERT_EQ(direct.rows(), 5U);
ASSERT_EQ(direct.columns(), 20U);
ASSERT_EQ(direct.Rows(), 5U);
ASSERT_EQ(direct.Columns(), 20U);
EXPECT_DOUBLE_EQ(direct(0U, 0U), -0.25);
EXPECT_DOUBLE_EQ(direct(0U, 4U), -0.125);
EXPECT_DOUBLE_EQ(direct(1U, 1U), -0.25);
@@ -439,8 +439,8 @@ TEST(Mitc4ShellKinematics, FormsDirectColumnsAndAllCovariantTyingSamples) {
EXPECT_DOUBLE_EQ(direct(4U, 3U), -0.25);
const auto samples = shell.covariantTyingShearSamples20();
ASSERT_EQ(samples.rows(), 4U);
ASSERT_EQ(samples.columns(), 20U);
ASSERT_EQ(samples.Rows(), 4U);
ASSERT_EQ(samples.Columns(), 20U);
EXPECT_DOUBLE_EQ(samples(0U, 2U), -0.25);
EXPECT_DOUBLE_EQ(samples(0U, 4U), 0.25);
EXPECT_DOUBLE_EQ(samples(0U, 7U), 0.25);
@@ -476,21 +476,21 @@ TEST(Mitc4ShellConstitutive, BuildsExactPositiveDefiniteSectionMatricesAndRescal
const auto nodes = planarNodes();
const auto candidate = fesa::Mitc4Shell::create(
nodePointers(nodes), directors(), section(), material());
ASSERT_TRUE(candidate.hasValue());
const auto& shell = candidate.value();
ASSERT_TRUE(candidate.HasValue());
const auto& shell = candidate.Value();
const auto cps = shell.planeStressConstitutive();
const auto c5 = shell.materialConstitutive5();
const auto a = shell.membraneSectionMatrix();
const auto d = shell.bendingSectionMatrix();
const auto as = shell.transverseShearSectionMatrix();
EXPECT_EQ(cps.rows(), 3U);
EXPECT_EQ(cps.columns(), 3U);
EXPECT_EQ(c5.rows(), 5U);
EXPECT_EQ(c5.columns(), 5U);
EXPECT_EQ(a.rows(), 3U);
EXPECT_EQ(d.rows(), 3U);
EXPECT_EQ(as.rows(), 2U);
EXPECT_EQ(cps.Rows(), 3U);
EXPECT_EQ(cps.Columns(), 3U);
EXPECT_EQ(c5.Rows(), 5U);
EXPECT_EQ(c5.Columns(), 5U);
EXPECT_EQ(a.Rows(), 3U);
EXPECT_EQ(d.Rows(), 3U);
EXPECT_EQ(as.Rows(), 2U);
EXPECT_DOUBLE_EQ(cps(0U, 0U), 128.0);
EXPECT_DOUBLE_EQ(cps(0U, 1U), 32.0);
EXPECT_DOUBLE_EQ(cps(2U, 2U), 48.0);
@@ -514,8 +514,8 @@ TEST(Mitc4ShellConstitutive, BuildsExactPositiveDefiniteSectionMatricesAndRescal
directors(),
section(2.0 * lengthScale),
material(120.0 * forceScale / (lengthScale * lengthScale), 0.25));
ASSERT_TRUE(scaledCandidate.hasValue());
const auto& scaled = scaledCandidate.value();
ASSERT_TRUE(scaledCandidate.HasValue());
const auto& scaled = scaledCandidate.Value();
fesa::Matrix expectedCps{3U, 3U};
fesa::Matrix expectedC5{5U, 5U};
fesa::Matrix expectedA{3U, 3U};
@@ -548,13 +548,13 @@ TEST(Mitc4ShellConstitutive, BuildsExactPositiveDefiniteSectionMatricesAndRescal
EXPECT_FALSE(fesa::Mitc4Shell::create(
nodePointers(nodes), directors(), section(0.0), material())
.hasValue());
.HasValue());
EXPECT_FALSE(fesa::Mitc4Shell::create(
nodePointers(nodes), directors(), section(), material(0.0, 0.25))
.hasValue());
.HasValue());
EXPECT_FALSE(fesa::Mitc4Shell::create(
nodePointers(nodes), directors(), section(), material(120.0, 0.5))
.hasValue());
.HasValue());
}
// MITC4-KIN-005
@@ -578,23 +578,23 @@ TEST(Mitc4ShellKernel, FormsFiniteScaledSymmetricPhysicalAndStabilizedStiffness)
const auto nodes = planarNodes();
const auto shellCandidate = fesa::Mitc4Shell::create(
nodePointers(nodes), directors(), section(), material());
ASSERT_TRUE(shellCandidate.hasValue());
ASSERT_TRUE(shellCandidate.HasValue());
const auto stiffnessCandidate = shellCandidate.value().stiffness();
ASSERT_TRUE(stiffnessCandidate.hasValue());
const auto& stiffness = stiffnessCandidate.value();
EXPECT_EQ(stiffness.physicalLocal20.rows(), 20U);
EXPECT_EQ(stiffness.physicalLocal20.columns(), 20U);
EXPECT_EQ(stiffness.physicalGlobal24.rows(), 24U);
EXPECT_EQ(stiffness.drillingGlobal24.rows(), 24U);
EXPECT_EQ(stiffness.stabilizedGlobal24.rows(), 24U);
const auto stiffnessCandidate = shellCandidate.Value().stiffness();
ASSERT_TRUE(stiffnessCandidate.HasValue());
const auto& stiffness = stiffnessCandidate.Value();
EXPECT_EQ(stiffness.physicalLocal20.Rows(), 20U);
EXPECT_EQ(stiffness.physicalLocal20.Columns(), 20U);
EXPECT_EQ(stiffness.physicalGlobal24.Rows(), 24U);
EXPECT_EQ(stiffness.drillingGlobal24.Rows(), 24U);
EXPECT_EQ(stiffness.stabilizedGlobal24.Rows(), 24U);
for (const fesa::Matrix* matrix : {
&stiffness.physicalLocal20,
&stiffness.physicalGlobal24,
&stiffness.drillingGlobal24,
&stiffness.stabilizedGlobal24}) {
for (std::size_t row = 0U; row < matrix->rows(); ++row) {
for (std::size_t column = 0U; column < matrix->columns(); ++column) {
for (std::size_t row = 0U; row < matrix->Rows(); ++row) {
for (std::size_t column = 0U; column < matrix->Columns(); ++column) {
EXPECT_TRUE(std::isfinite((*matrix)(row, column)));
}
}
@@ -604,9 +604,9 @@ TEST(Mitc4ShellKernel, FormsFiniteScaledSymmetricPhysicalAndStabilizedStiffness)
EXPECT_LE(scaledSymmetryError(stiffness.drillingGlobal24, 6U, 2.0), 1.0e-12);
EXPECT_LE(scaledSymmetryError(stiffness.stabilizedGlobal24, 6U, 2.0), 1.0e-12);
const auto repeatedCandidate = shellCandidate.value().stiffness();
ASSERT_TRUE(repeatedCandidate.hasValue());
const auto& repeated = repeatedCandidate.value();
const auto repeatedCandidate = shellCandidate.Value().stiffness();
ASSERT_TRUE(repeatedCandidate.HasValue());
const auto& repeated = repeatedCandidate.Value();
expectMatrixNear(repeated.physicalLocal20, stiffness.physicalLocal20, 0.0);
expectMatrixNear(repeated.physicalGlobal24, stiffness.physicalGlobal24, 0.0);
expectMatrixNear(repeated.drillingGlobal24, stiffness.drillingGlobal24, 0.0);
@@ -619,18 +619,18 @@ TEST(Mitc4ShellKernel, PreservesPhysicalEnergyUnderTwentyToTwentyFourCongruence)
const auto nodes = planarNodes();
const auto shellCandidate = fesa::Mitc4Shell::create(
nodePointers(nodes), directors(), section(), material());
ASSERT_TRUE(shellCandidate.hasValue());
const auto stiffnessCandidate = shellCandidate.value().stiffness();
ASSERT_TRUE(stiffnessCandidate.hasValue());
const auto& stiffness = stiffnessCandidate.value();
ASSERT_TRUE(shellCandidate.HasValue());
const auto stiffnessCandidate = shellCandidate.Value().stiffness();
ASSERT_TRUE(stiffnessCandidate.HasValue());
const auto& stiffness = stiffnessCandidate.Value();
fesa::Vector globalField{24U};
for (std::size_t index = 0U; index < globalField.size(); ++index) {
for (std::size_t index = 0U; index < globalField.Size(); ++index) {
globalField[index] = 0.125 * static_cast<double>(
static_cast<int>(index % 7U) - 3);
}
const auto physicalField20 =
shellCandidate.value().physicalTransformation20().multiply(globalField);
shellCandidate.Value().physicalTransformation20().Multiply(globalField);
const double localEnergy = quadraticEnergy(
stiffness.physicalLocal20, physicalField20);
const double globalEnergy = quadraticEnergy(
@@ -648,10 +648,10 @@ TEST(Mitc4ShellKernel, RetainsSixRigidModesAndHasExpectedPhysicalAndStabilizedRa
const auto nodes = planarNodes();
const auto shellCandidate = fesa::Mitc4Shell::create(
nodePointers(nodes), directors(), section(), material());
ASSERT_TRUE(shellCandidate.hasValue());
const auto stiffnessCandidate = shellCandidate.value().stiffness();
ASSERT_TRUE(stiffnessCandidate.hasValue());
const auto& stiffness = stiffnessCandidate.value();
ASSERT_TRUE(shellCandidate.HasValue());
const auto stiffnessCandidate = shellCandidate.Value().stiffness();
ASSERT_TRUE(stiffnessCandidate.HasValue());
const auto& stiffness = stiffnessCandidate.Value();
const auto scaledPhysical20 =
scaledStiffness(stiffness.physicalLocal20, 5U, 2.0);
@@ -680,14 +680,14 @@ TEST(Mitc4ShellKernel, RetainsSixRigidModesAndHasExpectedPhysicalAndStabilizedRa
scaledMode[6U * nodeIndex + component] /= 2.0;
}
}
const double modeNorm = scaledMode.norm();
const double modeNorm = scaledMode.Norm();
ASSERT_GT(modeNorm, 0.0);
EXPECT_LE(
scaledPhysical24.multiply(scaledMode).norm() /
scaledPhysical24.Multiply(scaledMode).Norm() /
(physicalNorm * modeNorm),
1.0e-10);
EXPECT_LE(
scaledStabilized24.multiply(scaledMode).norm() /
scaledStabilized24.Multiply(scaledMode).Norm() /
(stabilizedNorm * modeNorm),
1.0e-10);
}
@@ -698,11 +698,11 @@ TEST(Mitc4ShellPatch, ReproducesIndependentMembraneBendingShearAndTwistFields) {
const auto nodes = planarNodes();
const auto shellCandidate = fesa::Mitc4Shell::create(
nodePointers(nodes), directors(), section(), material());
ASSERT_TRUE(shellCandidate.hasValue());
const auto& shell = shellCandidate.value();
ASSERT_TRUE(shellCandidate.HasValue());
const auto& shell = shellCandidate.Value();
const auto stiffnessCandidate = shell.stiffness();
ASSERT_TRUE(stiffnessCandidate.hasValue());
const auto& stiffness = stiffnessCandidate.value().physicalLocal20;
ASSERT_TRUE(stiffnessCandidate.HasValue());
const auto& stiffness = stiffnessCandidate.Value().physicalLocal20;
constexpr double magnitude = 0.2;
const double gauss = 1.0 / std::sqrt(3.0);
@@ -755,10 +755,10 @@ TEST(Mitc4ShellDrilling, UsesOnlyEightPositivePhysicalRotationDiagonalsAndFixedF
node(3, {50.0, 50.0, 0.0}), node(4, {-50.0, 50.0, 0.0})};
const auto shellCandidate = fesa::Mitc4Shell::create(
nodePointers(nodes), directors(), section(0.1), material());
ASSERT_TRUE(shellCandidate.hasValue());
const auto stiffnessCandidate = shellCandidate.value().stiffness();
ASSERT_TRUE(stiffnessCandidate.hasValue());
const auto& stiffness = stiffnessCandidate.value();
ASSERT_TRUE(shellCandidate.HasValue());
const auto stiffnessCandidate = shellCandidate.Value().stiffness();
ASSERT_TRUE(stiffnessCandidate.HasValue());
const auto& stiffness = stiffnessCandidate.Value();
double expectedReference = (std::numeric_limits<double>::max)();
double allDiagonalMinimum = (std::numeric_limits<double>::max)();
@@ -788,17 +788,17 @@ TEST(Mitc4ShellDrilling, FailsNonfiniteReferenceAndStabilizesEachPureDrillCoordi
const auto nodes = planarNodes();
const auto shellCandidate = fesa::Mitc4Shell::create(
nodePointers(nodes), directors(), section(), material());
ASSERT_TRUE(shellCandidate.hasValue());
const auto stiffnessCandidate = shellCandidate.value().stiffness();
ASSERT_TRUE(stiffnessCandidate.hasValue());
const auto& stiffness = stiffnessCandidate.value();
ASSERT_TRUE(shellCandidate.HasValue());
const auto stiffnessCandidate = shellCandidate.Value().stiffness();
ASSERT_TRUE(stiffnessCandidate.HasValue());
const auto& stiffness = stiffnessCandidate.Value();
for (std::size_t nodeIndex = 0U; nodeIndex < 4U; ++nodeIndex) {
fesa::Vector pureDrill{24U};
pureDrill[6U * nodeIndex + 5U] = 1.0;
EXPECT_DOUBLE_EQ(
stiffness.physicalGlobal24.multiply(pureDrill).norm(), 0.0);
const auto drillAction = stiffness.drillingGlobal24.multiply(pureDrill);
stiffness.physicalGlobal24.Multiply(pureDrill).Norm(), 0.0);
const auto drillAction = stiffness.drillingGlobal24.Multiply(pureDrill);
EXPECT_DOUBLE_EQ(drillAction[6U * nodeIndex + 5U], stiffness.drillingStiffness);
EXPECT_GT(quadraticEnergy(stiffness.drillingGlobal24, pureDrill), 0.0);
}
@@ -808,20 +808,20 @@ TEST(Mitc4ShellDrilling, FailsNonfiniteReferenceAndStabilizesEachPureDrillCoordi
node(3, {5.0e9, 5.0e9, 0.0}), node(4, {-5.0e9, 5.0e9, 0.0})};
const auto extremeShell = fesa::Mitc4Shell::create(
nodePointers(extremeNodes), directors(), section(1.0), material(1.0e300));
ASSERT_TRUE(extremeShell.hasValue());
const auto failure = extremeShell.value().stiffness();
ASSERT_FALSE(failure.hasValue());
ASSERT_EQ(failure.status().diagnostics().size(), 1U);
EXPECT_EQ(failure.status().diagnostics()[0].code, "invalid-shell-stiffness");
const auto repeatedFailure = extremeShell.value().stiffness();
ASSERT_FALSE(repeatedFailure.hasValue());
ASSERT_EQ(repeatedFailure.status().diagnostics().size(), 1U);
ASSERT_TRUE(extremeShell.HasValue());
const auto failure = extremeShell.Value().stiffness();
ASSERT_FALSE(failure.HasValue());
ASSERT_EQ(failure.GetStatus().Diagnostics().size(), 1U);
EXPECT_EQ(failure.GetStatus().Diagnostics()[0].code, "invalid-shell-stiffness");
const auto repeatedFailure = extremeShell.Value().stiffness();
ASSERT_FALSE(repeatedFailure.HasValue());
ASSERT_EQ(repeatedFailure.GetStatus().Diagnostics().size(), 1U);
EXPECT_EQ(
repeatedFailure.status().diagnostics()[0].code,
failure.status().diagnostics()[0].code);
repeatedFailure.GetStatus().Diagnostics()[0].code,
failure.GetStatus().Diagnostics()[0].code);
EXPECT_EQ(
repeatedFailure.status().diagnostics()[0].message,
failure.status().diagnostics()[0].message);
repeatedFailure.GetStatus().Diagnostics()[0].message,
failure.GetStatus().Diagnostics()[0].message);
}
// MITC4-KERNEL-007
@@ -829,21 +829,21 @@ TEST(Mitc4ShellDrilling, ExcludesPureDrillFromPhysicalRecoveryAndEnergy) {
const auto nodes = planarNodes();
const auto shellCandidate = fesa::Mitc4Shell::create(
nodePointers(nodes), directors(), section(), material());
ASSERT_TRUE(shellCandidate.hasValue());
const auto& shell = shellCandidate.value();
ASSERT_TRUE(shellCandidate.HasValue());
const auto& shell = shellCandidate.Value();
const auto stiffnessCandidate = shell.stiffness();
ASSERT_TRUE(stiffnessCandidate.hasValue());
ASSERT_TRUE(stiffnessCandidate.HasValue());
for (std::size_t nodeIndex = 0U; nodeIndex < nodes.size(); ++nodeIndex) {
fesa::Vector pureDrill{24U};
pureDrill[6U * nodeIndex + 5U] = 1.0;
EXPECT_GT(
stiffnessCandidate.value().stabilizedGlobal24.multiply(pureDrill).norm(),
stiffnessCandidate.Value().stabilizedGlobal24.Multiply(pureDrill).Norm(),
0.0);
const auto recoveryCandidate = shell.recoverPhysical(pureDrill);
ASSERT_TRUE(recoveryCandidate.hasValue());
const auto& recovery = recoveryCandidate.value();
ASSERT_TRUE(recoveryCandidate.HasValue());
const auto& recovery = recoveryCandidate.Value();
EXPECT_DOUBLE_EQ(recovery.strainEnergy, 0.0);
for (const auto& point : recovery.points) {
for (double value : point.generalizedStrain) {
@@ -866,8 +866,8 @@ TEST(Mitc4ShellPhysicalRecovery, RecoversHandFieldAtFixedLocationsAndSectionPosi
const auto nodes = planarNodes();
const auto shellCandidate = fesa::Mitc4Shell::create(
nodePointers(nodes), directors(), section(), material());
ASSERT_TRUE(shellCandidate.hasValue());
const auto& shell = shellCandidate.value();
ASSERT_TRUE(shellCandidate.HasValue());
const auto& shell = shellCandidate.Value();
constexpr std::array<double, 8> generalized{
0.1, -0.05, 0.2, 0.3, -0.15, 0.25, 0.4, -0.3};
@@ -889,8 +889,8 @@ TEST(Mitc4ShellPhysicalRecovery, RecoversHandFieldAtFixedLocationsAndSectionPosi
}
const auto recoveryCandidate = shell.recoverPhysical(globalField);
ASSERT_TRUE(recoveryCandidate.hasValue());
const auto& recovery = recoveryCandidate.value();
ASSERT_TRUE(recoveryCandidate.HasValue());
const auto& recovery = recoveryCandidate.Value();
const double gauss = 1.0 / std::sqrt(3.0);
const std::array<std::array<double, 2>, 4> expectedCoordinates{
std::array<double, 2>{-gauss, -gauss},