SpECTRE Documentation Coverage Report
Current view: top level - ParallelAlgorithms/Amr/Policies - Policies.hpp Hit Total Coverage
Commit: 1f2210958b4f38fdc0400907ee7c6d5af5111418 Lines: 5 29 17.2 %
Date: 2025-12-05 05:03:31
Legend: Lines: hit not hit

          Line data    Source code
       1           0 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : #pragma once
       5             : 
       6             : #include "Options/String.hpp"
       7             : #include "ParallelAlgorithms/Amr/Policies/Isotropy.hpp"
       8             : #include "ParallelAlgorithms/Amr/Policies/Limits.hpp"
       9             : #include "Utilities/TMPL.hpp"
      10             : 
      11             : /// \cond
      12             : namespace PUP {
      13             : class er;
      14             : }  // namespace PUP
      15             : /// \endcond
      16             : 
      17             : namespace amr {
      18             : /// \brief A set of runtime policies controlling adaptive mesh refinement
      19           1 : class Policies {
      20             :  public:
      21             :   /// The isotropy of AMR
      22           1 :   struct Isotropy {
      23           0 :     using type = amr::Isotropy;
      24           0 :     static constexpr Options::String help = {
      25             :         "Isotropy of adaptive mesh refinement (whether or not each dimension "
      26             :         "can be refined independently)."};
      27             :   };
      28             : 
      29             :   /// The limits on refinement level and resolution for AMR
      30           1 :   struct Limits {
      31           0 :     using type = amr::Limits;
      32           0 :     static constexpr Options::String help = {
      33             :         "Limits on refinement level and resolution for adaptive mesh "
      34             :         "refinement."};
      35             :   };
      36             : 
      37             :   /// Whether or not to enforce 2:1 balance in the direction normal to element
      38             :   /// faces
      39           1 :   struct EnforceTwoToOneBalanceInNormalDirection {
      40           0 :     using type = bool;
      41           0 :     static constexpr Options::String help = {
      42             :         "Whether or not to enforce 2:1 balance in the direction normal to "
      43             :         "element faces."};
      44             :   };
      45             : 
      46             :   /// Whether or not to allow coarsening or only refining
      47           1 :   struct AllowCoarsening {
      48           0 :     using type = bool;
      49           0 :     static constexpr Options::String help = {
      50             :         "Whether or not to allow coarsening or only refining."};
      51             :   };
      52             : 
      53           0 :   using options =
      54             :       tmpl::list<Isotropy, Limits, EnforceTwoToOneBalanceInNormalDirection,
      55             :                  AllowCoarsening>;
      56             : 
      57           0 :   static constexpr Options::String help = {
      58             :       "Policies controlling adaptive mesh refinement."};
      59             : 
      60           0 :   Policies() = default;
      61             : 
      62           0 :   Policies(amr::Isotropy isotropy, const amr::Limits& limits,
      63             :            bool enforce_two_to_one_balance_in_normal_direction,
      64             :            bool allow_coarsening);
      65             : 
      66           0 :   amr::Isotropy isotropy() const { return isotropy_; }
      67             : 
      68           0 :   amr::Limits limits() const { return limits_; }
      69             : 
      70           0 :   bool enforce_two_to_one_balance_in_normal_direction() const {
      71             :     return enforce_two_to_one_balance_in_normal_direction_;
      72             :   }
      73             : 
      74           0 :   bool allow_coarsening() const { return allow_coarsening_; }
      75             : 
      76           0 :   void pup(PUP::er& p);
      77             : 
      78             :  private:
      79           0 :   amr::Isotropy isotropy_{amr::Isotropy::Anisotropic};
      80           0 :   amr::Limits limits_{};
      81           0 :   bool enforce_two_to_one_balance_in_normal_direction_{true};
      82           0 :   bool allow_coarsening_{true};
      83             : };
      84             : 
      85           0 : bool operator==(const Policies& lhs, const Policies& rhs);
      86             : 
      87           0 : bool operator!=(const Policies& lhs, const Policies& rhs);
      88             : }  // namespace amr

Generated by: LCOV version 1.14