feat(cpp-object-oriented-modular-refactoring): step 3 - foundation-google-style
This commit is contained in:
@@ -20,12 +20,12 @@ fesa::DofManager makeEmptyDofs() {
|
||||
{definition.sourcePath, 10U}}};
|
||||
|
||||
auto domain = fesa::Domain::create(std::move(definition));
|
||||
EXPECT_TRUE(domain.hasValue());
|
||||
auto model = fesa::AnalysisModel::create(domain.value());
|
||||
EXPECT_TRUE(model.hasValue());
|
||||
auto dofs = fesa::DofManager::create(model.value());
|
||||
EXPECT_TRUE(dofs.hasValue());
|
||||
return std::move(dofs.value());
|
||||
EXPECT_TRUE(domain.HasValue());
|
||||
auto model = fesa::AnalysisModel::create(domain.Value());
|
||||
EXPECT_TRUE(model.HasValue());
|
||||
auto dofs = fesa::DofManager::create(model.Value());
|
||||
EXPECT_TRUE(dofs.HasValue());
|
||||
return std::move(dofs.Value());
|
||||
}
|
||||
|
||||
fesa::ShellResultRow makeShellRow(
|
||||
@@ -141,15 +141,15 @@ void expectShellCandidateRejectedWithoutMutation(
|
||||
const fesa::ShellStateCandidate& candidate,
|
||||
const fesa::ShellStateCandidate& committed) {
|
||||
const auto status = state.commitShellResults(expectedElements, candidate);
|
||||
EXPECT_FALSE(status.isOk());
|
||||
EXPECT_EQ(status.failureCategory(), fesa::FailureCategory::model);
|
||||
EXPECT_FALSE(status.IsOk());
|
||||
EXPECT_EQ(status.Category(), fesa::FailureCategory::kModel);
|
||||
expectShellStateEquals(
|
||||
state,
|
||||
committed.rows,
|
||||
committed.physicalStrainEnergy,
|
||||
committed.equilibrium,
|
||||
committed.verificationMetrics);
|
||||
ASSERT_TRUE(state.commitShellResults(expectedElements, committed).isOk());
|
||||
ASSERT_TRUE(state.commitShellResults(expectedElements, committed).IsOk());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -197,9 +197,9 @@ TEST(AnalysisState, PreservesStepFrameAndStableRowOrder) {
|
||||
EXPECT_EQ(constState.endpointResults().data(), endpointStorage);
|
||||
EXPECT_EQ(constState.endpointResults()[0].element, 2U);
|
||||
EXPECT_EQ(constState.endpointResults()[0].endpoint, -1);
|
||||
EXPECT_EQ(constState.endpointResults()[0].node.instanceName, "Beam-1");
|
||||
EXPECT_EQ(constState.endpointResults()[0].node.sourceLabel, 10);
|
||||
EXPECT_EQ(constState.endpointResults()[0].node.sourceLabelText, "010");
|
||||
EXPECT_EQ(constState.endpointResults()[0].node.instance_name, "Beam-1");
|
||||
EXPECT_EQ(constState.endpointResults()[0].node.source_label, 10);
|
||||
EXPECT_EQ(constState.endpointResults()[0].node.source_label_text, "010");
|
||||
EXPECT_EQ(
|
||||
constState.endpointResults()[0].endAction,
|
||||
(std::array<double, 6>{1.0, 2.0, 3.0, 4.0, 5.0, 6.0}));
|
||||
@@ -237,7 +237,7 @@ TEST(AnalysisState, OwnsExactShellRowsInStableElementAndLocationOrder) {
|
||||
|
||||
const auto status = state.commitShellResults(expectedElements, candidate);
|
||||
|
||||
ASSERT_TRUE(status.isOk());
|
||||
ASSERT_TRUE(status.IsOk());
|
||||
const fesa::AnalysisState& constState = state;
|
||||
ASSERT_EQ(constState.shellResults().size(), 8U);
|
||||
EXPECT_EQ(constState.shellResults()[0].element, 3U);
|
||||
@@ -283,7 +283,7 @@ TEST(AnalysisState, CommitsFiniteShellGlobalEvidence) {
|
||||
|
||||
const auto status = state.commitShellResults(expectedElements, candidate);
|
||||
|
||||
ASSERT_TRUE(status.isOk());
|
||||
ASSERT_TRUE(status.IsOk());
|
||||
EXPECT_DOUBLE_EQ(state.physicalStrainEnergy(), 35.5);
|
||||
EXPECT_EQ(
|
||||
state.equilibrium(),
|
||||
@@ -299,7 +299,7 @@ TEST(AnalysisState, InvalidShellCandidatesLeavePriorStateUnchanged) {
|
||||
auto state = fesa::AnalysisState::create(dofs, {"Step-1", 0U});
|
||||
const std::vector<fesa::EntityIndex> expectedElements{5U};
|
||||
const auto committed = makeShellCandidate(expectedElements);
|
||||
ASSERT_TRUE(state.commitShellResults(expectedElements, committed).isOk());
|
||||
ASSERT_TRUE(state.commitShellResults(expectedElements, committed).IsOk());
|
||||
|
||||
auto invalidLocation = makeShellCandidate(expectedElements);
|
||||
invalidLocation.rows[0].location = fesa::ShellMidsurfaceLocation::gp2;
|
||||
|
||||
@@ -117,34 +117,34 @@ RecoveryFixture makeFixture(
|
||||
reverseSecond,
|
||||
sectionJump,
|
||||
nonzeroPrescription));
|
||||
if (!domainResult.hasValue()) {
|
||||
if (!domainResult.HasValue()) {
|
||||
throw std::runtime_error{"Recovery fixture Domain construction failed."};
|
||||
}
|
||||
auto domain = std::make_unique<fesa::Domain>(
|
||||
std::move(domainResult.value()));
|
||||
std::move(domainResult.Value()));
|
||||
|
||||
auto modelResult = fesa::AnalysisModel::create(*domain);
|
||||
if (!modelResult.hasValue()) {
|
||||
if (!modelResult.HasValue()) {
|
||||
throw std::runtime_error{"Recovery fixture AnalysisModel construction failed."};
|
||||
}
|
||||
auto model = std::make_unique<fesa::AnalysisModel>(
|
||||
std::move(modelResult.value()));
|
||||
std::move(modelResult.Value()));
|
||||
|
||||
auto dofsResult = fesa::DofManager::create(*model);
|
||||
if (!dofsResult.hasValue()) {
|
||||
if (!dofsResult.HasValue()) {
|
||||
throw std::runtime_error{"Recovery fixture DofManager construction failed."};
|
||||
}
|
||||
auto dofs = std::make_unique<fesa::DofManager>(
|
||||
std::move(dofsResult.value()));
|
||||
std::move(dofsResult.Value()));
|
||||
|
||||
fesa::SerialParallelFor serial;
|
||||
auto stiffnessResult = fesa::SparseAssembler::assembleStiffness(
|
||||
*model, *dofs, serial);
|
||||
if (!stiffnessResult.hasValue()) {
|
||||
if (!stiffnessResult.HasValue()) {
|
||||
throw std::runtime_error{"Recovery fixture stiffness assembly failed."};
|
||||
}
|
||||
auto stiffness = std::make_unique<fesa::SparseMatrix>(
|
||||
std::move(stiffnessResult.value()));
|
||||
std::move(stiffnessResult.Value()));
|
||||
return {
|
||||
std::move(domain),
|
||||
std::move(model),
|
||||
@@ -226,38 +226,38 @@ fesa::ModelDefinition makeShellDefinition(
|
||||
|
||||
ShellRecoveryFixture makeShellFixture(fesa::ModelDefinition definition) {
|
||||
auto domainResult = fesa::Domain::create(std::move(definition));
|
||||
if (!domainResult.hasValue()) {
|
||||
if (!domainResult.HasValue()) {
|
||||
throw std::runtime_error{
|
||||
"Shell recovery fixture Domain construction failed."};
|
||||
}
|
||||
auto domain = std::make_unique<fesa::Domain>(
|
||||
std::move(domainResult.value()));
|
||||
std::move(domainResult.Value()));
|
||||
|
||||
auto modelResult = fesa::AnalysisModel::create(*domain);
|
||||
if (!modelResult.hasValue()) {
|
||||
if (!modelResult.HasValue()) {
|
||||
throw std::runtime_error{
|
||||
"Shell recovery fixture AnalysisModel construction failed."};
|
||||
}
|
||||
auto model = std::make_unique<fesa::AnalysisModel>(
|
||||
std::move(modelResult.value()));
|
||||
std::move(modelResult.Value()));
|
||||
|
||||
auto dofsResult = fesa::DofManager::create(*model);
|
||||
if (!dofsResult.hasValue()) {
|
||||
if (!dofsResult.HasValue()) {
|
||||
throw std::runtime_error{
|
||||
"Shell recovery fixture DofManager construction failed."};
|
||||
}
|
||||
auto dofs = std::make_unique<fesa::DofManager>(
|
||||
std::move(dofsResult.value()));
|
||||
std::move(dofsResult.Value()));
|
||||
|
||||
fesa::SerialParallelFor serial;
|
||||
auto stiffnessResult = fesa::SparseAssembler::assembleStiffness(
|
||||
*model, *dofs, serial);
|
||||
if (!stiffnessResult.hasValue()) {
|
||||
if (!stiffnessResult.HasValue()) {
|
||||
throw std::runtime_error{
|
||||
"Shell recovery fixture stiffness assembly failed."};
|
||||
}
|
||||
auto stiffness = std::make_unique<fesa::SparseMatrix>(
|
||||
std::move(stiffnessResult.value()));
|
||||
std::move(stiffnessResult.Value()));
|
||||
return {
|
||||
std::move(domain),
|
||||
std::move(model),
|
||||
@@ -290,7 +290,7 @@ fesa::AnalysisState makeShellPhysicalState(
|
||||
generalized[3U] * x + 0.5 * generalized[5U] * y;
|
||||
}
|
||||
state.externalForce() =
|
||||
fixture.stiffness->multiply(state.displacement());
|
||||
fixture.stiffness->Multiply(state.displacement());
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ fesa::AnalysisState makeAxialEquilibriumState(const RecoveryFixture& fixture) {
|
||||
*fixture.dofs, {"Step-1", 0U});
|
||||
state.displacement()[0U] = 0.1;
|
||||
state.displacement()[6U] = 0.3;
|
||||
const fesa::Vector internal = fixture.stiffness->multiply(state.displacement());
|
||||
const fesa::Vector internal = fixture.stiffness->Multiply(state.displacement());
|
||||
for (const std::size_t fullDof : fixture.dofs->freeDofs()) {
|
||||
state.externalForce()[fullDof] = internal[fullDof];
|
||||
}
|
||||
@@ -321,15 +321,15 @@ fesa::AnalysisState makePatchState(
|
||||
state.displacement()[9U] = twist * kLength;
|
||||
state.displacement()[10U] = kappaY * kLength;
|
||||
state.displacement()[11U] = kappaZ * kLength;
|
||||
state.externalForce() = fixture.stiffness->multiply(state.displacement());
|
||||
state.externalForce() = fixture.stiffness->Multiply(state.displacement());
|
||||
return state;
|
||||
}
|
||||
|
||||
void expectStatusCode(const fesa::Status& status, const std::string& code) {
|
||||
ASSERT_FALSE(status.isOk());
|
||||
EXPECT_EQ(status.failureCategory(), fesa::FailureCategory::model);
|
||||
ASSERT_EQ(status.diagnostics().size(), 1U);
|
||||
EXPECT_EQ(status.diagnostics()[0U].code, code);
|
||||
ASSERT_FALSE(status.IsOk());
|
||||
EXPECT_EQ(status.Category(), fesa::FailureCategory::kModel);
|
||||
ASSERT_EQ(status.Diagnostics().size(), 1U);
|
||||
EXPECT_EQ(status.Diagnostics()[0U].code, code);
|
||||
}
|
||||
|
||||
void expectScaledNear(
|
||||
@@ -371,12 +371,12 @@ TEST(ResultRecovery, ComputesResidualReactionForNonzeroPrescription) {
|
||||
staleShellEvidence.physicalStrainEnergy = 123.0;
|
||||
staleShellEvidence.equilibrium = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0};
|
||||
staleShellEvidence.verificationMetrics = {1.0e-11, 2.0e-11, 3.0e-11};
|
||||
ASSERT_TRUE(state.commitShellResults({}, staleShellEvidence).isOk());
|
||||
ASSERT_TRUE(state.commitShellResults({}, staleShellEvidence).IsOk());
|
||||
|
||||
const fesa::Status status = fesa::ResultRecovery::recover(
|
||||
*fixture.model, *fixture.dofs, *fixture.stiffness, state);
|
||||
|
||||
ASSERT_TRUE(status.isOk());
|
||||
ASSERT_TRUE(status.IsOk());
|
||||
EXPECT_DOUBLE_EQ(state.internalForce()[0U], -20.0);
|
||||
EXPECT_DOUBLE_EQ(state.internalForce()[6U], 20.0);
|
||||
EXPECT_DOUBLE_EQ(state.residual()[0U], -20.0);
|
||||
@@ -422,7 +422,7 @@ TEST(ResultRecovery, EnforcesNormalizedFreeResidual) {
|
||||
*fixture.dofs,
|
||||
*fixture.stiffness,
|
||||
thresholdPass);
|
||||
ASSERT_TRUE(thresholdStatus.isOk());
|
||||
ASSERT_TRUE(thresholdStatus.IsOk());
|
||||
EXPECT_NE(thresholdPass.residual()[6U], 0.0);
|
||||
EXPECT_DOUBLE_EQ(
|
||||
thresholdPass.reaction()[6U], thresholdPass.residual()[6U]);
|
||||
@@ -435,7 +435,7 @@ TEST(ResultRecovery, EnforcesNormalizedFreeResidual) {
|
||||
*zeroFixture.dofs,
|
||||
*zeroFixture.stiffness,
|
||||
zeroEquilibrium)
|
||||
.isOk());
|
||||
.IsOk());
|
||||
|
||||
auto wrongPrescription = makeAxialEquilibriumState(fixture);
|
||||
wrongPrescription.displacement()[0U] = 0.0;
|
||||
@@ -469,7 +469,7 @@ TEST(ResultRecovery, KeepsEndActionSectionAndGaussResultsDistinct) {
|
||||
|
||||
ASSERT_TRUE(fesa::ResultRecovery::recover(
|
||||
*fixture.model, *fixture.dofs, *fixture.stiffness, state)
|
||||
.isOk());
|
||||
.IsOk());
|
||||
ASSERT_EQ(state.endpointResults().size(), 2U);
|
||||
ASSERT_EQ(state.gaussResults().size(), 2U);
|
||||
EXPECT_EQ(state.endpointResults()[0U].endpoint, 0);
|
||||
@@ -497,7 +497,7 @@ TEST(ResultRecovery, MatchesAxialTorsionAndTwoPlaneEndSigns) {
|
||||
|
||||
ASSERT_TRUE(fesa::ResultRecovery::recover(
|
||||
*fixture.model, *fixture.dofs, *fixture.stiffness, state)
|
||||
.isOk());
|
||||
.IsOk());
|
||||
const double shearModulus =
|
||||
kYoungsModulus / (2.0 * (1.0 + kPoissonRatio));
|
||||
const std::array<double, 4> expected = {
|
||||
@@ -529,7 +529,7 @@ TEST(ResultRecovery, OrdersStressPointsAndDefaultCentroid) {
|
||||
auto state = makePatchState(fixture, 0.01, 0.0, 0.02, -0.03);
|
||||
ASSERT_TRUE(fesa::ResultRecovery::recover(
|
||||
*fixture.model, *fixture.dofs, *fixture.stiffness, state)
|
||||
.isOk());
|
||||
.IsOk());
|
||||
ASSERT_EQ(state.stressResults().size(), 4U);
|
||||
for (std::size_t gauss = 0U; gauss < 2U; ++gauss) {
|
||||
for (std::size_t point = 0U; point < sectionPoints.size(); ++point) {
|
||||
@@ -554,7 +554,7 @@ TEST(ResultRecovery, OrdersStressPointsAndDefaultCentroid) {
|
||||
*defaultFixture.dofs,
|
||||
*defaultFixture.stiffness,
|
||||
defaultState)
|
||||
.isOk());
|
||||
.IsOk());
|
||||
ASSERT_EQ(defaultState.stressResults().size(), 2U);
|
||||
for (const auto& row : defaultState.stressResults()) {
|
||||
EXPECT_EQ(row.sectionPoint, 0U);
|
||||
@@ -573,17 +573,17 @@ TEST(ResultRecovery, RequiresInteriorEndpointConsistencyWithoutAveraging) {
|
||||
auto normalized =
|
||||
fesa::ResultRecovery::normalizeSectionResultantsToNodeStations(
|
||||
*fixture.model, rows, tolerances);
|
||||
ASSERT_TRUE(normalized.hasValue());
|
||||
ASSERT_EQ(normalized.value().size(), 3U);
|
||||
EXPECT_EQ(normalized.value()[1U].representativeElement, 0U);
|
||||
EXPECT_DOUBLE_EQ(normalized.value()[1U].sectionResultant[0U], 5.0);
|
||||
ASSERT_TRUE(normalized.HasValue());
|
||||
ASSERT_EQ(normalized.Value().size(), 3U);
|
||||
EXPECT_EQ(normalized.Value()[1U].representativeElement, 0U);
|
||||
EXPECT_DOUBLE_EQ(normalized.Value()[1U].sectionResultant[0U], 5.0);
|
||||
|
||||
rows[2U].sectionResultant[0U] = 5.0 + 2.0e-6;
|
||||
auto mismatch =
|
||||
fesa::ResultRecovery::normalizeSectionResultantsToNodeStations(
|
||||
*fixture.model, rows, tolerances);
|
||||
ASSERT_FALSE(mismatch.hasValue());
|
||||
expectStatusCode(mismatch.status(), "node-station-tolerance-failure");
|
||||
ASSERT_FALSE(mismatch.HasValue());
|
||||
expectStatusCode(mismatch.GetStatus(), "node-station-tolerance-failure");
|
||||
|
||||
rows = makeStationRows(fixture);
|
||||
rows[2U].sectionResultant[1U] =
|
||||
@@ -591,17 +591,17 @@ TEST(ResultRecovery, RequiresInteriorEndpointConsistencyWithoutAveraging) {
|
||||
auto nonfinite =
|
||||
fesa::ResultRecovery::normalizeSectionResultantsToNodeStations(
|
||||
*fixture.model, rows, tolerances);
|
||||
ASSERT_FALSE(nonfinite.hasValue());
|
||||
expectStatusCode(nonfinite.status(), "nonfinite-node-station-value");
|
||||
ASSERT_FALSE(nonfinite.HasValue());
|
||||
expectStatusCode(nonfinite.GetStatus(), "nonfinite-node-station-value");
|
||||
|
||||
auto invalidTolerance =
|
||||
fesa::ResultRecovery::normalizeSectionResultantsToNodeStations(
|
||||
*fixture.model,
|
||||
makeStationRows(fixture),
|
||||
{1.0e-6, -1.0, 1.0e-6, 1.0e-6});
|
||||
ASSERT_FALSE(invalidTolerance.hasValue());
|
||||
ASSERT_FALSE(invalidTolerance.HasValue());
|
||||
expectStatusCode(
|
||||
invalidTolerance.status(), "invalid-node-station-tolerance");
|
||||
invalidTolerance.GetStatus(), "invalid-node-station-tolerance");
|
||||
|
||||
const std::filesystem::path source{"models/result-recovery.inp"};
|
||||
const auto loadedFixture = makeFixture(
|
||||
@@ -611,8 +611,8 @@ TEST(ResultRecovery, RequiresInteriorEndpointConsistencyWithoutAveraging) {
|
||||
*loadedFixture.model,
|
||||
makeStationRows(loadedFixture),
|
||||
tolerances);
|
||||
ASSERT_FALSE(loaded.hasValue());
|
||||
expectStatusCode(loaded.status(), "ineligible-node-station");
|
||||
ASSERT_FALSE(loaded.HasValue());
|
||||
expectStatusCode(loaded.GetStatus(), "ineligible-node-station");
|
||||
|
||||
const auto reversedFixture = makeFixture(true, {}, {}, true);
|
||||
auto reversed =
|
||||
@@ -620,8 +620,8 @@ TEST(ResultRecovery, RequiresInteriorEndpointConsistencyWithoutAveraging) {
|
||||
*reversedFixture.model,
|
||||
makeStationRows(reversedFixture),
|
||||
tolerances);
|
||||
ASSERT_FALSE(reversed.hasValue());
|
||||
expectStatusCode(reversed.status(), "ineligible-node-station");
|
||||
ASSERT_FALSE(reversed.HasValue());
|
||||
expectStatusCode(reversed.GetStatus(), "ineligible-node-station");
|
||||
|
||||
const auto jumpFixture = makeFixture(true, {}, {}, false, true);
|
||||
auto jumped =
|
||||
@@ -629,8 +629,8 @@ TEST(ResultRecovery, RequiresInteriorEndpointConsistencyWithoutAveraging) {
|
||||
*jumpFixture.model,
|
||||
makeStationRows(jumpFixture),
|
||||
tolerances);
|
||||
ASSERT_FALSE(jumped.hasValue());
|
||||
expectStatusCode(jumped.status(), "ineligible-node-station");
|
||||
ASSERT_FALSE(jumped.HasValue());
|
||||
expectStatusCode(jumped.GetStatus(), "ineligible-node-station");
|
||||
}
|
||||
|
||||
// MITC4-REC-001
|
||||
@@ -647,12 +647,12 @@ TEST(ResultRecovery, RecoversShellRowsInStableElementAndGpOrder) {
|
||||
state.displacement()[node * 6U + 1U] = -0.05 * y + 0.1 * x;
|
||||
}
|
||||
state.externalForce() =
|
||||
fixture.stiffness->multiply(state.displacement());
|
||||
fixture.stiffness->Multiply(state.displacement());
|
||||
|
||||
const auto status = fesa::ResultRecovery::recover(
|
||||
*fixture.model, *fixture.dofs, *fixture.stiffness, state);
|
||||
|
||||
ASSERT_TRUE(status.isOk());
|
||||
ASSERT_TRUE(status.IsOk());
|
||||
ASSERT_EQ(state.shellResults().size(), 8U);
|
||||
const double gauss = 1.0 / std::sqrt(3.0);
|
||||
const std::array<fesa::ShellMidsurfaceLocation, 4> locations{
|
||||
@@ -706,7 +706,7 @@ TEST(ResultRecovery, RecoversDirectBottomMiddleTopShellStress) {
|
||||
*fixture.dofs,
|
||||
*fixture.stiffness,
|
||||
state)
|
||||
.isOk());
|
||||
.IsOk());
|
||||
constexpr std::array<fesa::ShellSectionPosition, 3> positions{
|
||||
fesa::ShellSectionPosition::bottom,
|
||||
fesa::ShellSectionPosition::middle,
|
||||
@@ -744,16 +744,16 @@ TEST(ResultRecovery, SumsOnlyPhysicalShellEnergyInSourceOrder) {
|
||||
state.displacement()[node * 6U + 5U] = drill[node];
|
||||
}
|
||||
state.externalForce() =
|
||||
fixture.stiffness->multiply(state.displacement());
|
||||
const double stabilizedEnergy = 0.5 * state.displacement().dot(
|
||||
fixture.stiffness->multiply(state.displacement()));
|
||||
fixture.stiffness->Multiply(state.displacement());
|
||||
const double stabilizedEnergy = 0.5 * state.displacement().Dot(
|
||||
fixture.stiffness->Multiply(state.displacement()));
|
||||
|
||||
ASSERT_TRUE(fesa::ResultRecovery::recover(
|
||||
*fixture.model,
|
||||
*fixture.dofs,
|
||||
*fixture.stiffness,
|
||||
state)
|
||||
.isOk());
|
||||
.IsOk());
|
||||
EXPECT_NEAR(state.physicalStrainEnergy(), 72.16, 1.0e-12);
|
||||
EXPECT_GT(stabilizedEnergy, state.physicalStrainEnergy());
|
||||
}
|
||||
@@ -772,15 +772,15 @@ TEST(ResultRecovery, KeepsFullResidualAndComputesGlobalShellEquilibrium) {
|
||||
*fixture.dofs, {"Step-1", 0U});
|
||||
auto fullLoad = fesa::LoadAssembler::assembleFullNodalLoad(
|
||||
*fixture.model, *fixture.dofs);
|
||||
ASSERT_TRUE(fullLoad.hasValue());
|
||||
state.externalForce() = std::move(fullLoad.value());
|
||||
ASSERT_TRUE(fullLoad.HasValue());
|
||||
state.externalForce() = std::move(fullLoad.Value());
|
||||
|
||||
ASSERT_TRUE(fesa::ResultRecovery::recover(
|
||||
*fixture.model,
|
||||
*fixture.dofs,
|
||||
*fixture.stiffness,
|
||||
state)
|
||||
.isOk());
|
||||
.IsOk());
|
||||
ASSERT_EQ(state.shellResults().size(), 4U);
|
||||
for (std::size_t fullDof = 0U;
|
||||
fullDof < fixture.dofs->fullDofCount();
|
||||
@@ -805,7 +805,7 @@ TEST(ResultRecovery, KeepsFullResidualAndComputesGlobalShellEquilibrium) {
|
||||
*freeFixture.dofs,
|
||||
*freeFixture.stiffness,
|
||||
perturbed)
|
||||
.isOk());
|
||||
.IsOk());
|
||||
for (const double metric : perturbed.verificationMetrics()) {
|
||||
EXPECT_GT(metric, 0.0);
|
||||
EXPECT_LE(metric, 1.0e-10);
|
||||
@@ -838,13 +838,13 @@ TEST(ResultRecovery, UsesGlobalOriginForShellMomentBalance) {
|
||||
*centeredFixture.dofs,
|
||||
*centeredFixture.stiffness,
|
||||
centered)
|
||||
.isOk());
|
||||
.IsOk());
|
||||
ASSERT_TRUE(fesa::ResultRecovery::recover(
|
||||
*translatedFixture.model,
|
||||
*translatedFixture.dofs,
|
||||
*translatedFixture.stiffness,
|
||||
translated)
|
||||
.isOk());
|
||||
.IsOk());
|
||||
std::array<double, 3> centeredForce{};
|
||||
for (std::size_t component = 0U; component < 3U; ++component) {
|
||||
centeredForce[component] = centered.equilibrium()[component];
|
||||
@@ -877,11 +877,11 @@ TEST(ResultRecovery, UsesScaleAwareShellMetricsAndRejectsExcess) {
|
||||
auto large = makeShellPhysicalState(fixture);
|
||||
constexpr double subunitScale = 1.0e-6;
|
||||
constexpr double largeScale = 1.0e6;
|
||||
subunit.displacement().scale(subunitScale);
|
||||
subunit.externalForce().scale(subunitScale);
|
||||
subunit.displacement().Scale(subunitScale);
|
||||
subunit.externalForce().Scale(subunitScale);
|
||||
subunit.externalForce()[0U] += 1.0e-9 * subunitScale;
|
||||
large.displacement().scale(largeScale);
|
||||
large.externalForce().scale(largeScale);
|
||||
large.displacement().Scale(largeScale);
|
||||
large.externalForce().Scale(largeScale);
|
||||
large.externalForce()[0U] += 1.0e-9 * largeScale;
|
||||
|
||||
ASSERT_TRUE(fesa::ResultRecovery::recover(
|
||||
@@ -889,13 +889,13 @@ TEST(ResultRecovery, UsesScaleAwareShellMetricsAndRejectsExcess) {
|
||||
*fixture.dofs,
|
||||
*fixture.stiffness,
|
||||
subunit)
|
||||
.isOk());
|
||||
.IsOk());
|
||||
ASSERT_TRUE(fesa::ResultRecovery::recover(
|
||||
*fixture.model,
|
||||
*fixture.dofs,
|
||||
*fixture.stiffness,
|
||||
large)
|
||||
.isOk());
|
||||
.IsOk());
|
||||
for (std::size_t metric = 0U; metric < 3U; ++metric) {
|
||||
EXPECT_GT(subunit.verificationMetrics()[metric], 0.0);
|
||||
EXPECT_GT(large.verificationMetrics()[metric], 0.0);
|
||||
@@ -918,17 +918,17 @@ TEST(ResultRecovery, UsesScaleAwareShellMetricsAndRejectsExcess) {
|
||||
}
|
||||
const std::vector<fesa::CooContribution> unbalancedEntry{
|
||||
{0U, 0U, 1.0, 0U, 0U}};
|
||||
auto unbalancedStiffness = fesa::SparseMatrix::fromCoo(
|
||||
auto unbalancedStiffness = fesa::SparseMatrix::FromCoo(
|
||||
constrainedFixture.dofs->fullDofCount(),
|
||||
constrainedFixture.dofs->fullDofCount(),
|
||||
unbalancedEntry,
|
||||
constrainedFixture.dofs->sparsePattern());
|
||||
ASSERT_TRUE(unbalancedStiffness.hasValue());
|
||||
ASSERT_TRUE(unbalancedStiffness.HasValue());
|
||||
expectStatusCode(
|
||||
fesa::ResultRecovery::recover(
|
||||
*constrainedFixture.model,
|
||||
*constrainedFixture.dofs,
|
||||
unbalancedStiffness.value(),
|
||||
unbalancedStiffness.Value(),
|
||||
rejected),
|
||||
"global-equilibrium-tolerance-failure");
|
||||
}
|
||||
@@ -942,7 +942,7 @@ TEST(ResultRecovery, InvalidLaterShellLeavesEntirePriorStateUnchanged) {
|
||||
*validFixture.dofs,
|
||||
*validFixture.stiffness,
|
||||
state)
|
||||
.isOk());
|
||||
.IsOk());
|
||||
ASSERT_EQ(state.shellResults().size(), 8U);
|
||||
const auto priorFirstRow = state.shellResults().front();
|
||||
const double priorEnergy = state.physicalStrainEnergy();
|
||||
@@ -957,17 +957,17 @@ TEST(ResultRecovery, InvalidLaterShellLeavesEntirePriorStateUnchanged) {
|
||||
state.displacement()[5U * 6U] =
|
||||
(std::numeric_limits<double>::max)();
|
||||
state.externalForce() = fesa::Vector{validFixture.dofs->fullDofCount()};
|
||||
auto zeroStiffness = fesa::SparseMatrix::fromCoo(
|
||||
auto zeroStiffness = fesa::SparseMatrix::FromCoo(
|
||||
validFixture.dofs->fullDofCount(),
|
||||
validFixture.dofs->fullDofCount(),
|
||||
{},
|
||||
validFixture.dofs->sparsePattern());
|
||||
ASSERT_TRUE(zeroStiffness.hasValue());
|
||||
ASSERT_TRUE(zeroStiffness.HasValue());
|
||||
|
||||
const auto status = fesa::ResultRecovery::recover(
|
||||
*validFixture.model,
|
||||
*validFixture.dofs,
|
||||
zeroStiffness.value(),
|
||||
zeroStiffness.Value(),
|
||||
state);
|
||||
|
||||
expectStatusCode(status, "invalid-shell-recovery");
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "fesa/results/results_writer.hpp"
|
||||
|
||||
#include "fesa/analysis/analysis_state.hpp"
|
||||
#include "fesa/core/diagnostic.hpp"
|
||||
#include "fesa/core/status.hpp"
|
||||
#include "fesa/core/diagnostic.h"
|
||||
#include "fesa/core/status.h"
|
||||
#include "fesa/model/domain.hpp"
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
Reference in New Issue
Block a user