SpECTRE Documentation Coverage Report
 Current view: top level - Elliptic/Systems/Poisson/BoundaryConditions - Robin.hpp Hit Total Coverage Commit: 990bc653376fc4a4068db06123ec02659d814816 Lines: 1 12 8.3 % Date: 2021-05-16 17:17:32 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 7 : #include 8 : #include 9 : 10 : #include "DataStructures/Tensor/TypeAliases.hpp" 11 : #include "Elliptic/BoundaryConditions/BoundaryCondition.hpp" 12 : #include "Options/Options.hpp" 13 : #include "Parallel/CharmPupable.hpp" 14 : #include "Utilities/Gsl.hpp" 15 : #include "Utilities/TMPL.hpp" 16 : 17 : /// \cond 18 : class DataVector; 19 : /// \endcond 20 : 21 0 : namespace Poisson::BoundaryConditions { 22 : namespace detail { 23 : 24 : struct RobinImpl { 25 : static constexpr Options::String help = 26 : "Robin boundary conditions a * u + b * n_i grad(u)^i = c. The boundary " 27 : "condition is imposed as Neumann-type (i.e. on n_i grad(u)^i) if abs(b) " 28 : "> 0 and as Dirichlet-type (i.e. on u) if b = 0."; 29 : 30 : struct DirichletWeight { 31 : using type = double; 32 : static constexpr Options::String help = "The parameter 'a'"; 33 : }; 34 : 35 : struct NeumannWeight { 36 : using type = double; 37 : static constexpr Options::String help = "The parameter 'b'"; 38 : }; 39 : 40 : struct Constant { 41 : using type = double; 42 : static constexpr Options::String help = "The parameter 'c'"; 43 : }; 44 : 45 : using options = tmpl::list; 46 : 47 : RobinImpl() = default; 48 : RobinImpl(const RobinImpl&) noexcept = default; 49 : RobinImpl& operator=(const RobinImpl&) noexcept = default; 50 : RobinImpl(RobinImpl&&) noexcept = default; 51 : RobinImpl& operator=(RobinImpl&&) noexcept = default; 52 : ~RobinImpl() noexcept = default; 53 : 54 : RobinImpl(double dirichlet_weight, double neumann_weight, double constant, 55 : const Options::Context& context = {}); 56 : 57 : double dirichlet_weight() const noexcept; 58 : double neumann_weight() const noexcept; 59 : double constant() const noexcept; 60 : 61 : using argument_tags = tmpl::list<>; 62 : using volume_tags = tmpl::list<>; 63 : 64 : void apply( 65 : gsl::not_null*> field, 66 : gsl::not_null*> n_dot_field_gradient) const noexcept; 67 : 68 : using argument_tags_linearized = tmpl::list<>; 69 : using volume_tags_linearized = tmpl::list<>; 70 : 71 : void apply_linearized(gsl::not_null*> field_correction, 72 : gsl::not_null*> 73 : n_dot_field_gradient_correction) const noexcept; 74 : 75 : void pup(PUP::er& p) noexcept; 76 : 77 : private: 78 : double dirichlet_weight_ = std::numeric_limits::signaling_NaN(); 79 : double neumann_weight_ = std::numeric_limits::signaling_NaN(); 80 : double constant_ = std::numeric_limits::signaling_NaN(); 81 : }; 82 : 83 : bool operator==(const RobinImpl& lhs, const RobinImpl& rhs) noexcept; 84 : bool operator!=(const RobinImpl& lhs, const RobinImpl& rhs) noexcept; 85 : 86 : } // namespace detail 87 : 88 : // The following implements the registration and factory-creation mechanism 89 : 90 : /// \cond 91 : template 92 : struct Robin; 93 : 94 : namespace Registrars { 95 : template 96 : struct Robin { 97 : template 98 : using f = BoundaryConditions::Robin; 99 : }; 100 : } // namespace Registrars 101 : /// \endcond 102 : 103 : /// Impose Robin boundary conditions \f\$a u + b n_i \nabla^i u = c\f\$. The 104 : /// boundary condition is imposed as Neumann-type (i.e. on \f\$n_i \nabla^i u\f\$) 105 : /// if \f\$|b| > 0\f\$ and as Dirichlet-type (i.e. on \f\$u\f\$) if \f\$b = 0\f\$. 106 : template >> 107 : class Robin 108 : : public elliptic::BoundaryConditions::BoundaryCondition, 109 1 : public detail::RobinImpl { 110 : private: 111 0 : using Base = elliptic::BoundaryConditions::BoundaryCondition; 112 : 113 : public: 114 0 : Robin() = default; 115 0 : Robin(const Robin&) noexcept = default; 116 0 : Robin& operator=(const Robin&) noexcept = default; 117 0 : Robin(Robin&&) noexcept = default; 118 0 : Robin& operator=(Robin&&) noexcept = default; 119 0 : ~Robin() noexcept = default; 120 : using RobinImpl::RobinImpl; 121 : 122 : /// \cond 123 : explicit Robin(CkMigrateMessage* m) noexcept : Base(m) {} 124 : using PUP::able::register_constructor; 125 : WRAPPED_PUPable_decl_template(Robin); 126 : /// \endcond 127 : 128 0 : std::unique_ptr get_clone() 129 : const noexcept override { 130 : return std::make_unique(*this); 131 : } 132 : 133 0 : void pup(PUP::er& p) noexcept override { 134 : Base::pup(p); 135 : RobinImpl::pup(p); 136 : } 137 : }; 138 : 139 : /// \cond 140 : template 141 : PUP::able::PUP_ID Robin::my_PUP_ID = 0; // NOLINT 143 : /// \endcond 144 : 145 : } // namespace Poisson::BoundaryConditions ```

 Generated by: LCOV version 1.14