Skip to content

Commit 5bc7474

Browse files
Adding point classification (#83)
* Adding point classification * Adding comments to Integration point * formatting
1 parent ef76a31 commit 5bc7474

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

src/MeshField_Integrate.hpp

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@ namespace MeshField {
1313
template <size_t pointSize> struct IntegrationPoint {
1414
// template parameter pointSize specifies the length of the integration point
1515
// array for one point
16-
IntegrationPoint(Kokkos::Array<Real, pointSize> const &p, double w)
17-
: param(p), weight(w) {}
16+
IntegrationPoint(Kokkos::Array<Real, pointSize> const &p, double w, int d,
17+
int i)
18+
: param(p), weight(w), dim(d), idx(i) {}
1819
Kokkos::Array<Real, pointSize> param;
1920
double weight;
21+
// dim and idx represent the topological mesh entity the point is classified
22+
// on dim represents whether it is edge, vertex, face, etc idx represents the
23+
// index of the entity as defined by the shape function
24+
int dim;
25+
int idx;
2026
};
2127
template <size_t pointSize> class Integration {
2228
public:
@@ -47,7 +53,8 @@ class TriangleIntegration : public EntityIntegration<3> {
4753
public:
4854
virtual int countPoints() const { return 1; }
4955
virtual std::vector<IntegrationPoint<3>> getPoints() const {
50-
return {IntegrationPoint(Vector3{1. / 3., 1. / 3., 1. / 3.}, 1.0 / 2.0)};
56+
return {IntegrationPoint(Vector3{1. / 3., 1. / 3., 1. / 3.}, 1.0 / 2.0, 2,
57+
0)};
5158
}
5259
virtual int getAccuracy() const { return 1; }
5360
}; // end N1
@@ -57,13 +64,13 @@ class TriangleIntegration : public EntityIntegration<3> {
5764
virtual std::vector<IntegrationPoint<3>> getPoints() const {
5865
return {IntegrationPoint(Vector3{0.666666666666667, 0.166666666666667,
5966
0.166666666666667},
60-
1. / 3. / 2.0),
67+
1. / 3. / 2.0, 2, 0),
6168
IntegrationPoint(Vector3{0.166666666666667, 0.666666666666667,
6269
0.166666666666667},
63-
1. / 3. / 2.0),
70+
1. / 3. / 2.0, 2, 0),
6471
IntegrationPoint(Vector3{0.166666666666667, 0.166666666666667,
6572
0.666666666666667},
66-
1. / 3. / 2.0)};
73+
1. / 3. / 2.0, 2, 0)};
6774
}
6875
virtual int getAccuracy() const { return 2; }
6976
}; // end N2
@@ -82,7 +89,8 @@ class TetrahedronIntegration : public EntityIntegration<4> {
8289
public:
8390
virtual int countPoints() const { return 1; }
8491
virtual std::vector<IntegrationPoint<4>> getPoints() const {
85-
return {IntegrationPoint(Vector4{0.25, 0.25, 0.25, 0.25}, 1.0 / 6.0)};
92+
return {
93+
IntegrationPoint(Vector4{0.25, 0.25, 0.25, 0.25}, 1.0 / 6.0, 3, 0)};
8694
}
8795
virtual int getAccuracy() const { return 1; }
8896
};
@@ -93,16 +101,16 @@ class TetrahedronIntegration : public EntityIntegration<4> {
93101

94102
return {IntegrationPoint(Vector4{0.138196601125011, 0.138196601125011,
95103
0.138196601125011, 0.585410196624969},
96-
0.25 / 6.0),
104+
0.25 / 6.0, 3, 0),
97105
IntegrationPoint(Vector4{0.585410196624969, 0.138196601125011,
98106
0.138196601125011, 0.138196601125011},
99-
0.25 / 6.0),
107+
0.25 / 6.0, 3, 0),
100108
IntegrationPoint(Vector4{0.138196601125011, 0.585410196624969,
101109
0.138196601125011, 0.138196601125011},
102-
0.25 / 6.0),
110+
0.25 / 6.0, 3, 0),
103111
IntegrationPoint(Vector4{0.138196601125011, 0.138196601125011,
104112
0.585410196624969, 0.138196601125011},
105-
0.25 / 6.0)};
113+
0.25 / 6.0, 3, 0)};
106114
}
107115
virtual int getAccuracy() const { return 2; }
108116
};

0 commit comments

Comments
 (0)