state.hpp span utility vector serif/discretization/blocks/vector_view.hpp src/compile_time_checks/serif/model/state.cpp src/include/serif/backend/mfem/model/state.hpp src/include/serif/backend/mfem/solver/admissibility/geometry.hpp src/include/serif/backend/mfem/solver/seed/state.hpp src/include/serif/model/model.hpp src/include/serif/utils/serialize/model.hpp serif::model::StellarState serif serif::model #pragmaonce #include<span> #include<utility> #include<vector> #include"serif/discretization/blocks/vector_view.hpp" namespaceserif::model{ template<discretization::blocks::SystemLayoutTypeLayoutT> structStellarStatefinal{ usingLayout=std::remove_cvref_t<LayoutT>; explicitStellarState(Layoutlayout):m_layout(std::move(layout)), m_values(m_layout.templatetotal_size<discretization::blocks::RepresentedValueKind::value>()){ } StellarState(Layoutlayout,std::vector<double>values):m_layout(std::move(layout)),m_values(std::move(values)){ (void)discretization::blocks::StateView<Layout>(m_layout,std::span<double>{m_values}); } [[nodiscard]]constLayout&layout()const&noexcept{ returnm_layout; } constLayout&layout()const&&=delete; template<typenameTerm>requiresutils::dependencies::ContainsKey<Term, typename Layout::Values> [[nodiscard]]std::span<double>get()&{ returndiscretization::blocks::StateView<Layout>(m_layout,std::span<double>{m_values}).templateget<Term>(); } template<typenameTerm>requiresutils::dependencies::ContainsKey<Term, typename Layout::Values> [[nodiscard]]std::span<constdouble>get()const&{ returndiscretization::blocks::StateView<Layout, const double>(m_layout,std::span<constdouble>{m_values}).templateget<Term>(); } template<typenameTerm> std::span<constdouble>get()const&&=delete; [[nodiscard]]std::span<double>values()&noexcept{ returnm_values; } [[nodiscard]]std::span<constdouble>values()const&noexcept{ returnm_values; } std::span<constdouble>values()const&&=delete; private: Layoutm_layout; std::vector<double>m_values; }; template<discretization::blocks::SystemLayoutTypeLayout> StellarState(Layout)->StellarState<std::remove_cvref_t<Layout>>; template<discretization::blocks::SystemLayoutTypeLayout> StellarState(Layout,std::vector<double>)->StellarState<std::remove_cvref_t<Layout>>; }