feat(cpp-object-oriented-modular-refactoring): step 4 - model-element-google-style

This commit is contained in:
KOKO\Mimi
2026-08-16 05:37:40 +09:00
parent 34ab8b5bf1
commit 8bc0ea2f8e
46 changed files with 5184 additions and 5323 deletions
+16 -16
View File
@@ -37,16 +37,16 @@ bool tryPositiveInteger(const std::string& text, std::int64_t& value) {
std::vector<EntityIndex> expandBoundaryTarget(
const Domain& domain, const BoundaryCondition& boundary) {
for (const auto& set : domain.nodeSets()) {
for (const auto& set : domain.NodeSets()) {
if (equalName(set.name, boundary.target)) {
return set.nodeIndices;
return set.node_indices;
}
}
std::int64_t sourceLabel = 0;
if (tryPositiveInteger(boundary.target, sourceLabel)) {
for (std::size_t node = 0U; node < domain.nodes().size(); ++node) {
if (domain.nodes()[node].sourceId.source_label == sourceLabel) {
for (std::size_t node = 0U; node < domain.Nodes().size(); ++node) {
if (domain.Nodes()[node].source_id.source_label == sourceLabel) {
return {static_cast<EntityIndex>(node)};
}
}
@@ -96,15 +96,15 @@ SparsePattern buildSparsePattern(
Result<DofManager> DofManager::create(const AnalysisModel& model) {
const Domain& domain = model.domain();
const std::size_t fullCount = domain.nodes().size() * dofsPerNode;
const std::size_t fullCount = domain.Nodes().size() * dofsPerNode;
std::vector<std::optional<double>> prescribedByFullDof(fullCount);
for (const EntityIndex boundaryIndex : model.activeBoundaryConditions()) {
const auto& boundary = model.step().boundaries.at(boundaryIndex);
const auto target = expandBoundaryTarget(domain, boundary);
for (const EntityIndex node : target) {
for (int component = boundary.firstDof;
component <= boundary.lastDof;
for (int component = boundary.first_dof;
component <= boundary.last_dof;
++component) {
const std::size_t fullDof =
static_cast<std::size_t>(node) * dofsPerNode +
@@ -150,12 +150,12 @@ Result<DofManager> DofManager::create(const AnalysisModel& model) {
}
std::vector<std::array<std::size_t, 12>> elementScatters(
domain.elements().size());
domain.Elements().size());
for (const EntityIndex elementIndex : model.activeElements()) {
const auto& element = domain.elements().at(elementIndex);
const auto& element = domain.Elements().at(elementIndex);
auto& scatter = elementScatters.at(elementIndex);
for (std::size_t endpoint = 0U; endpoint < element.nodeIndices.size(); ++endpoint) {
const std::size_t node = element.nodeIndices[endpoint];
for (std::size_t endpoint = 0U; endpoint < element.node_indices.size(); ++endpoint) {
const std::size_t node = element.node_indices[endpoint];
for (std::size_t component = 0U; component < dofsPerNode; ++component) {
scatter[endpoint * dofsPerNode + component] =
node * dofsPerNode + component;
@@ -164,16 +164,16 @@ Result<DofManager> DofManager::create(const AnalysisModel& model) {
}
std::vector<std::array<std::size_t, 24>> shellElementScatters(
domain.shellElements().size());
domain.ShellElements().size());
for (std::size_t elementIndex = 0U;
elementIndex < domain.shellElements().size();
elementIndex < domain.ShellElements().size();
++elementIndex) {
const auto& element = domain.shellElements()[elementIndex];
const auto& element = domain.ShellElements()[elementIndex];
auto& scatter = shellElementScatters[elementIndex];
for (std::size_t nodePosition = 0U;
nodePosition < element.nodeIndices.size();
nodePosition < element.node_indices.size();
++nodePosition) {
const std::size_t node = element.nodeIndices[nodePosition];
const std::size_t node = element.node_indices[nodePosition];
for (std::size_t component = 0U;
component < dofsPerNode;
++component) {