feat(equation-and-linear-solve): step 0 — symmetric-csr-assembly

This commit is contained in:
KOKO\Mimi
2026-07-31 15:45:02 +09:00
parent d393402174
commit 8342774c82
12 changed files with 712 additions and 2 deletions
+14
View File
@@ -0,0 +1,14 @@
#pragma once
#include <vector>
#include <fesa/assembly/symmetric_csr.hpp>
namespace fesa {
struct EquationSystem final {
SymmetricCsr stiffness;
std::vector<double> force;
};
} // namespace fesa
@@ -0,0 +1,13 @@
#pragma once
#include <fesa/assembly/equation_system.hpp>
#include <fesa/fem/dof_manager.hpp>
#include <fesa/model/domain.hpp>
namespace fesa {
[[nodiscard]] EquationSystem assemble_serial(
const Domain& domain,
const DofManager& dofs);
} // namespace fesa
+18
View File
@@ -0,0 +1,18 @@
#pragma once
#include <cstddef>
#include <cstdint>
#include <vector>
namespace fesa {
// Zero-based CSR containing only the upper triangle. Column indices are
// strictly increasing within each row.
struct SymmetricCsr final {
std::size_t order;
std::vector<std::int32_t> row_offsets;
std::vector<std::int32_t> column_indices;
std::vector<double> values;
};
} // namespace fesa
+1 -1
View File
@@ -34,13 +34,13 @@ public:
[[nodiscard]] std::size_t free_equation_count() const noexcept;
[[nodiscard]] std::optional<std::size_t> equation(
DofAddress address) const;
[[nodiscard]] std::size_t full_dof(DofAddress address) const;
[[nodiscard]] std::array<std::size_t, 12> element_full_dofs(
const BeamElement& element) const;
[[nodiscard]] std::vector<double> reconstruct_full(
std::span<const double> reduced) const;
private:
[[nodiscard]] std::size_t full_dof(DofAddress address) const;
[[nodiscard]] std::size_t node_full_dof_base(NodeId node) const;
std::map<std::int64_t, std::size_t> node_full_dof_bases_;
+2
View File
@@ -57,6 +57,8 @@ public:
[[nodiscard]] const Node& node(NodeId id) const;
[[nodiscard]] const Node& node(const EntityOrigin& origin) const;
[[nodiscard]] const IsotropicElastic& material(MaterialId id) const;
[[nodiscard]] const BeamSection& section(SectionId id) const;
private:
friend class DomainBuilder;