feat(cpp-object-oriented-modular-refactoring): step 19 - boundary-condition-policy

This commit is contained in:
KOKO\Mimi
2026-08-16 11:23:20 +09:00
parent f26e0a61a8
commit 64a43948ef
27 changed files with 919 additions and 365 deletions
@@ -0,0 +1,43 @@
#ifndef FESA_CONSTRAINTS_ESSENTIAL_CONSTRAINT_POLICY_H_
#define FESA_CONSTRAINTS_ESSENTIAL_CONSTRAINT_POLICY_H_
#include "fesa/core/status.h"
#include "fesa/math/sparse_matrix.h"
#include "fesa/math/vector.h"
namespace fesa {
class DofManager;
/// @brief Stores full-stiffness blocks in stable free/constrained order.
struct PartitionedStiffness {
SparseMatrix k_ff;
SparseMatrix k_fc;
SparseMatrix k_cf;
SparseMatrix k_cc;
};
/// @brief Applies stable prescribed-displacement elimination.
class EssentialConstraintPolicy {
public:
/// @brief Partitions full stiffness into Kff, Kfc, Kcf, and Kcc.
Result<PartitionedStiffness> Partition(const SparseMatrix& full_stiffness,
const DofManager& dof_manager) const;
/// @brief Gathers a full vector in stable free-equation order.
Vector GatherFree(const Vector& full_values,
const DofManager& dof_manager) const;
/// @brief Gathers a full vector in stable constrained-DOF order.
Vector GatherConstrained(const Vector& full_values,
const DofManager& dof_manager) const;
/// @brief Reconstructs full d from stable df and exact prescribed dc.
Vector ReconstructFull(const Vector& free_values,
const Vector& constrained_values,
const DofManager& dof_manager) const;
};
} // namespace fesa
#endif // FESA_CONSTRAINTS_ESSENTIAL_CONSTRAINT_POLICY_H_