feat(cpp-object-oriented-modular-refactoring): step 13 - element-definition-domain
This commit is contained in:
@@ -216,8 +216,8 @@ Status ValidateRecoveryInputs(const AnalysisModel& model,
|
||||
|
||||
EntityIndex previous_element = 0U;
|
||||
bool first_element = true;
|
||||
for (const EntityIndex element : model.ActiveElements()) {
|
||||
if (element >= domain.Elements().size() ||
|
||||
for (const EntityIndex element : model.ActiveBeamElements()) {
|
||||
if (element >= domain.BeamElements().Size() ||
|
||||
(!first_element && element <= previous_element)) {
|
||||
return RecoveryFailure(
|
||||
"invalid-recovery-entity", {domain.SourcePath(), 0U},
|
||||
@@ -226,11 +226,11 @@ Status ValidateRecoveryInputs(const AnalysisModel& model,
|
||||
}
|
||||
first_element = false;
|
||||
previous_element = element;
|
||||
const auto& definition = domain.Elements()[element];
|
||||
const auto& definition = domain.BeamElements()[element];
|
||||
if (definition.node_indices[0U] >= domain.Nodes().size() ||
|
||||
definition.node_indices[1U] >= domain.Nodes().size() ||
|
||||
definition.material_index >= domain.Materials().size() ||
|
||||
definition.section_index >= domain.Sections().size()) {
|
||||
definition.material_index >= domain.LinearElasticMaterials().Size() ||
|
||||
definition.section_index >= domain.Sections().Size()) {
|
||||
return RecoveryFailure(
|
||||
"invalid-recovery-entity", definition.location,
|
||||
definition.source_id.source_label_text,
|
||||
@@ -263,13 +263,13 @@ Status ValidateRecoveryInputs(const AnalysisModel& model,
|
||||
}
|
||||
}
|
||||
|
||||
if (!model.ActiveElements().empty() && !domain.ShellElements().empty()) {
|
||||
if (!model.ActiveBeamElements().empty() && !domain.ShellElements().Empty()) {
|
||||
return RecoveryFailure(
|
||||
"unsupported-mixed-element-model", {domain.SourcePath(), 0U},
|
||||
"B33:FESA-MITC4",
|
||||
"Result recovery does not support mixed beam and shell models.");
|
||||
}
|
||||
if (domain.ShellElements().size() >
|
||||
if (domain.ShellElements().Size() >
|
||||
static_cast<std::size_t>((std::numeric_limits<EntityIndex>::max)())) {
|
||||
return RecoveryFailure("invalid-recovery-dimensions",
|
||||
{domain.SourcePath(), 0U},
|
||||
@@ -278,10 +278,10 @@ Status ValidateRecoveryInputs(const AnalysisModel& model,
|
||||
"stable element identities.");
|
||||
}
|
||||
for (std::size_t element_order = 0U;
|
||||
element_order < domain.ShellElements().size(); ++element_order) {
|
||||
element_order < domain.ShellElements().Size(); ++element_order) {
|
||||
const auto& definition = domain.ShellElements()[element_order];
|
||||
if (definition.material_index >= domain.Materials().size() ||
|
||||
definition.section_index >= domain.ShellSections().size()) {
|
||||
if (definition.material_index >= domain.LinearElasticMaterials().Size() ||
|
||||
definition.section_index >= domain.ShellSections().Size()) {
|
||||
return RecoveryFailure("invalid-recovery-entity", definition.location,
|
||||
definition.source_id.source_label_text,
|
||||
"Active shell material and section references "
|
||||
@@ -586,16 +586,16 @@ Status ResultRecovery::Recover(const AnalysisModel& model,
|
||||
std::vector<EndpointResultRow> endpoint_rows;
|
||||
std::vector<GaussResultRow> gauss_rows;
|
||||
std::vector<StressS11Row> stress_rows;
|
||||
endpoint_rows.reserve(model.ActiveElements().size() * 2U);
|
||||
gauss_rows.reserve(model.ActiveElements().size() * 2U);
|
||||
endpoint_rows.reserve(model.ActiveBeamElements().size() * 2U);
|
||||
gauss_rows.reserve(model.ActiveBeamElements().size() * 2U);
|
||||
const Domain& domain = model.GetDomain();
|
||||
for (const EntityIndex element_index : model.ActiveElements()) {
|
||||
const auto& definition = domain.Elements()[element_index];
|
||||
auto beam =
|
||||
EulerBeam3D::Create(domain.Nodes()[definition.node_indices[0U]],
|
||||
domain.Nodes()[definition.node_indices[1U]],
|
||||
domain.Sections()[definition.section_index],
|
||||
domain.Materials()[definition.material_index]);
|
||||
for (const EntityIndex element_index : model.ActiveBeamElements()) {
|
||||
const auto& definition = domain.BeamElements()[element_index];
|
||||
auto beam = EulerBeam3D::Create(
|
||||
domain.Nodes()[definition.node_indices[0U]],
|
||||
domain.Nodes()[definition.node_indices[1U]],
|
||||
domain.Sections()[definition.section_index],
|
||||
domain.LinearElasticMaterials()[definition.material_index]);
|
||||
if (!beam.HasValue()) {
|
||||
return beam.GetStatus();
|
||||
}
|
||||
@@ -649,8 +649,8 @@ Status ResultRecovery::Recover(const AnalysisModel& model,
|
||||
|
||||
ShellStateCandidate shell_candidate{};
|
||||
std::vector<EntityIndex> expected_shell_elements;
|
||||
if (!domain.ShellElements().empty()) {
|
||||
if (domain.ShellElements().size() >
|
||||
if (!domain.ShellElements().Empty()) {
|
||||
if (domain.ShellElements().Size() >
|
||||
(std::numeric_limits<std::size_t>::max)() / kShellLocationCount) {
|
||||
return RecoveryFailure(
|
||||
"invalid-recovery-dimensions", {domain.SourcePath(), 0U},
|
||||
@@ -670,9 +670,9 @@ Status ResultRecovery::Recover(const AnalysisModel& model,
|
||||
directors_by_node[frame.node_index] = frame.director;
|
||||
}
|
||||
|
||||
shell_candidate.rows.reserve(domain.ShellElements().size() *
|
||||
shell_candidate.rows.reserve(domain.ShellElements().Size() *
|
||||
kShellLocationCount);
|
||||
expected_shell_elements.reserve(domain.ShellElements().size());
|
||||
expected_shell_elements.reserve(domain.ShellElements().Size());
|
||||
constexpr std::array<ShellMidsurfaceLocation, kShellLocationCount>
|
||||
locations{ShellMidsurfaceLocation::kGp1, ShellMidsurfaceLocation::kGp2,
|
||||
ShellMidsurfaceLocation::kGp3, ShellMidsurfaceLocation::kGp4};
|
||||
@@ -681,7 +681,7 @@ Status ResultRecovery::Recover(const AnalysisModel& model,
|
||||
ShellSectionPosition::kTop};
|
||||
constexpr std::array<double, 3> zeta{-1.0, 0.0, 1.0};
|
||||
for (std::size_t element_order = 0U;
|
||||
element_order < domain.ShellElements().size(); ++element_order) {
|
||||
element_order < domain.ShellElements().Size(); ++element_order) {
|
||||
const EntityIndex element_index = static_cast<EntityIndex>(element_order);
|
||||
const auto& definition = domain.ShellElements()[element_order];
|
||||
std::array<const Node*, 4> nodes{};
|
||||
@@ -701,7 +701,7 @@ Status ResultRecovery::Recover(const AnalysisModel& model,
|
||||
|
||||
auto shell = Mitc4Shell::Create(
|
||||
nodes, directors, domain.ShellSections()[definition.section_index],
|
||||
domain.Materials()[definition.material_index]);
|
||||
domain.LinearElasticMaterials()[definition.material_index]);
|
||||
if (!shell.HasValue()) {
|
||||
return shell.GetStatus();
|
||||
}
|
||||
@@ -788,9 +788,9 @@ ResultRecovery::NormalizeSectionResultantsToNodeStations(
|
||||
"Node-station component tolerances must be finite and nonnegative.");
|
||||
}
|
||||
}
|
||||
if (model.ActiveElements().size() >
|
||||
if (model.ActiveBeamElements().size() >
|
||||
(std::numeric_limits<std::size_t>::max)() / 2U ||
|
||||
endpoint_rows.size() != model.ActiveElements().size() * 2U) {
|
||||
endpoint_rows.size() != model.ActiveBeamElements().size() * 2U) {
|
||||
return RecoveryResultFailure<std::vector<NodeStationResultRow>>(
|
||||
"invalid-node-station-shape", {domain.SourcePath(), 0U},
|
||||
std::to_string(endpoint_rows.size()),
|
||||
@@ -799,15 +799,16 @@ ResultRecovery::NormalizeSectionResultantsToNodeStations(
|
||||
|
||||
std::vector<std::vector<const EndpointResultRow*>> rows_by_node(
|
||||
domain.Nodes().size());
|
||||
for (std::size_t order = 0U; order < model.ActiveElements().size(); ++order) {
|
||||
const EntityIndex element_index = model.ActiveElements()[order];
|
||||
if (element_index >= domain.Elements().size()) {
|
||||
for (std::size_t order = 0U; order < model.ActiveBeamElements().size();
|
||||
++order) {
|
||||
const EntityIndex element_index = model.ActiveBeamElements()[order];
|
||||
if (element_index >= domain.BeamElements().Size()) {
|
||||
return RecoveryResultFailure<std::vector<NodeStationResultRow>>(
|
||||
"invalid-node-station-entity", {domain.SourcePath(), 0U},
|
||||
std::to_string(element_index),
|
||||
"Every active station element must be a valid stable entity.");
|
||||
}
|
||||
const auto& definition = domain.Elements()[element_index];
|
||||
const auto& definition = domain.BeamElements()[element_index];
|
||||
for (std::size_t endpoint = 0U; endpoint < 2U; ++endpoint) {
|
||||
const auto& row = endpoint_rows[order * 2U + endpoint];
|
||||
const EntityIndex node_index = definition.node_indices[endpoint];
|
||||
@@ -885,8 +886,8 @@ ResultRecovery::NormalizeSectionResultantsToNodeStations(
|
||||
"Interior station collapse requires exactly two unloaded endpoints.");
|
||||
}
|
||||
|
||||
const auto& first_element = domain.Elements()[incident[0U]->element];
|
||||
const auto& second_element = domain.Elements()[incident[1U]->element];
|
||||
const auto& first_element = domain.BeamElements()[incident[0U]->element];
|
||||
const auto& second_element = domain.BeamElements()[incident[1U]->element];
|
||||
const bool chain_orientation =
|
||||
incident[0U]->endpoint != incident[1U]->endpoint &&
|
||||
((incident[0U]->endpoint == 1 && incident[1U]->endpoint == 0) ||
|
||||
|
||||
Reference in New Issue
Block a user