#pragma once /** * @file policy.hpp * @author Emily M. Boudreaux * * @brief File containing the Policy class. This class is used to determine the appropriate order and other relevant information for the integration rule based on a given quadrature query. */ #include "serif/discretization/quadrature/query.hpp" #include "serif/discretization/quadrature/rules.hpp" namespace serif::discretization::quadrature { /** * @brief The Policy class is used to determine the appropriate order and other relevant information for the integration rule based on a given quadrature query. It uses a RuleSet to determine the appropriate order and other relevant information for the integration rule. */ class Policy final { public: /** * @brief Constructs a Policy with the given RuleSet. * * @param ruleSet The RuleSet used to determine the appropriate order and other relevant information for the integration rule. */ explicit Policy(RuleSet ruleSet); /** * @brief Resolves the appropriate order and other relevant information for the integration rule based on the given quadrature query. * * @param query The quadrature query used to determine the appropriate order and other relevant information for the integration rule. * @return The resolution containing the appropriate order and other relevant information for the integration rule. */ [[nodiscard]] Resolution resolve(const Query &query) const; /** @brief Inspect the authored quadrature controls without changing preparation. */ [[nodiscard]] const RuleSet& rules() const noexcept { return m_ruleSet; } private: /** * @brief Computes the base order for the given quadrature query. This is used to determine the appropriate order for the integration rule. * * @param query The quadrature query used to determine the base order. * @return The base order for the given quadrature query. */ [[nodiscard]] static int compute_base_order(const Query &query); /** * @brief Retrieves the RuleControl for the given quadrature role. This is used to determine the appropriate order and other relevant information for the integration rule. * * @param role The quadrature role used to retrieve the RuleControl. * @return The RuleControl for the given quadrature role. */ [[nodiscard]] const RuleControl &get_role_control(QuadratureRole role) const; private: RuleSet m_ruleSet; ///< The RuleSet used to determine the appropriate order and other relevant information for the integration rule. }; }