chombo-discharge
CD_EddingtonSP1DomainBc.H
1 /* chombo-discharge
2  * Copyright © 2021 SINTEF Energy Research.
3  * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4  */
5 
12 #ifndef CD_EddingtonSP1DomainBc_H
13 #define CD_EddingtonSP1DomainBc_H
14 
15 // Std include
16 #include <functional>
17 #include <map>
18 
19 // Chombo includes
20 #include <RealVect.H>
21 #include <LoHiSide.H>
22 
23 // Our includes
24 #include <CD_NamespaceHeader.H>
25 
31 {
32 public:
36  enum class BcType
37  {
38  Dirichlet,
39  Neumann,
40  Larsen,
41  };
42 
46  using BcFunction = std::function<Real(const RealVect a_position, const Real a_time)>;
47 
51  using DomainSide = std::pair<int, Side::LoHiSide>;
52 
56  using Bc = std::pair<BcType, BcFunction>;
57 
62 
67  EddingtonSP1DomainBc(const EddingtonSP1DomainBc& a_domainBc) = default;
68 
73  EddingtonSP1DomainBc(const EddingtonSP1DomainBc&& a_domainBc) = delete;
74 
80  operator=(const EddingtonSP1DomainBc& a_domainBc) = default;
81 
87  operator=(const EddingtonSP1DomainBc&& a_domainBc) = delete;
88 
92  virtual ~EddingtonSP1DomainBc();
93 
100  void
101  setBc(const DomainSide a_domainSide, const Bc a_bc);
102 
108  Bc&
109  getBc(const DomainSide a_domainSide);
110 
116  const Bc&
117  getBc(const DomainSide a_domainSide) const;
118 
119 protected:
124  std::map<DomainSide, Bc> m_bcFunctions;
125 };
126 
127 #include <CD_NamespaceFooter.H>
128 
129 #endif
Class which maps boundary condition types to a side and direction.
Definition: CD_EddingtonSP1DomainBc.H:31
std::pair< BcType, BcFunction > Bc
Alias for mapping a bctype and function.
Definition: CD_EddingtonSP1DomainBc.H:56
std::map< DomainSide, Bc > m_bcFunctions
This holds the map to the boundary condition type and side. The first entry in the map is the directi...
Definition: CD_EddingtonSP1DomainBc.H:124
Bc & getBc(const DomainSide a_domainSide)
Returns the boundary condition for a side and direction.
Definition: CD_EddingtonSP1DomainBc.cpp:45
EddingtonSP1DomainBc(const EddingtonSP1DomainBc &a_domainBc)=default
Copy constructor.
EddingtonSP1DomainBc(const EddingtonSP1DomainBc &&a_domainBc)=delete
Disallowedd move constructor.
void setBc(const DomainSide a_domainSide, const Bc a_bc)
Set the boundary condition on a domain side. You must set both the type, and the associated function.
Definition: CD_EddingtonSP1DomainBc.cpp:39
EddingtonSP1DomainBc & operator=(const EddingtonSP1DomainBc &&a_domainBc)=delete
Disallowed move assignment.
std::function< Real(const RealVect a_position, const Real a_time)> BcFunction
Function which maps f(R^3,t) : R. Used for setting the associated value and boundary condition type.
Definition: CD_EddingtonSP1DomainBc.H:46
EddingtonSP1DomainBc()
Initializing constructor. This populates the bc.
Definition: CD_EddingtonSP1DomainBc.cpp:16
std::pair< int, Side::LoHiSide > DomainSide
Alias for mapping a direction and side.
Definition: CD_EddingtonSP1DomainBc.H:51
BcType
Boundary condition type.
Definition: CD_EddingtonSP1DomainBc.H:37
virtual ~EddingtonSP1DomainBc()
Destructor. This.
Definition: CD_EddingtonSP1DomainBc.cpp:33
EddingtonSP1DomainBc & operator=(const EddingtonSP1DomainBc &a_domainBc)=default
Copy assignment.