feat(cpp-object-oriented-modular-refactoring): step 4 - model-element-google-style
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "fesa/io/abaqus/domain_mapper.hpp"
|
||||
|
||||
#include "fesa/model/shell_geometry.hpp"
|
||||
#include "fesa/model/shell_geometry.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
@@ -151,7 +151,7 @@ public:
|
||||
failure_->category, {std::move(failure_->diagnostic)}));
|
||||
}
|
||||
SortDiagnostics(definition_.warnings);
|
||||
return Domain::create(std::move(definition_));
|
||||
return Domain::Create(std::move(definition_));
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -419,8 +419,8 @@ private:
|
||||
}
|
||||
|
||||
void parseBlocks() {
|
||||
definition_.sourcePath = input_.sourcePath;
|
||||
definition_.sourceContentIdentity = input_.sourceContentIdentity;
|
||||
definition_.source_path = input_.sourcePath;
|
||||
definition_.source_content_identity = input_.sourceContentIdentity;
|
||||
|
||||
for (std::size_t index = 0U;
|
||||
index < input_.blocks.size() && !failure_;
|
||||
@@ -1776,11 +1776,11 @@ private:
|
||||
if (failure_) {
|
||||
return;
|
||||
}
|
||||
if (!definition_.shellElements.empty()) {
|
||||
auto geometry = preprocessShellGeometry(
|
||||
if (!definition_.shell_elements.empty()) {
|
||||
auto geometry = PreprocessShellGeometry(
|
||||
definition_.nodes,
|
||||
definition_.shellElements,
|
||||
definition_.shellSections);
|
||||
definition_.shell_elements,
|
||||
definition_.shell_sections);
|
||||
if (!geometry.HasValue()) {
|
||||
const auto& status = geometry.GetStatus();
|
||||
failure_ = MappingFailure{
|
||||
@@ -1788,8 +1788,8 @@ private:
|
||||
status.Diagnostics().front()};
|
||||
return;
|
||||
}
|
||||
definition_.shellNodeInitialFrames =
|
||||
std::move(geometry.Value().nodalFrames);
|
||||
definition_.shell_node_initial_frames =
|
||||
std::move(geometry.Value().nodal_frames);
|
||||
}
|
||||
expandAssemblySets();
|
||||
if (failure_) {
|
||||
@@ -1863,10 +1863,10 @@ private:
|
||||
partDefinition.name = part.name;
|
||||
partDefinition.location = part.location;
|
||||
for (const auto& node : part.nodes) {
|
||||
partDefinition.nodeSourceLabels.push_back(node.label);
|
||||
partDefinition.node_source_labels.push_back(node.label);
|
||||
}
|
||||
for (const auto& element : part.elements) {
|
||||
partDefinition.elementSourceLabels.push_back(element.label);
|
||||
partDefinition.element_source_labels.push_back(element.label);
|
||||
for (const auto nodeLabel : element.nodeLabels) {
|
||||
if (findNode(part, nodeLabel) == nullptr) {
|
||||
inputFailure(
|
||||
@@ -1880,7 +1880,7 @@ private:
|
||||
}
|
||||
}
|
||||
for (const auto& set : part.nodeSets) {
|
||||
partDefinition.nodeSetNames.push_back(set.name);
|
||||
partDefinition.node_set_names.push_back(set.name);
|
||||
for (const auto label : set.members) {
|
||||
if (findNode(part, label) == nullptr) {
|
||||
inputFailure(
|
||||
@@ -1892,7 +1892,7 @@ private:
|
||||
}
|
||||
}
|
||||
for (const auto& set : part.elementSets) {
|
||||
partDefinition.elementSetNames.push_back(set.name);
|
||||
partDefinition.element_set_names.push_back(set.name);
|
||||
for (const auto label : set.members) {
|
||||
if (findElement(part, label) == nullptr) {
|
||||
inputFailure(
|
||||
@@ -1919,8 +1919,8 @@ private:
|
||||
return;
|
||||
}
|
||||
const EntityIndex sectionIndex =
|
||||
static_cast<EntityIndex>(definition_.shellSections.size());
|
||||
definition_.shellSections.push_back({
|
||||
static_cast<EntityIndex>(definition_.shell_sections.size());
|
||||
definition_.shell_sections.push_back({
|
||||
section.elementSetName,
|
||||
section.thickness,
|
||||
*materialIndex,
|
||||
@@ -2071,11 +2071,11 @@ private:
|
||||
deltaScaled[2] / lengthRatio};
|
||||
|
||||
const double globalGuideScale =
|
||||
std::max(1.0, maximumAbsolute(section.firstAxis));
|
||||
std::max(1.0, maximumAbsolute(section.first_axis));
|
||||
std::array<double, 3> guideScaled{};
|
||||
for (std::size_t coordinate = 0U; coordinate < 3U; ++coordinate) {
|
||||
guideScaled[coordinate] =
|
||||
section.firstAxis[coordinate] / globalGuideScale;
|
||||
section.first_axis[coordinate] / globalGuideScale;
|
||||
}
|
||||
const double projection =
|
||||
guideScaled[0] * tangent[0] +
|
||||
@@ -2130,7 +2130,7 @@ private:
|
||||
rawNode.coordinates,
|
||||
rawNode.location});
|
||||
nodeIndices.emplace(rawNode.label, index);
|
||||
instance.nodeMappings.push_back({rawNode.label, index});
|
||||
instance.node_mappings.push_back({rawNode.label, index});
|
||||
}
|
||||
|
||||
for (const auto& rawElement : part->elements) {
|
||||
@@ -2199,7 +2199,7 @@ private:
|
||||
"Expanded shell section assignment must resolve exactly once.");
|
||||
return;
|
||||
}
|
||||
if (definition_.shellElements.size() >
|
||||
if (definition_.shell_elements.size() >
|
||||
std::numeric_limits<EntityIndex>::max()) {
|
||||
inputFailure(
|
||||
"entity-index-overflow", rawElement.location,
|
||||
@@ -2208,19 +2208,19 @@ private:
|
||||
return;
|
||||
}
|
||||
index =
|
||||
static_cast<EntityIndex>(definition_.shellElements.size());
|
||||
definition_.shellElements.push_back({
|
||||
static_cast<EntityIndex>(definition_.shell_elements.size());
|
||||
definition_.shell_elements.push_back({
|
||||
{rawInstance.name, rawElement.label, rawElement.labelText},
|
||||
rawElement.type == RawElement::Type::s4
|
||||
? ShellSourceElementType::s4
|
||||
: ShellSourceElementType::s4r,
|
||||
? ShellSourceElementType::kS4
|
||||
: ShellSourceElementType::kS4r,
|
||||
connectedNodes,
|
||||
assignment->second.second,
|
||||
assignment->second.first,
|
||||
rawElement.location});
|
||||
}
|
||||
elementIndices.emplace(rawElement.label, index);
|
||||
instance.elementMappings.push_back({rawElement.label, index});
|
||||
instance.element_mappings.push_back({rawElement.label, index});
|
||||
}
|
||||
|
||||
for (const auto& rawSet : part->nodeSets) {
|
||||
@@ -2234,9 +2234,9 @@ private:
|
||||
"Part node-set expansion failed.");
|
||||
return;
|
||||
}
|
||||
set.nodeIndices.push_back(found->second);
|
||||
set.node_indices.push_back(found->second);
|
||||
}
|
||||
definition_.nodeSets.push_back(std::move(set));
|
||||
definition_.node_sets.push_back(std::move(set));
|
||||
}
|
||||
for (const auto& rawSet : part->elementSets) {
|
||||
ElementSet set{
|
||||
@@ -2250,9 +2250,9 @@ private:
|
||||
"Part element-set expansion failed.");
|
||||
return;
|
||||
}
|
||||
set.elementIndices.push_back(found->second);
|
||||
set.element_indices.push_back(found->second);
|
||||
}
|
||||
definition_.elementSets.push_back(std::move(set));
|
||||
definition_.element_sets.push_back(std::move(set));
|
||||
}
|
||||
definition_.instances.push_back(std::move(instance));
|
||||
}
|
||||
@@ -2281,61 +2281,61 @@ private:
|
||||
return;
|
||||
}
|
||||
if (rawSet.isNodeSet) {
|
||||
definition_.nodeSets.erase(
|
||||
definition_.node_sets.erase(
|
||||
std::remove_if(
|
||||
definition_.nodeSets.begin(),
|
||||
definition_.nodeSets.end(),
|
||||
definition_.node_sets.begin(),
|
||||
definition_.node_sets.end(),
|
||||
[&rawSet](const NodeSet& set) {
|
||||
return equalName(set.name, rawSet.name);
|
||||
}),
|
||||
definition_.nodeSets.end());
|
||||
definition_.node_sets.end());
|
||||
NodeSet set{
|
||||
rawSet.name, definitionInstance->name, {}, rawSet.location};
|
||||
for (const auto member : rawSet.members) {
|
||||
const auto mapping = std::find_if(
|
||||
definitionInstance->nodeMappings.begin(),
|
||||
definitionInstance->nodeMappings.end(),
|
||||
definitionInstance->node_mappings.begin(),
|
||||
definitionInstance->node_mappings.end(),
|
||||
[member](const SourceIndexMapping& value) {
|
||||
return value.sourceLabel == member;
|
||||
return value.source_label == member;
|
||||
});
|
||||
if (mapping == definitionInstance->nodeMappings.end()) {
|
||||
if (mapping == definitionInstance->node_mappings.end()) {
|
||||
inputFailure(
|
||||
"unresolved-reference", rawSet.location,
|
||||
"NSET", rawSet.name,
|
||||
"Assembly node-set member must resolve in its instance.");
|
||||
return;
|
||||
}
|
||||
set.nodeIndices.push_back(mapping->internalIndex);
|
||||
set.node_indices.push_back(mapping->internal_index);
|
||||
}
|
||||
definition_.nodeSets.push_back(std::move(set));
|
||||
definition_.node_sets.push_back(std::move(set));
|
||||
} else {
|
||||
definition_.elementSets.erase(
|
||||
definition_.element_sets.erase(
|
||||
std::remove_if(
|
||||
definition_.elementSets.begin(),
|
||||
definition_.elementSets.end(),
|
||||
definition_.element_sets.begin(),
|
||||
definition_.element_sets.end(),
|
||||
[&rawSet](const ElementSet& set) {
|
||||
return equalName(set.name, rawSet.name);
|
||||
}),
|
||||
definition_.elementSets.end());
|
||||
definition_.element_sets.end());
|
||||
ElementSet set{
|
||||
rawSet.name, definitionInstance->name, {}, rawSet.location};
|
||||
for (const auto member : rawSet.members) {
|
||||
const auto mapping = std::find_if(
|
||||
definitionInstance->elementMappings.begin(),
|
||||
definitionInstance->elementMappings.end(),
|
||||
definitionInstance->element_mappings.begin(),
|
||||
definitionInstance->element_mappings.end(),
|
||||
[member](const SourceIndexMapping& value) {
|
||||
return value.sourceLabel == member;
|
||||
return value.source_label == member;
|
||||
});
|
||||
if (mapping == definitionInstance->elementMappings.end()) {
|
||||
if (mapping == definitionInstance->element_mappings.end()) {
|
||||
inputFailure(
|
||||
"unresolved-reference", rawSet.location,
|
||||
"ELSET", rawSet.name,
|
||||
"Assembly element-set member must resolve in its instance.");
|
||||
return;
|
||||
}
|
||||
set.elementIndices.push_back(mapping->internalIndex);
|
||||
set.element_indices.push_back(mapping->internal_index);
|
||||
}
|
||||
definition_.elementSets.push_back(std::move(set));
|
||||
definition_.element_sets.push_back(std::move(set));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2345,7 +2345,7 @@ private:
|
||||
const SourceLocation& location,
|
||||
const std::string& keyword) {
|
||||
std::vector<const NodeSet*> matchingSets;
|
||||
for (const auto& set : definition_.nodeSets) {
|
||||
for (const auto& set : definition_.node_sets) {
|
||||
if (equalName(set.name, target)) {
|
||||
matchingSets.push_back(&set);
|
||||
}
|
||||
@@ -2357,7 +2357,7 @@ private:
|
||||
for (std::size_t index = 0U;
|
||||
index < definition_.nodes.size();
|
||||
++index) {
|
||||
if (definition_.nodes[index].sourceId.source_label == label) {
|
||||
if (definition_.nodes[index].source_id.source_label == label) {
|
||||
matchingNodes.push_back(static_cast<EntityIndex>(index));
|
||||
}
|
||||
}
|
||||
@@ -2385,7 +2385,7 @@ private:
|
||||
return std::nullopt;
|
||||
}
|
||||
if (matchingSets.size() == 1U) {
|
||||
return matchingSets.front()->nodeIndices;
|
||||
return matchingSets.front()->node_indices;
|
||||
}
|
||||
if (matchingNodes.size() == 1U) {
|
||||
return matchingNodes;
|
||||
@@ -2409,7 +2409,7 @@ private:
|
||||
return;
|
||||
}
|
||||
for (const auto node : *target) {
|
||||
for (int dof = boundary.firstDof; dof <= boundary.lastDof; ++dof) {
|
||||
for (int dof = boundary.first_dof; dof <= boundary.last_dof; ++dof) {
|
||||
const auto key = std::make_pair(node, dof);
|
||||
const auto existing = prescribedValues.find(key);
|
||||
if (existing != prescribedValues.end() &&
|
||||
|
||||
Reference in New Issue
Block a user