Block-Structured AMR Software Framework
AMReX_Periodicity.H
Go to the documentation of this file.
1 #ifndef AMREX_PERIODICITY_H_
2 #define AMREX_PERIODICITY_H_
3 #include <AMReX_Config.H>
4 
5 #include <AMReX_IntVect.H>
6 #include <AMReX_Box.H>
7 #include <vector>
8 
9 namespace amrex {
10 
17 {
18 public:
19  Periodicity () noexcept : period(AMREX_D_DECL(0,0,0)) {}
20  explicit Periodicity (const IntVect& v) noexcept : period(v) {}
21 
22  [[nodiscard]] bool isAnyPeriodic () const noexcept
23  { return AMREX_D_TERM(period[0]>0, || period[1]>0, || period[2]>0); }
24  [[nodiscard]] bool isAllPeriodic () const noexcept
25  { return AMREX_D_TERM(period[0]>0, && period[1]>0, && period[2]>0); }
26  [[nodiscard]] bool isPeriodic (int dir) const noexcept
27  { return period[dir]>0; }
28 
29  bool operator==(const Periodicity& rhs) const noexcept
30  { return period == rhs.period; }
31 
33  [[nodiscard]] Box Domain () const noexcept;
34 
35  [[nodiscard]] IntVect const& intVect () const { return period; }
36 
37  [[nodiscard]] std::vector<IntVect> shiftIntVect (IntVect const& nghost = IntVect(0)) const;
38 
39  static const Periodicity& NonPeriodic () noexcept;
40 
41 private:
43 };
44 
45 }
46 
47 #endif
#define AMREX_D_TERM(a, b, c)
Definition: AMReX_SPACE.H:129
This provides length of period for periodic domains. 0 means it is not periodic in that direction....
Definition: AMReX_Periodicity.H:17
bool isAllPeriodic() const noexcept
Definition: AMReX_Periodicity.H:24
static const Periodicity & NonPeriodic() noexcept
Definition: AMReX_Periodicity.cpp:52
std::vector< IntVect > shiftIntVect(IntVect const &nghost=IntVect(0)) const
Definition: AMReX_Periodicity.cpp:8
Box Domain() const noexcept
Cell-centered domain Box "infinitely" long in non-periodic directions.
Definition: AMReX_Periodicity.cpp:36
bool isAnyPeriodic() const noexcept
Definition: AMReX_Periodicity.H:22
bool operator==(const Periodicity &rhs) const noexcept
Definition: AMReX_Periodicity.H:29
bool isPeriodic(int dir) const noexcept
Definition: AMReX_Periodicity.H:26
Periodicity() noexcept
Definition: AMReX_Periodicity.H:19
Periodicity(const IntVect &v) noexcept
Definition: AMReX_Periodicity.H:20
IntVect period
Definition: AMReX_Periodicity.H:42
IntVect const & intVect() const
Definition: AMReX_Periodicity.H:35
Definition: AMReX_Amr.cpp:49
IntVectND< AMREX_SPACEDIM > IntVect
Definition: AMReX_BaseFwd.H:30