50 #ifndef Intrepid2_ProjectedGeometryExamples_h
51 #define Intrepid2_ProjectedGeometryExamples_h
57 template<
typename Scalar, const
int spaceDim>
62 KOKKOS_INLINE_FUNCTION
63 Scalar
operator()(
const Kokkos::Array<Scalar,spaceDim> &coords,
const ordinal_type &d)
const
69 KOKKOS_INLINE_FUNCTION
70 Scalar
operator()(
const Kokkos::Array<Scalar,spaceDim> &coords,
const ordinal_type &d1,
const ordinal_type &d2)
const
72 return (d1 == d2) ? 1.0 : 0.0;
81 template<
typename Scalar>
86 KOKKOS_INLINE_FUNCTION
87 Scalar
operator()(
const Kokkos::Array<Scalar,2> &coords,
const ordinal_type &d)
const
89 const Scalar &x = coords[0];
90 const Scalar &y = coords[1];
92 Scalar x_prime = x * sqrt(1. - y * y / 2.);
93 Scalar y_prime = y * sqrt(1. - x * x / 2.);
95 return (d==0) ? x_prime : y_prime;
99 KOKKOS_INLINE_FUNCTION
100 Scalar
operator()(
const Kokkos::Array<Scalar,2> &coords,
const ordinal_type &d1,
const ordinal_type &d2)
const
102 const Scalar &x = coords[0];
103 const Scalar &y = coords[1];
105 Scalar x_prime_dx = sqrt(1. - y * y / 2.);
106 Scalar x_prime_dy = - x * y / sqrt(1. - y * y / 2.);
107 Scalar y_prime_dx = - x * y / sqrt(1. - x * x / 2.);
108 Scalar y_prime_dy = sqrt(1. - x * x / 2.);
110 if ((d1 == 0) && (d2 == 0))
return x_prime_dx;
111 else if ((d1 == 0) && (d2 == 1))
return x_prime_dy;
112 else if ((d1 == 1) && (d2 == 0))
return y_prime_dx;
113 else if ((d1 == 1) && (d2 == 1))
return y_prime_dy;
125 template<
typename Scalar>
129 KOKKOS_INLINE_FUNCTION
130 Scalar
operator()(
const Kokkos::Array<Scalar,3> &coords,
const ordinal_type &d)
const
132 const int spaceDim = 3;
134 const Scalar &x_d = coords[d];
136 Scalar radical = 1.0;
137 for (
int d1=0; d1<spaceDim; d1++)
139 const Scalar valueToSubtract = (d1 == d) ? 0.0 : coords[d1] * coords[d1] / 2.0;
140 radical -= valueToSubtract;
143 return x_d * sqrt(radical);
147 KOKKOS_INLINE_FUNCTION
148 Scalar
operator()(
const Kokkos::Array<Scalar,3> &coords,
const ordinal_type &d1,
const ordinal_type &d2)
const
150 const int spaceDim = 3;
151 const Scalar &x_d1 = coords[d1];
152 const Scalar &x_d2 = coords[d2];
154 Scalar radical = 1.0;
155 for (
int d=0; d<spaceDim; d++)
157 const Scalar valueToSubtract = (d1 == d) ? 0.0 : coords[d] * coords[d] / 2.0;
158 radical -= valueToSubtract;
161 Scalar weight = (d1 == d2) ? 1.0 : - x_d1 * x_d2;
162 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.