Quadrature<2>
QProjector<dim>::reflect(const Quadrature<2> &q)
{
- std::vector<Point<2>> q_points(q.size());
- std::vector<double> weights(q.size());
- for (unsigned int i = 0; i < q.size(); ++i)
- {
- q_points[i][0] = q.point(i)[1];
- q_points[i][1] = q.point(i)[0];
+ // Take the points and reflect them by the diagonal
+ std::vector<Point<2>> q_points(q.get_points());
+ for (Point<2> &p : q_points)
+ std::swap(p[0], p[1]);
- weights[i] = q.weight(i);
- }
-
- return Quadrature<2>(q_points, weights);
+ return Quadrature<2>(q_points, q.get_weights());
}
QProjector<dim>::rotate(const Quadrature<2> &q, const unsigned int n_times)
{
std::vector<Point<2>> q_points(q.size());
- std::vector<double> weights(q.size());
for (unsigned int i = 0; i < q.size(); ++i)
{
switch (n_times % 4)
{
case 0:
- // 0 degree
- q_points[i][0] = q.point(i)[0];
- q_points[i][1] = q.point(i)[1];
+ // 0 degree. the point remains as it is.
+ q_points[i] = q.point(i);
break;
+
case 1:
// 90 degree counterclockwise
q_points[i][0] = 1.0 - q.point(i)[1];
q_points[i][1] = 1.0 - q.point(i)[0];
break;
}
-
- weights[i] = q.weight(i);
}
- return Quadrature<2>(q_points, weights);
+ return Quadrature<2>(q_points, q.get_weights());
}