feat(cpp-object-oriented-modular-refactoring): step 19 - boundary-condition-policy
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
#ifndef FESA_CONSTRAINTS_BOUNDARY_CONDITION_H_
|
||||
#define FESA_CONSTRAINTS_BOUNDARY_CONDITION_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "fesa/core/diagnostic.h"
|
||||
#include "fesa/core/status.h"
|
||||
|
||||
namespace fesa {
|
||||
|
||||
class DofManager;
|
||||
class Domain;
|
||||
class SourceTargetResolver;
|
||||
|
||||
/// @brief Describes one prescribed value in stable full-DOF order.
|
||||
struct ConstraintDefinition {
|
||||
std::size_t source_order;
|
||||
std::size_t full_dof_index;
|
||||
double prescribed_value;
|
||||
};
|
||||
|
||||
/// @brief Provides immutable semantic and equation context to a boundary.
|
||||
/// @note Every referenced object must outlive a constraint request.
|
||||
struct BoundaryConditionContext {
|
||||
const Domain& domain;
|
||||
const DofManager& dof_manager;
|
||||
const SourceTargetResolver& target_resolver;
|
||||
};
|
||||
|
||||
/// @brief Produces ordered constraint definitions without equation mutation.
|
||||
class BoundaryCondition {
|
||||
public:
|
||||
virtual ~BoundaryCondition() = default;
|
||||
|
||||
/// @brief Resolves finite full-DOF definitions in stable target order.
|
||||
/// @param context Non-owning semantic and equation context for this call.
|
||||
/// @return Ordered definitions or a structured model failure.
|
||||
virtual Result<std::vector<ConstraintDefinition>> ResolveConstraints(
|
||||
const BoundaryConditionContext& context) const = 0;
|
||||
|
||||
/// @brief Returns the source location used by policy diagnostics.
|
||||
const SourceLocation& Location() const noexcept { return location_; }
|
||||
|
||||
/// @brief Returns the source target identity used by policy diagnostics.
|
||||
const std::string& TargetIdentity() const noexcept {
|
||||
return target_identity_;
|
||||
}
|
||||
|
||||
protected:
|
||||
/// @brief Creates a boundary with optional shared diagnostic provenance.
|
||||
BoundaryCondition(std::string target_identity = {},
|
||||
SourceLocation location = {})
|
||||
: target_identity_{std::move(target_identity)},
|
||||
location_{std::move(location)} {}
|
||||
|
||||
private:
|
||||
std::string target_identity_;
|
||||
SourceLocation location_;
|
||||
};
|
||||
|
||||
/// @brief Holds non-owning boundaries in an explicitly supplied source order.
|
||||
using BoundaryConditionView =
|
||||
std::vector<std::reference_wrapper<const BoundaryCondition>>;
|
||||
|
||||
} // namespace fesa
|
||||
|
||||
#endif // FESA_CONSTRAINTS_BOUNDARY_CONDITION_H_
|
||||
Reference in New Issue
Block a user