feat(cpp-object-oriented-modular-refactoring): step 4 - model-element-google-style
This commit is contained in:
@@ -785,9 +785,9 @@ void requireFiniteStress(const hid_t file) {
|
||||
|
||||
std::array<double, 9> expectedLocalAxes(
|
||||
const Domain& domain, const EulerBeam3DDefinition& element) {
|
||||
const auto& first = domain.nodes()[element.nodeIndices[0U]].coordinates;
|
||||
const auto& second = domain.nodes()[element.nodeIndices[1U]].coordinates;
|
||||
const auto& guide = domain.sections()[element.sectionIndex].firstAxis;
|
||||
const auto& first = domain.Nodes()[element.node_indices[0U]].coordinates;
|
||||
const auto& second = domain.Nodes()[element.node_indices[1U]].coordinates;
|
||||
const auto& guide = domain.Sections()[element.section_index].first_axis;
|
||||
const std::array<double, 3> delta = {
|
||||
second[0U] - first[0U],
|
||||
second[1U] - first[1U],
|
||||
@@ -862,7 +862,7 @@ HdfProjection readHdfProjection(
|
||||
std::filesystem::absolute(input).lexically_normal().generic_u8string();
|
||||
const std::string expectedIdentity =
|
||||
"path=" + normalizedInput +
|
||||
";content_identity=" + domain.sourceContentIdentity();
|
||||
";content_identity=" + domain.SourceContentIdentity();
|
||||
if (sourceIdentity != expectedIdentity) {
|
||||
fail("schema-mismatch", "The HDF5 source-input identity is inconsistent.");
|
||||
}
|
||||
@@ -870,30 +870,30 @@ HdfProjection readHdfProjection(
|
||||
HdfProjection projection{};
|
||||
projection.nodes = readNodeRows(file.get());
|
||||
projection.elements = readElementRows(file.get());
|
||||
if (projection.nodes.size() != domain.nodes().size() ||
|
||||
projection.elements.size() != domain.elements().size()) {
|
||||
if (projection.nodes.size() != domain.Nodes().size() ||
|
||||
projection.elements.size() != domain.Elements().size()) {
|
||||
fail("schema-mismatch", "HDF5 model identity counts do not match the input.");
|
||||
}
|
||||
for (std::size_t node = 0U; node < projection.nodes.size(); ++node) {
|
||||
const auto& actual = projection.nodes[node];
|
||||
const auto& expected = domain.nodes()[node];
|
||||
const auto& expected = domain.Nodes()[node];
|
||||
if (actual.internalNodeId != node ||
|
||||
actual.instanceName != expected.sourceId.instance_name ||
|
||||
actual.sourceNodeLabel != expected.sourceId.source_label ||
|
||||
actual.sourceNodeLabelText != expected.sourceId.source_label_text ||
|
||||
actual.instanceName != expected.source_id.instance_name ||
|
||||
actual.sourceNodeLabel != expected.source_id.source_label ||
|
||||
actual.sourceNodeLabelText != expected.source_id.source_label_text ||
|
||||
actual.coordinates != expected.coordinates) {
|
||||
fail("schema-mismatch", "An HDF5 node identity does not match the input.");
|
||||
}
|
||||
}
|
||||
for (std::size_t element = 0U; element < projection.elements.size(); ++element) {
|
||||
const auto& actual = projection.elements[element];
|
||||
const auto& expected = domain.elements()[element];
|
||||
const auto& expected = domain.Elements()[element];
|
||||
if (actual.internalElementId != element ||
|
||||
actual.instanceName != expected.sourceId.instance_name ||
|
||||
actual.sourceElementLabel != expected.sourceId.source_label ||
|
||||
actual.sourceElementLabelText != expected.sourceId.source_label_text ||
|
||||
actual.nodeInternalIds[0U] != expected.nodeIndices[0U] ||
|
||||
actual.nodeInternalIds[1U] != expected.nodeIndices[1U]) {
|
||||
actual.instanceName != expected.source_id.instance_name ||
|
||||
actual.sourceElementLabel != expected.source_id.source_label ||
|
||||
actual.sourceElementLabelText != expected.source_id.source_label_text ||
|
||||
actual.nodeInternalIds[0U] != expected.node_indices[0U] ||
|
||||
actual.nodeInternalIds[1U] != expected.node_indices[1U]) {
|
||||
fail("schema-mismatch", "An HDF5 element identity does not match the input.");
|
||||
}
|
||||
const auto axes = expectedLocalAxes(domain, expected);
|
||||
@@ -986,7 +986,7 @@ std::vector<NodeStationResultRow> normalizeStations(
|
||||
endpoints.push_back({
|
||||
static_cast<EntityIndex>(element),
|
||||
static_cast<int>(endpoint),
|
||||
domain.nodes()[node].sourceId,
|
||||
domain.Nodes()[node].source_id,
|
||||
{},
|
||||
values});
|
||||
}
|
||||
@@ -1192,8 +1192,8 @@ PhysicsEvidence makePhysicsEvidence(
|
||||
}
|
||||
evidence.freeResidualNorm =
|
||||
std::sqrt(static_cast<double>(residualSquared));
|
||||
for (std::size_t node = 0U; node < domain.nodes().size(); ++node) {
|
||||
const auto& coordinates = domain.nodes()[node].coordinates;
|
||||
for (std::size_t node = 0U; node < domain.Nodes().size(); ++node) {
|
||||
const auto& coordinates = domain.Nodes()[node].coordinates;
|
||||
const std::array<double, 3> applied = {
|
||||
load[node * 6U + 0U],
|
||||
load[node * 6U + 1U],
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "fesa/fem/dof_manager.hpp"
|
||||
#include "fesa/io/abaqus/input_reader.hpp"
|
||||
#include "fesa/io/hdf5/hdf5_results_writer.hpp"
|
||||
#include "fesa/model/domain.hpp"
|
||||
#include "fesa/model/domain.h"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@@ -173,8 +173,8 @@ fesa::ModelDefinition makeDefinition(
|
||||
const std::filesystem::path& input,
|
||||
std::string sourceContentIdentity) {
|
||||
fesa::ModelDefinition definition{};
|
||||
definition.sourcePath = input;
|
||||
definition.sourceContentIdentity = std::move(sourceContentIdentity);
|
||||
definition.source_path = input;
|
||||
definition.source_content_identity = std::move(sourceContentIdentity);
|
||||
for (std::size_t node = 0U; node < kNodeCount; ++node) {
|
||||
const auto label = static_cast<std::int64_t>(node + 1U);
|
||||
definition.nodes.push_back({
|
||||
@@ -217,7 +217,7 @@ void writeResultsFixture(
|
||||
if (!parsedInput.HasValue()) {
|
||||
throw std::runtime_error{"Reference fixture input identity read failed."};
|
||||
}
|
||||
auto domainResult = fesa::Domain::create(
|
||||
auto domainResult = fesa::Domain::Create(
|
||||
makeDefinition(input, parsedInput.Value().sourceContentIdentity));
|
||||
if (!domainResult.HasValue()) {
|
||||
throw std::runtime_error{"Reference fixture Domain construction failed."};
|
||||
@@ -250,7 +250,7 @@ void writeResultsFixture(
|
||||
state.endpointResults().push_back({
|
||||
static_cast<fesa::EntityIndex>(element),
|
||||
static_cast<int>(endpoint),
|
||||
domain.nodes()[node].sourceId,
|
||||
domain.Nodes()[node].source_id,
|
||||
{},
|
||||
values.sectionResultants[element][endpoint]});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user