feat(cpp-object-oriented-modular-refactoring): step 5 - solver-workflow-google-style

This commit is contained in:
KOKO\Mimi
2026-08-16 06:20:08 +09:00
parent e1c0e357dd
commit 24f006fe4a
52 changed files with 5817 additions and 6369 deletions
+29
View File
@@ -0,0 +1,29 @@
#ifndef FESA_ASSEMBLY_LOAD_ASSEMBLER_H_
#define FESA_ASSEMBLY_LOAD_ASSEMBLER_H_
#include "fesa/analysis/analysis_model.h"
#include "fesa/fem/dof_manager.h"
#include "fesa/math/sparse_matrix.h"
#include "fesa/math/vector.h"
namespace fesa {
/// @brief Assembles semantic nodal loads in stable source order.
class LoadAssembler {
public:
/// @brief Accumulates all active CLOAD rows in full-DOF space.
/// @return A finite full load vector or a structured model failure.
static Result<Vector> AssembleFullNodalLoad(const AnalysisModel& model,
const DofManager& dofs);
/// @brief Forms Ff-Kfc*dc in stable free/constrained order.
/// @note This operation neither factorizes nor invokes a solver.
static Result<Vector> EffectiveFreeRhs(const Vector& full_load,
const SparseMatrix& kfc,
const Vector& prescribed_values,
const DofManager& dofs);
};
} // namespace fesa
#endif // FESA_ASSEMBLY_LOAD_ASSEMBLER_H_
-24
View File
@@ -1,24 +0,0 @@
#pragma once
#include "fesa/analysis/analysis_model.hpp"
#include "fesa/fem/dof_manager.hpp"
#include "fesa/math/sparse_matrix.h"
#include "fesa/math/vector.h"
namespace fesa {
// Assembles only semantic nodal CLOAD records and forms the eliminated free
// right-hand side; stiffness factorization remains an analysis responsibility.
class LoadAssembler {
public:
static Result<Vector> assembleFullNodalLoad(
const AnalysisModel& model,
const DofManager& dofs);
static Result<Vector> effectiveFreeRhs(
const Vector& fullLoad,
const SparseMatrix& kfc,
const Vector& prescribedValues,
const DofManager& dofs);
};
} // namespace fesa
+39
View File
@@ -0,0 +1,39 @@
#ifndef FESA_ASSEMBLY_PARALLEL_FOR_H_
#define FESA_ASSEMBLY_PARALLEL_FOR_H_
#include <cstddef>
#include <functional>
namespace fesa {
/// @brief Executes independent index-addressed work behind a backend boundary.
/// @note Callers own output storage and each invocation may write only its
/// index-owned slot.
class ParallelFor {
public:
virtual ~ParallelFor() = default;
/// @brief Invokes body once for every index in [0, count).
virtual void Execute(std::size_t count,
const std::function<void(std::size_t)>& body) const = 0;
};
/// @brief Executes index-addressed work serially.
class SerialParallelFor final : public ParallelFor {
public:
/// @copydoc ParallelFor::Execute
void Execute(std::size_t count,
const std::function<void(std::size_t)>& body) const override;
};
/// @brief Executes index-addressed work through oneTBB.
class TbbParallelFor final : public ParallelFor {
public:
/// @copydoc ParallelFor::Execute
void Execute(std::size_t count,
const std::function<void(std::size_t)>& body) const override;
};
} // namespace fesa
#endif // FESA_ASSEMBLY_PARALLEL_FOR_H_
-32
View File
@@ -1,32 +0,0 @@
#pragma once
#include <cstddef>
#include <functional>
namespace fesa {
// Executes independent index-addressed work without exposing the backend.
// Callers own output storage and must confine each invocation to its index.
class ParallelFor {
public:
virtual ~ParallelFor() = default;
virtual void execute(
std::size_t count,
const std::function<void(std::size_t)>& body) const = 0;
};
class SerialParallelFor final : public ParallelFor {
public:
void execute(
std::size_t count,
const std::function<void(std::size_t)>& body) const override;
};
class TbbParallelFor final : public ParallelFor {
public:
void execute(
std::size_t count,
const std::function<void(std::size_t)>& body) const override;
};
} // namespace fesa
+27
View File
@@ -0,0 +1,27 @@
#ifndef FESA_ASSEMBLY_SPARSE_ASSEMBLER_H_
#define FESA_ASSEMBLY_SPARSE_ASSEMBLER_H_
#include "fesa/core/status.h"
#include "fesa/math/sparse_matrix.h"
namespace fesa {
class AnalysisModel;
class DofManager;
class ParallelFor;
/// @brief Owns deterministic element-contribution reduction into global CSR.
class SparseAssembler {
public:
/// @brief Assembles stiffness in stable source-element and local-entry order.
/// @return A validated full-DOF CSR matrix or structured model failure.
/// @note Parallel workers produce index-owned local buffers; serial reduction
/// remains the sole global CSR writer.
static Result<SparseMatrix> AssembleStiffness(
const AnalysisModel& model, const DofManager& dofs,
const ParallelFor& parallel_for);
};
} // namespace fesa
#endif // FESA_ASSEMBLY_SPARSE_ASSEMBLER_H_
@@ -1,20 +0,0 @@
#pragma once
#include "fesa/core/status.h"
#include "fesa/math/sparse_matrix.h"
namespace fesa {
class AnalysisModel;
class DofManager;
class ParallelFor;
class SparseAssembler {
public:
static Result<SparseMatrix> assembleStiffness(
const AnalysisModel& model,
const DofManager& dofs,
const ParallelFor& parallelFor);
};
} // namespace fesa