Files
FESADev/include/fesa/constraints/essential_constraint_policy.h

44 lines
1.4 KiB
C++

#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_