#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 Partition(const SparseMatrix& full_stiffness, const DofManager& dof_manager) const; /// @brief Forms Ff-Kfc*dc in stable free/constrained order. /// @return A finite RHS candidate or the established load diagnostic. /// @note Preserves independent CSR products and ordered row reductions; /// no factorization or solver operation is performed. Inputs are borrowed /// only for this call and remain unchanged on failure. Result EffectiveFreeRhs(const Vector& full_load, const SparseMatrix& kfc, const Vector& prescribed_values, const DofManager& dofs) 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_