16 #ifndef Intrepid2_ProjectedGeometryExamples_h
17 #define Intrepid2_ProjectedGeometryExamples_h
23 template<
typename Scalar, const
int spaceDim>
28 KOKKOS_INLINE_FUNCTION
29 Scalar
operator()(
const Kokkos::Array<Scalar,spaceDim> &coords,
const ordinal_type &d)
const
35 KOKKOS_INLINE_FUNCTION
36 Scalar
operator()(
const Kokkos::Array<Scalar,spaceDim> &coords,
const ordinal_type &d1,
const ordinal_type &d2)
const
38 return (d1 == d2) ? 1.0 : 0.0;
47 template<
typename Scalar>
52 KOKKOS_INLINE_FUNCTION
53 Scalar
operator()(
const Kokkos::Array<Scalar,2> &coords,
const ordinal_type &d)
const
55 const Scalar &x = coords[0];
56 const Scalar &y = coords[1];
58 Scalar x_prime = x * sqrt(1. - y * y / 2.);
59 Scalar y_prime = y * sqrt(1. - x * x / 2.);
61 return (d==0) ? x_prime : y_prime;
65 KOKKOS_INLINE_FUNCTION
66 Scalar
operator()(
const Kokkos::Array<Scalar,2> &coords,
const ordinal_type &d1,
const ordinal_type &d2)
const
68 const Scalar &x = coords[0];
69 const Scalar &y = coords[1];
71 Scalar x_prime_dx = sqrt(1. - y * y / 2.);
72 Scalar x_prime_dy = - x * y / sqrt(1. - y * y / 2.);
73 Scalar y_prime_dx = - x * y / sqrt(1. - x * x / 2.);
74 Scalar y_prime_dy = sqrt(1. - x * x / 2.);
76 if ((d1 == 0) && (d2 == 0))
return x_prime_dx;
77 else if ((d1 == 0) && (d2 == 1))
return x_prime_dy;
78 else if ((d1 == 1) && (d2 == 0))
return y_prime_dx;
79 else if ((d1 == 1) && (d2 == 1))
return y_prime_dy;
91 template<
typename Scalar>
95 KOKKOS_INLINE_FUNCTION
96 Scalar
operator()(
const Kokkos::Array<Scalar,3> &coords,
const ordinal_type &d)
const
98 const int spaceDim = 3;
100 const Scalar &x_d = coords[d];
102 Scalar radical = 1.0;
103 for (
int d1=0; d1<spaceDim; d1++)
105 const Scalar valueToSubtract = (d1 == d) ? 0.0 : coords[d1] * coords[d1] / 2.0;
106 radical -= valueToSubtract;
109 return x_d * sqrt(radical);
113 KOKKOS_INLINE_FUNCTION
114 Scalar
operator()(
const Kokkos::Array<Scalar,3> &coords,
const ordinal_type &d1,
const ordinal_type &d2)
const
116 const int spaceDim = 3;
117 const Scalar &x_d1 = coords[d1];
118 const Scalar &x_d2 = coords[d2];
120 Scalar radical = 1.0;
121 for (
int d=0; d<spaceDim; d++)
123 const Scalar valueToSubtract = (d1 == d) ? 0.0 : coords[d] * coords[d] / 2.0;
124 radical -= valueToSubtract;
127 Scalar weight = (d1 == d2) ? 1.0 : - x_d1 * x_d2;
128 return weight * sqrt(radical);
#define INTREPID2_TEST_FOR_EXCEPTION_DEVICE_SAFE(test, x, msg)
KOKKOS_INLINE_FUNCTION Scalar operator()(const Kokkos::Array< Scalar, spaceDim > &coords, const ordinal_type &d1, const ordinal_type &d2) const
gradient of the (identity) mapping
KOKKOS_INLINE_FUNCTION Scalar operator()(const Kokkos::Array< Scalar, 2 > &coords, const ordinal_type &d) const
coordinate values
KOKKOS_INLINE_FUNCTION Scalar operator()(const Kokkos::Array< Scalar, 3 > &coords, const ordinal_type &d1, const ordinal_type &d2) const
gradient of the mapping
KOKKOS_INLINE_FUNCTION Scalar operator()(const Kokkos::Array< Scalar, 3 > &coords, const ordinal_type &d) const
coordinate values
Maps unit square [-1,1]x[-1,1] to circle of radius 1.
KOKKOS_INLINE_FUNCTION Scalar operator()(const Kokkos::Array< Scalar, 2 > &coords, const ordinal_type &d1, const ordinal_type &d2) const
gradient of the mapping
Maps unit cube [-1,1]x[-1,1]x[-1,1] to sphere of radius 1.
KOKKOS_INLINE_FUNCTION Scalar operator()(const Kokkos::Array< Scalar, spaceDim > &coords, const ordinal_type &d) const
coordinate values
Identity map; simply preserves linear geometry. Intended primarily for tests.