}
else if (*this == ReferenceCells::Wedge)
{
- Assert(false, ExcNotImplemented());
+ // The wedge we use is a triangle extruded into the third
+ // dimension by one unit. So we can use the same logic as for
+ // triangles above (i.e., for the simplex above, using dim==2)
+ // and then check the third dimension separately.
+
+ for (unsigned int d = 0; d < 2; ++d)
+ if (p[d] < -tolerance)
+ return false;
+
+ const double sum = p[0] + p[1];
+ if (sum > 1 + tolerance * std::sqrt(2.0))
+ return false;
+
+ if (p[2] < -tolerance)
+ return false;
+ if (p[2] > 1 + tolerance)
+ return false;
+
+ return true;
}
else if (*this == ReferenceCells::Pyramid)
{
- Assert(false, ExcNotImplemented());
+ // A pyramid only lives in the upper half-space:
+ if (p[2] < -tolerance)
+ return false;
+
+ // It also only lives in the space below z=1:
+ if (p[2] > 1 + tolerance)
+ return false;
+
+ // Within what's left of the space, a pyramid is a cone that tapers
+ // towards the top. First compute the distance of the point to the
+ // axis in the max norm (this is the right norm because the vertices
+ // of the pyramid are at points +/-1, +/-1):
+ const double distance_from_axis =
+ std::max(std::fabs(p[0]), std::fabs(p[1]));
+
+ // We are inside the pyramid if the distance from the axis is less than
+ // (1-z)
+ return (distance_from_axis < 1 + tolerance - p[2]);
}
Assert(false, ExcNotImplemented());