feat(cpp-object-oriented-modular-refactoring): step 4 - model-element-google-style
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
#include "fesa/analysis/analysis_state.hpp"
|
||||
#include "fesa/build_info.h"
|
||||
#include "fesa/fem/dof_manager.hpp"
|
||||
#include "fesa/model/domain.hpp"
|
||||
#include "fesa/model/domain.h"
|
||||
|
||||
#include <hdf5.h>
|
||||
|
||||
@@ -123,8 +123,8 @@ fesa::ModelDefinition makeDefinition(
|
||||
const std::filesystem::path& source,
|
||||
const bool useDefaultCentroid) {
|
||||
fesa::ModelDefinition definition{};
|
||||
definition.sourcePath = source;
|
||||
definition.sourceContentIdentity = "fnv1a64:0123456789abcdef";
|
||||
definition.source_path = source;
|
||||
definition.source_content_identity = "fnv1a64:0123456789abcdef";
|
||||
definition.nodes = {
|
||||
{{u8"Beam-\u03b1", 101, "101"}, {0.0, 0.0, 0.0}, {source, 10U}},
|
||||
{{u8"Beam-\u03b1", 202, "202"}, {3.0, 4.0, 0.0}, {source, 11U}}};
|
||||
@@ -156,7 +156,7 @@ fesa::ModelDefinition makeDefinition(
|
||||
WriterFixture makeFixture(
|
||||
const std::filesystem::path& source,
|
||||
const bool useDefaultCentroid = false) {
|
||||
auto domainResult = fesa::Domain::create(
|
||||
auto domainResult = fesa::Domain::Create(
|
||||
makeDefinition(source, useDefaultCentroid));
|
||||
if (!domainResult.HasValue()) {
|
||||
throw std::runtime_error{"Writer fixture Domain construction failed."};
|
||||
@@ -186,16 +186,16 @@ WriterFixture makeFixture(
|
||||
state->reaction()[index] = 100.0 + static_cast<double>(index);
|
||||
}
|
||||
|
||||
const auto& nodes = domain->nodes();
|
||||
const auto& nodes = domain->Nodes();
|
||||
state->endpointResults() = {
|
||||
{0U,
|
||||
0,
|
||||
nodes[0U].sourceId,
|
||||
nodes[0U].source_id,
|
||||
{1.0, 2.0, 3.0, 4.0, 5.0, 6.0},
|
||||
{11.0, 12.0, 13.0, 14.0}},
|
||||
{0U,
|
||||
1,
|
||||
nodes[1U].sourceId,
|
||||
nodes[1U].source_id,
|
||||
{7.0, 8.0, 9.0, 10.0, 11.0, 12.0},
|
||||
{15.0, 16.0, 17.0, 18.0}}};
|
||||
state->gaussResults() = {
|
||||
@@ -217,8 +217,8 @@ WriterFixture makeFixture(
|
||||
|
||||
fesa::ModelDefinition makeShellDefinition(const std::filesystem::path& source) {
|
||||
fesa::ModelDefinition definition{};
|
||||
definition.sourcePath = source;
|
||||
definition.sourceContentIdentity = "fnv1a64:fedcba9876543210";
|
||||
definition.source_path = source;
|
||||
definition.source_content_identity = "fnv1a64:fedcba9876543210";
|
||||
definition.nodes = {
|
||||
{{"Shell-1", 11, "11"}, {-1.0, -1.0, 0.0}, {source, 10U}},
|
||||
{{"Shell-1", 12, "12"}, {1.0, -1.0, 0.0}, {source, 11U}},
|
||||
@@ -226,23 +226,23 @@ fesa::ModelDefinition makeShellDefinition(const std::filesystem::path& source) {
|
||||
{{"Shell-1", 14, "14"}, {-1.0, 1.0, 0.0}, {source, 13U}}};
|
||||
definition.materials = {
|
||||
{"ShellSteel", 210.0e9, 0.3, {source, 20U}}};
|
||||
definition.shellSections = {
|
||||
definition.shell_sections = {
|
||||
{"PlateSet", 0.02, 0U, {source, 30U}}};
|
||||
definition.shellElements = {{
|
||||
definition.shell_elements = {{
|
||||
{"Shell-1", 401, "401"},
|
||||
fesa::ShellSourceElementType::s4r,
|
||||
fesa::ShellSourceElementType::kS4r,
|
||||
{0U, 1U, 2U, 3U},
|
||||
0U,
|
||||
0U,
|
||||
{source, 40U}}};
|
||||
for (std::size_t node = 0U; node < definition.nodes.size(); ++node) {
|
||||
definition.shellNodeInitialFrames.push_back({
|
||||
definition.shell_node_initial_frames.push_back({
|
||||
static_cast<fesa::EntityIndex>(node),
|
||||
{0.0, 0.0, 1.0},
|
||||
{1.0, 0.0, 0.0},
|
||||
{0.0, 1.0, 0.0}});
|
||||
}
|
||||
definition.nodeSets = {
|
||||
definition.node_sets = {
|
||||
{"Fixed", {}, {0U}, {source, 50U}}};
|
||||
definition.steps = {{
|
||||
"Step-1",
|
||||
@@ -258,7 +258,7 @@ fesa::ModelDefinition makeShellDefinition(const std::filesystem::path& source) {
|
||||
}
|
||||
|
||||
WriterFixture makeShellFixture(const std::filesystem::path& source) {
|
||||
auto domainResult = fesa::Domain::create(makeShellDefinition(source));
|
||||
auto domainResult = fesa::Domain::Create(makeShellDefinition(source));
|
||||
if (!domainResult.HasValue()) {
|
||||
throw std::runtime_error{"Shell writer fixture Domain construction failed."};
|
||||
}
|
||||
@@ -1033,7 +1033,7 @@ TEST(Hdf5ResultsWriter, WritesMandatoryOutputsDespiteOutputRequests) {
|
||||
const fesa::Diagnostic ignoredRequest{
|
||||
fesa::Severity::kWarning,
|
||||
"ignored-output-request",
|
||||
{fixture.domain->sourcePath(), 70U},
|
||||
{fixture.domain->SourcePath(), 70U},
|
||||
"*OUTPUT",
|
||||
"FIELD",
|
||||
"Abaqus output requests do not filter FESA mandatory results."};
|
||||
@@ -1065,13 +1065,13 @@ TEST(Hdf5ResultsWriter, WritesWarningsAndDefaultCentroid) {
|
||||
std::vector<fesa::Diagnostic> diagnostics = {
|
||||
{fesa::Severity::kWarning,
|
||||
"ignored-output-request",
|
||||
{fixture.domain->sourcePath(), 80U},
|
||||
{fixture.domain->SourcePath(), 80U},
|
||||
"*OUTPUT",
|
||||
"FIELD",
|
||||
"Ignored output request."},
|
||||
{fesa::Severity::kWarning,
|
||||
"ignored-keyword",
|
||||
{fixture.domain->sourcePath(), 20U},
|
||||
{fixture.domain->SourcePath(), 20U},
|
||||
"*PREPRINT",
|
||||
"",
|
||||
"Ignored generator control."}};
|
||||
@@ -1098,7 +1098,7 @@ TEST(Hdf5ResultsWriter, WritesWarningsAndDefaultCentroid) {
|
||||
EXPECT_STREQ(rows[0U].code, "ignored-keyword");
|
||||
EXPECT_STREQ(
|
||||
rows[0U].file,
|
||||
std::filesystem::absolute(fixture.domain->sourcePath())
|
||||
std::filesystem::absolute(fixture.domain->SourcePath())
|
||||
.lexically_normal()
|
||||
.generic_u8string()
|
||||
.c_str());
|
||||
@@ -1321,7 +1321,7 @@ TEST(Hdf5ResultsWriter, WritesShellInventoryDespiteRequestsAndOmitsForbiddenPath
|
||||
const fesa::Diagnostic ignoredRequest{
|
||||
fesa::Severity::kWarning,
|
||||
"ignored-output-request",
|
||||
{fixture.domain->sourcePath(), 80U},
|
||||
{fixture.domain->SourcePath(), 80U},
|
||||
"*ELEMENT OUTPUT",
|
||||
"S",
|
||||
"Output requests cannot filter mandatory shell results."};
|
||||
|
||||
Reference in New Issue
Block a user