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