Skip to content
Snippets Groups Projects
Commit f1fa6af2 authored by Timo Koch's avatar Timo Koch
Browse files

[boundarytypes] Make boundary types copyable and assignable

parent 9c5852b6
No related branches found
No related tags found
1 merge request!617[WIP] Next
...@@ -59,14 +59,14 @@ public: ...@@ -59,14 +59,14 @@ public:
*/ */
void resetEq(int eqIdx) void resetEq(int eqIdx)
{ {
boundaryInfo_[eqIdx].visited = 0; boundaryInfo_[eqIdx].visited = false;
boundaryInfo_[eqIdx].isDirichlet = 0; boundaryInfo_[eqIdx].isDirichlet = false;
boundaryInfo_[eqIdx].isNeumann = 0; boundaryInfo_[eqIdx].isNeumann = false;
boundaryInfo_[eqIdx].isOutflow = 0; boundaryInfo_[eqIdx].isOutflow = false;
boundaryInfo_[eqIdx].isCouplingDirichlet = 0; boundaryInfo_[eqIdx].isCouplingDirichlet = false;
boundaryInfo_[eqIdx].isCouplingNeumann = 0; boundaryInfo_[eqIdx].isCouplingNeumann = false;
boundaryInfo_[eqIdx].isCouplingMortar = 0; boundaryInfo_[eqIdx].isCouplingMortar = false;
eq2pvIdx_[eqIdx] = eqIdx; eq2pvIdx_[eqIdx] = eqIdx;
pv2eqIdx_[eqIdx] = eqIdx; pv2eqIdx_[eqIdx] = eqIdx;
...@@ -170,8 +170,8 @@ public: ...@@ -170,8 +170,8 @@ public:
void setNeumann(int eqIdx) void setNeumann(int eqIdx)
{ {
resetEq(eqIdx); resetEq(eqIdx);
boundaryInfo_[eqIdx].visited = 1; boundaryInfo_[eqIdx].visited = true;
boundaryInfo_[eqIdx].isNeumann = 1; boundaryInfo_[eqIdx].isNeumann = true;
Valgrind::SetDefined(boundaryInfo_[eqIdx]); Valgrind::SetDefined(boundaryInfo_[eqIdx]);
} }
...@@ -188,8 +188,8 @@ public: ...@@ -188,8 +188,8 @@ public:
void setDirichlet(int pvIdx, int eqIdx) void setDirichlet(int pvIdx, int eqIdx)
{ {
resetEq(eqIdx); resetEq(eqIdx);
boundaryInfo_[eqIdx].visited = 1; boundaryInfo_[eqIdx].visited = true;
boundaryInfo_[eqIdx].isDirichlet = 1; boundaryInfo_[eqIdx].isDirichlet = true;
// update the equation <-> primary variable mapping // update the equation <-> primary variable mapping
eq2pvIdx_[eqIdx] = pvIdx; eq2pvIdx_[eqIdx] = pvIdx;
...@@ -208,8 +208,8 @@ public: ...@@ -208,8 +208,8 @@ public:
void setOutflow(int eqIdx) void setOutflow(int eqIdx)
{ {
resetEq(eqIdx); resetEq(eqIdx);
boundaryInfo_[eqIdx].visited = 1; boundaryInfo_[eqIdx].visited = true;
boundaryInfo_[eqIdx].isOutflow = 1; boundaryInfo_[eqIdx].isOutflow = true;
Valgrind::SetDefined(boundaryInfo_[eqIdx]); Valgrind::SetDefined(boundaryInfo_[eqIdx]);
} }
...@@ -221,8 +221,8 @@ public: ...@@ -221,8 +221,8 @@ public:
void setCouplingDirichlet(int eqIdx) void setCouplingDirichlet(int eqIdx)
{ {
resetEq(eqIdx); resetEq(eqIdx);
boundaryInfo_[eqIdx].visited = 1; boundaryInfo_[eqIdx].visited = true;
boundaryInfo_[eqIdx].isCouplingDirichlet = 1; boundaryInfo_[eqIdx].isCouplingDirichlet = true;
Valgrind::SetDefined(boundaryInfo_[eqIdx]); Valgrind::SetDefined(boundaryInfo_[eqIdx]);
} }
...@@ -234,8 +234,8 @@ public: ...@@ -234,8 +234,8 @@ public:
void setCouplingNeumann(int eqIdx) void setCouplingNeumann(int eqIdx)
{ {
resetEq(eqIdx); resetEq(eqIdx);
boundaryInfo_[eqIdx].visited = 1; boundaryInfo_[eqIdx].visited = true;
boundaryInfo_[eqIdx].isCouplingNeumann = 1; boundaryInfo_[eqIdx].isCouplingNeumann = true;
Valgrind::SetDefined(boundaryInfo_[eqIdx]); Valgrind::SetDefined(boundaryInfo_[eqIdx]);
} }
...@@ -247,8 +247,8 @@ public: ...@@ -247,8 +247,8 @@ public:
void setCouplingMortar(int eqIdx) void setCouplingMortar(int eqIdx)
{ {
resetEq(eqIdx); resetEq(eqIdx);
boundaryInfo_[eqIdx].visited = 1; boundaryInfo_[eqIdx].visited = true;
boundaryInfo_[eqIdx].isCouplingMortar = 1; boundaryInfo_[eqIdx].isCouplingMortar = true;
Valgrind::SetDefined(boundaryInfo_[eqIdx]); Valgrind::SetDefined(boundaryInfo_[eqIdx]);
} }
...@@ -444,19 +444,18 @@ public: ...@@ -444,19 +444,18 @@ public:
{ return eq2pvIdx_[eqIdx]; } { return eq2pvIdx_[eqIdx]; }
protected: protected:
// this is a bitfield structure! struct BoundaryInfo {
struct __attribute__((__packed__)) { bool visited;
unsigned char visited : 1; bool isDirichlet;
unsigned char isDirichlet : 1; bool isNeumann;
unsigned char isNeumann : 1; bool isOutflow;
unsigned char isOutflow : 1; bool isCouplingDirichlet;
unsigned char isCouplingDirichlet : 1; bool isCouplingNeumann;
unsigned char isCouplingNeumann : 1; bool isCouplingMortar;
unsigned char isCouplingMortar : 1; };
} boundaryInfo_[numEq];
std::array<BoundaryInfo, numEq> boundaryInfo_;
unsigned char eq2pvIdx_[numEq]; std::array<unsigned int, numEq> eq2pvIdx_, pv2eqIdx_;
unsigned char pv2eqIdx_[numEq];
}; };
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment