Integrate Refactor solver sources and dual MSVC CMake builds

This commit is contained in:
KOKO\Mimi
2026-10-18 02:10:51 +09:00
parent 7ee32e5837
commit 12d51480de
218 changed files with 17842 additions and 9689 deletions
@@ -0,0 +1,200 @@
#ifndef FESA_ELEMENTS_ELEMENT_CAPABILITIES_H_
#define FESA_ELEMENTS_ELEMENT_CAPABILITIES_H_
#include <array>
#include <cstddef>
#include "fesa/elements/element.h"
#include "fesa/elements/thermal_element_layout.h"
#include "fesa/math/vector3.h"
namespace fesa {
class Hex8Element;
class Mitc4Shell;
class NonlinearMitc4Shell;
class NonlinearMitc4Inertia;
class ThermalShell;
struct Hex8Response;
struct Hex8HighLowResponse;
struct Mitc4Stiffness;
struct Mitc4Mass;
struct NonlinearMitc4TrialDofs;
struct NonlinearMitc4InternalEquilibrium;
struct NonlinearMitc4ExternalDrillingConstraint;
struct NonlinearMitc4InertiaEvaluation;
struct ThermalShellRecovery;
/// @brief Evaluates immutable shell trials; accepted history belongs to the procedure.
class ShellTrialElement {
public:
virtual ~ShellTrialElement() = default;
/// @brief Returns stable source-local node/component order, never equations.
virtual const ElementDofLayout& DofLayout() const noexcept = 0;
/// @brief Returns the complete force/tangent/recovery at a fixed-global trial.
/// @param coordinate_direction Optional 24-vector for D2(f_int)[v,v].
/// @note Failure preserves the kernel, caller inputs and earlier responses.
virtual Result<NonlinearMitc4InternalEquilibrium> EvaluateTrial(
const NonlinearMitc4TrialDofs& trial,
const Vector* coordinate_direction = nullptr) const = 0;
/// @copydoc NonlinearMitc4Shell::EvaluateExternalDrillingConstraint
virtual Result<NonlinearMitc4ExternalDrillingConstraint>
EvaluateExternalDrillingConstraint(
std::size_t node, const Vector3& phi, const Vector3& phi_dot,
const Vector3& force, const Vector3& force_rate,
const Vector3& force_acceleration) const = 0;
};
/// @brief Borrows the same immutable shell kernel for every trial operation.
/// @note The kernel must outlive this adapter and remain at its bound address.
class Mitc4TrialAdapter final : public ShellTrialElement {
public:
Mitc4TrialAdapter(ElementDofLayout layout, const NonlinearMitc4Shell& kernel);
const ElementDofLayout& DofLayout() const noexcept override;
Result<NonlinearMitc4InternalEquilibrium> EvaluateTrial(
const NonlinearMitc4TrialDofs& trial,
const Vector* coordinate_direction = nullptr) const override;
Result<NonlinearMitc4ExternalDrillingConstraint>
EvaluateExternalDrillingConstraint(
std::size_t node, const Vector3& phi, const Vector3& phi_dot,
const Vector3& force, const Vector3& force_rate,
const Vector3& force_acceleration) const override;
private:
ElementDofLayout layout_;
const NonlinearMitc4Shell& kernel_;
};
/// @brief Keeps complete paired solid responses and reference mass typed.
class SolidTrialElement : public Element {
public:
~SolidTrialElement() override = default;
/// @copydoc Hex8Element::EvaluateLinear
virtual Result<Hex8Response> EvaluateLinear(const Vector& u) const = 0;
/// @copydoc Hex8Element::EvaluateNonlinear
virtual Result<Hex8Response> EvaluateNonlinear(const Vector& u) const = 0;
/// @copydoc Hex8Element::EvaluateLinearHighLow
virtual Result<Hex8HighLowResponse> EvaluateLinearHighLow(
const Vector& high, const Vector& low) const = 0;
/// @copydoc Hex8Element::EvaluateNonlinearHighLow
virtual Result<Hex8HighLowResponse> EvaluateNonlinearHighLow(
const Vector& high, const Vector& low) const = 0;
/// @copydoc Hex8Element::ComputeMass
virtual Result<ElementStiffnessContribution> ComputeMass() const = 0;
/// @brief Returns fixed Gauss weights used by the frequency mass bound.
virtual std::array<double, 8> ReferenceWeights() const noexcept = 0;
};
/// @brief Borrows one stable Hex8 kernel shared by all local operations.
/// @note The kernel must outlive this adapter and remain at its bound address.
class Hex8TrialAdapter final : public SolidTrialElement {
public:
explicit Hex8TrialAdapter(const Hex8Element& kernel);
const ElementDofLayout& DofLayout() const noexcept override;
Result<ElementStiffnessContribution> ComputeStiffness() const override;
Result<ElementResultBundle> Recover(const Vector& u) const override;
Result<Hex8Response> EvaluateLinear(const Vector& u) const override;
Result<Hex8Response> EvaluateNonlinear(const Vector& u) const override;
Result<Hex8HighLowResponse> EvaluateLinearHighLow(
const Vector& high, const Vector& low) const override;
Result<Hex8HighLowResponse> EvaluateNonlinearHighLow(
const Vector& high, const Vector& low) const override;
Result<ElementStiffnessContribution> ComputeMass() const override;
std::array<double, 8> ReferenceWeights() const noexcept override;
private:
const Hex8Element& kernel_;
};
/// @brief Returns the complete physical inertia response in fixed chart DOFs.
class ShellInertiaElement {
public:
virtual ~ShellInertiaElement() = default;
virtual const ElementDofLayout& DofLayout() const noexcept = 0;
/// @copydoc NonlinearMitc4Inertia::Evaluate
virtual Result<NonlinearMitc4InertiaEvaluation> Evaluate(
const NonlinearMitc4TrialDofs& trial, const Vector& velocity24,
const Vector& physical_acceleration24) const = 0;
};
/// @brief Borrows immutable inertia geometry, never shared mutable scratch.
/// @note The kernel must outlive this adapter and remain at its bound address.
class Mitc4InertiaAdapter final : public ShellInertiaElement {
public:
Mitc4InertiaAdapter(ElementDofLayout layout,
const NonlinearMitc4Inertia& kernel);
const ElementDofLayout& DofLayout() const noexcept override;
Result<NonlinearMitc4InertiaEvaluation> Evaluate(
const NonlinearMitc4TrialDofs& trial, const Vector& velocity24,
const Vector& physical_acceleration24) const override;
private:
ElementDofLayout layout_;
const NonlinearMitc4Inertia& kernel_;
};
/// @brief Keeps DS4 DOFs 11-15 and all four-by-six flux traces independent.
class ThermalElement {
public:
virtual ~ThermalElement() = default;
/// @brief Returns node-major stations 11-15 and original source identity.
virtual const ThermalElementDofLayout& DofLayout() const noexcept = 0;
/// @copydoc ThermalShell::Conductivity
virtual const Matrix& Conductivity() const noexcept = 0;
/// @copydoc ThermalShell::Capacity
virtual const Matrix& Capacity() const noexcept = 0;
/// @copydoc ThermalShell::ConductivityError
virtual const Matrix& ConductivityError() const noexcept = 0;
/// @copydoc ThermalShell::CapacityError
virtual const Matrix& CapacityError() const noexcept = 0;
/// @copydoc ThermalShell::Recover
virtual Result<ThermalShellRecovery> Recover(
const std::array<double, 20>& temperature) const = 0;
};
/// @brief Borrows the same DS4 kernel for matrices, intervals and recovery.
/// @note The kernel must outlive this adapter and remain at its bound address.
class Ds4ThermalAdapter final : public ThermalElement {
public:
explicit Ds4ThermalAdapter(const ThermalShell& kernel);
const ThermalElementDofLayout& DofLayout() const noexcept override;
const Matrix& Conductivity() const noexcept override;
const Matrix& Capacity() const noexcept override;
const Matrix& ConductivityError() const noexcept override;
const Matrix& CapacityError() const noexcept override;
Result<ThermalShellRecovery> Recover(
const std::array<double, 20>& temperature) const override;
private:
ThermalElementDofLayout layout_;
const ThermalShell& kernel_;
};
/// @brief Supplies shell frequency operators with their distinct mass contract.
class ShellReferenceElement : public Element {
public:
~ShellReferenceElement() override = default;
/// @copydoc Mitc4Shell::Stiffness
virtual Result<Mitc4Stiffness> Stiffness() const = 0;
/// @copydoc Mitc4Shell::Mass
virtual Result<Mitc4Mass> Mass(double density) const = 0;
};
/// @brief Borrows the same linear MITC4 kernel for stiffness and recovery.
/// @note The kernel must outlive this adapter and remain at its bound address.
class Mitc4ReferenceAdapter final : public ShellReferenceElement {
public:
explicit Mitc4ReferenceAdapter(const Mitc4Shell& kernel);
const ElementDofLayout& DofLayout() const noexcept override;
Result<ElementStiffnessContribution> ComputeStiffness() const override;
Result<ElementResultBundle> Recover(const Vector& u) const override;
Result<Mitc4Stiffness> Stiffness() const override;
Result<Mitc4Mass> Mass(double density) const override;
private:
const Mitc4Shell& kernel_;
};
} // namespace fesa
#endif // FESA_ELEMENTS_ELEMENT_CAPABILITIES_H_