feat(cpp-object-oriented-modular-refactoring): step 18 - load-hierarchy

This commit is contained in:
KOKO\Mimi
2026-08-16 10:56:57 +09:00
parent 08d352ae46
commit 9ad72e6d21
18 changed files with 705 additions and 137 deletions
@@ -0,0 +1,52 @@
#ifndef FESA_LOADS_CONCENTRATED_NODAL_LOAD_H_
#define FESA_LOADS_CONCENTRATED_NODAL_LOAD_H_
#include <array>
#include <cstddef>
#include "fesa/core/diagnostic.h"
#include "fesa/loads/load.h"
#include "fesa/model/source_target_resolver.h"
namespace fesa {
/// @brief Emits global concentrated nodal components for one source target.
class ConcentratedNodalLoad final : public Load {
public:
/// @brief Creates a six-component global concentrated nodal load.
ConcentratedNodalLoad(SourceTargetQuery target,
std::array<double, 6> global_components,
std::size_t source_order);
/// @brief Creates one parsed CLOAD component while preserving diagnostics.
ConcentratedNodalLoad(SourceTargetQuery target, int source_dof,
double magnitude, std::size_t source_order,
SourceLocation location);
/// @brief Computes target-major, component-minor full-DOF contributions.
Result<std::vector<LoadContribution>> ComputeContributions(
const LoadContext& context) const override;
/// @brief Returns the immutable source target query.
const SourceTargetQuery& Target() const noexcept;
/// @brief Returns six global force/moment components without reordering.
const std::array<double, 6>& GlobalComponents() const noexcept;
/// @brief Returns the stable CLOAD declaration order.
std::size_t SourceOrder() const noexcept;
/// @brief Returns the source location used by structured diagnostics.
const SourceLocation& Location() const noexcept;
private:
SourceTargetQuery target_;
std::array<double, 6> global_components_{};
std::size_t source_order_;
SourceLocation location_{};
int source_dof_{0};
};
} // namespace fesa
#endif // FESA_LOADS_CONCENTRATED_NODAL_LOAD_H_
+48
View File
@@ -0,0 +1,48 @@
#ifndef FESA_LOADS_LOAD_H_
#define FESA_LOADS_LOAD_H_
#include <cstddef>
#include <functional>
#include <vector>
#include "fesa/core/status.h"
namespace fesa {
class DofManager;
class Domain;
class SourceTargetResolver;
/// @brief Describes one ordered contribution to the full load vector.
struct LoadContribution {
std::size_t source_order;
std::size_t full_dof_index;
double value;
};
/// @brief Provides immutable semantic and equation context to a Load.
/// @note Every referenced object must outlive a contribution request.
struct LoadContext {
const Domain& domain;
const DofManager& dof_manager;
const SourceTargetResolver& target_resolver;
};
/// @brief Produces local ordered load contributions without global mutation.
class Load {
public:
virtual ~Load() = default;
/// @brief Computes finite full-DOF contributions in stable target order.
/// @param context Non-owning semantic and equation context for this call.
/// @return Ordered contributions or a structured model failure.
virtual Result<std::vector<LoadContribution>> ComputeContributions(
const LoadContext& context) const = 0;
};
/// @brief Holds non-owning loads in an explicitly supplied source order.
using LoadView = std::vector<std::reference_wrapper<const Load>>;
} // namespace fesa
#endif // FESA_LOADS_LOAD_H_