#ifndef FESA_ASSEMBLY_THERMAL_ASSEMBLER_H_ #define FESA_ASSEMBLY_THERMAL_ASSEMBLER_H_ #include #include #include #include "fesa/analysis/analysis_model.h" #include "fesa/assembly/parallel_for.h" #include "fesa/elements/element_capabilities.h" #include "fesa/elements/thermal_shell.h" #include "fesa/fem/dof_manager.h" #include "fesa/math/sparse_matrix.h" #include "fesa/results/thermal_result_records.h" namespace fesa { class ThermalAssembly; /// @brief Builds full K,C,Q from checked DS4 kernels in deterministic source /// order. /// @note Domain must outlive the returned assembly; neither model nor dofs is /// retained. Workers write index-owned buffers only. Failures are selected in /// element order. Result AssembleThermal(const AnalysisModel& model, const DofManager& dofs, const ParallelFor& parallel_for); /// @brief Owns full-space operators and local kernels for a fixed thermal /// Domain. /// @note The original Domain must remain alive and unmoved for this object's /// lifetime. class ThermalAssembly final { public: /// @brief Returns full conductivity [power/temperature] in canonical CSR /// order. const SparseMatrix& Conductivity() const noexcept; /// @brief Returns full consistent capacity [energy/temperature]. const SparseMatrix& Capacity() const noexcept; /// @brief Returns signed full nodal input [power], including prescribed /// targets. const Vector& HeatInput() const noexcept; /// @brief Bounds local interval error plus ordered summation roundoff /// entrywise. /// @note Excludes quadrature truncation and physical model error. const SparseMatrix& ConductivityError() const noexcept; /// @copydoc ConductivityError const SparseMatrix& CapacityError() const noexcept; /// @brief Bounds source-row input summation roundoff entrywise, in power /// units. const Vector& HeatInputError() const noexcept; /// @brief Returns original Domain element IDs in local-kernel/flux row order. const std::vector& ElementOrder() const noexcept; /// @brief Returns checked kernels in stable active element order. const std::vector& Kernels() const noexcept; /// @brief Returns typed views bound after the final kernel buffer is placed. const std::vector>& Elements() const noexcept; /// @brief Returns node-major twenty-entry full DOF scatters in kernel order. const std::vector>& Scatters() const noexcept; /// @brief Checks source Domain identity and the complete supplied equation /// map. Status ValidateFor(const AnalysisModel& model, const DofManager& dofs) const; /// @brief Recovers ordered element-global fluxes from a finite full /// temperature. Result> RecoverFlux( const Vector& temperature, const ParallelFor& parallel_for) const; private: friend Result AssembleThermal(const AnalysisModel&, const DofManager&, const ParallelFor&); /// @brief Takes completed immutable operators after validation and reduction. ThermalAssembly(const Domain& domain, SparseMatrix conductivity, SparseMatrix capacity, Vector input, SparseMatrix conductivity_error, SparseMatrix capacity_error, Vector input_error, std::vector element_order, std::vector kernels, std::vector> scatters); const Domain* domain_; SparseMatrix conductivity_; SparseMatrix capacity_; Vector input_; SparseMatrix conductivity_error_; SparseMatrix capacity_error_; Vector input_error_; std::vector element_order_; // Never resized after construction. Moving the owning vector transfers its // buffer, so bound references survive ThermalAssembly moves. std::vector kernels_; std::vector> elements_; std::vector> scatters_; }; } // namespace fesa #endif // FESA_ASSEMBLY_THERMAL_ASSEMBLER_H_