DamBreak++ Wave Simulator 0.3
DamBreak++ Simulation Framework
Loading...
Searching...
No Matches
dbpp_CellFace.h
Go to the documentation of this file.
1#pragma once
2
3#include <iostream>
4
5namespace dbpp
6{
29 {
30 public:
34 enum class eFaceSide { left, right, global };
43 constexpr cellFace( eFaceSide aFaceSid = eFaceSide::left,
44 signed short aGblFaceIdx = -1, // global index (global discretization)
45 signed short aLeftNodeIdx = -1, // local node idx: -1(out of range),0(left),1(right)
46 signed short aRightNodeIdx = 0, // grid node index left/right on both side
47 signed short aCellIdx = 0) // cell index
48 : m_faceSide{ aFaceSid },
49 m_gblFaceI{ aGblFaceIdx },
50 m_leftNodeI{aLeftNodeIdx},
51 m_rightNodeI{ aRightNodeIdx },
52 m_cellIdx{ aCellIdx }
53 {}
54
58 constexpr short getLeftNodeI() const noexcept { return m_leftNodeI; }
63 constexpr signed short getRightNodeI() const noexcept { return m_rightNodeI; }
68 constexpr signed short getGblFaceI() const noexcept { return m_gblFaceI; }
73 constexpr signed short getCellIdx() const noexcept { return m_cellIdx; }
78 constexpr bool hasLeftNeighbour() const noexcept { return m_leftNodeI != -1; }
83 constexpr bool hasRightNeighbour() const noexcept { return m_rightNodeI != -1; }
88 constexpr eFaceSide cellFaceSide() const noexcept { return m_faceSide; }
93 constexpr bool isLeftFace() const noexcept { return m_faceSide == eFaceSide::left; }
98 constexpr bool isrightFace() const noexcept { return m_faceSide == eFaceSide::right; }
103 constexpr bool isGlobalFace() const noexcept { return m_faceSide == eFaceSide::global; }
109 constexpr auto operator <=> (const cellFace& aOther) const
110 {
111 auto cmp1 = m_gblFaceI <=> aOther.m_gblFaceI; // primary member for ordering
112 if (cmp1 != 0) return cmp1; // return result if not equal
113 auto cmp2 = m_leftNodeI <=> aOther.m_leftNodeI; // secondary member for ordering
114 if (cmp2 != 0) return cmp2; // return result if not equal
115 auto cmp3 = m_rightNodeI <=> aOther.m_rightNodeI; // third member for ordering
116 if(cmp3 != 0) return cmp3; // return result if not equal
117 return m_cellIdx <=> aOther.m_cellIdx; // final member for ordering
118 }
119
125 friend std::ostream& operator<< (std::ostream& os, const cellFace& aCface)
126 {
127 os << "Cell face Id is: " << aCface.m_gblFaceI << "\n"
128 << "Left Node Id is: " << aCface.m_leftNodeI << "\n"
129 << "Right Node Id is: " << aCface.m_rightNodeI << "\n";
130
131 return os;
132 }
133 private:
135 signed short m_gblFaceI;
136 signed short m_leftNodeI;
137 signed short m_rightNodeI;
138 signed short m_cellIdx;
139 };
140} // End of namespace
eFaceSide m_faceSide
Definition dbpp_CellFace.h:134
friend std::ostream & operator<<(std::ostream &os, const cellFace &aCface)
tream operaator
Definition dbpp_CellFace.h:125
constexpr signed short getRightNodeI() const noexcept
right node neighbour
Definition dbpp_CellFace.h:63
constexpr bool hasLeftNeighbour() const noexcept
check left neighbour
Definition dbpp_CellFace.h:78
eFaceSide
Face type (element/global domain)
Definition dbpp_CellFace.h:34
@ right
Definition dbpp_CellFace.h:34
@ left
Definition dbpp_CellFace.h:34
@ global
Definition dbpp_CellFace.h:34
signed short m_cellIdx
Definition dbpp_CellFace.h:138
constexpr short getLeftNodeI() const noexcept
left node neighbour
Definition dbpp_CellFace.h:58
constexpr signed short getCellIdx() const noexcept
cell index
Definition dbpp_CellFace.h:73
signed short m_leftNodeI
Definition dbpp_CellFace.h:136
constexpr signed short getGblFaceI() const noexcept
global face
Definition dbpp_CellFace.h:68
constexpr cellFace(eFaceSide aFaceSid=eFaceSide::left, signed short aGblFaceIdx=-1, signed short aLeftNodeIdx=-1, signed short aRightNodeIdx=0, signed short aCellIdx=0)
Ctor from cell face id and type.
Definition dbpp_CellFace.h:43
constexpr bool isrightFace() const noexcept
check face type
Definition dbpp_CellFace.h:98
constexpr bool isGlobalFace() const noexcept
check face type
Definition dbpp_CellFace.h:103
constexpr bool hasRightNeighbour() const noexcept
check rightt neighbour
Definition dbpp_CellFace.h:83
signed short m_gblFaceI
Definition dbpp_CellFace.h:135
signed short m_rightNodeI
Definition dbpp_CellFace.h:137
constexpr auto operator<=>(const cellFace &aOther) const
comparison operator (spaceship)
Definition dbpp_CellFace.h:109
constexpr eFaceSide cellFaceSide() const noexcept
face side
Definition dbpp_CellFace.h:88
constexpr bool isLeftFace() const noexcept
check face type
Definition dbpp_CellFace.h:93
Definition DamBreakProb.h:15