48 #ifndef __INTREPID2_ORIENTATIONTOOLS_DEF_MODIFY_POINTS_HPP__
49 #define __INTREPID2_ORIENTATIONTOOLS_DEF_MODIFY_POINTS_HPP__
52 #if defined (__clang__) && !defined (__INTEL_COMPILER)
53 #pragma clang system_header
65 KOKKOS_INLINE_FUNCTION
70 const ordinal_type ort) {
71 #ifdef HAVE_INTREPID2_DEBUG
72 INTREPID2_TEST_FOR_ABORT( !( -1.0 <= pt && pt <= 1.0 ),
73 ">>> ERROR (Intrepid::OrientationTools::getModifiedLinePoint): "
74 "Input point is out of range [-1, 1].");
78 case 0: ot = pt;
break;
79 case 1: ot = -pt;
break;
81 INTREPID2_TEST_FOR_ABORT(
true,
82 ">>> ERROR (Intrepid2::OrientationTools::getModifiedLinePoint): "
83 "Orientation is invalid (0--1)." );
87 template<
typename JacobianViewType>
88 KOKKOS_INLINE_FUNCTION
92 #ifdef HAVE_INTREPID2_DEBUG
93 INTREPID2_TEST_FOR_ABORT( ort <0 || ort >1,
94 ">>> ERROR (Intrepid2::OrientationTools::getLineJacobian): " \
95 "Orientation is invalid (0--1)." );
98 ordinal_type jac[2] = { 1, -1 };
100 jacobian(0,0) = jac[ort];
103 template<
typename VT>
104 KOKKOS_INLINE_FUNCTION
111 const ordinal_type ort) {
112 const VT lambda[3] = { 1.0 - pt0 - pt1,
116 #ifdef HAVE_INTREPID2_DEBUG
117 VT eps = 10.0*std::numeric_limits<VT>::epsilon();
118 INTREPID2_TEST_FOR_ABORT( !( -eps <= lambda[0] && lambda[0] <= 1.0+eps ),
119 ">>> ERROR (Intrepid::OrientationTools::getModifiedTrianglePoint): " \
120 "Computed bicentric coordinate (lamba[0]) is out of range [0, 1].");
122 INTREPID2_TEST_FOR_ABORT( !( -eps <= lambda[1] && lambda[1] <= 1.0+eps ),
123 ">>> ERROR (Intrepid::OrientationTools::getModifiedTrianglePoint): " \
124 "Computed bicentric coordinate (lamba[1]) is out of range [0, 1].");
126 INTREPID2_TEST_FOR_ABORT( !( -eps <= lambda[2] && lambda[2] <= 1.0+eps ),
127 ">>> ERROR (Intrepid::OrientationTools::getModifiedTrianglePoint): "
128 "Computed bicentric coordinate (lamba[2]) is out of range [0, 1].");
132 case 0: ot0 = lambda[1]; ot1 = lambda[2];
break;
133 case 1: ot0 = lambda[0]; ot1 = lambda[1];
break;
134 case 2: ot0 = lambda[2]; ot1 = lambda[0];
break;
136 case 3: ot0 = lambda[2]; ot1 = lambda[1];
break;
137 case 4: ot0 = lambda[0]; ot1 = lambda[2];
break;
138 case 5: ot0 = lambda[1]; ot1 = lambda[0];
break;
140 INTREPID2_TEST_FOR_ABORT(
true,
141 ">>> ERROR (Intrepid2::OrientationTools::getModifiedTrianglePoint): " \
142 "Orientation is invalid (0--5)." );
146 template<
typename JacobianViewType>
147 KOKKOS_INLINE_FUNCTION
151 #ifdef HAVE_INTREPID2_DEBUG
152 INTREPID2_TEST_FOR_ABORT( ort <0 || ort >5,
153 ">>> ERROR (Intrepid2::OrientationTools::getTriangleJacobian): " \
154 "Orientation is invalid (0--5)." );
157 ordinal_type jac[6][2][2] = { { { 1, 0 },
170 jacobian(0,0) = jac[ort][0][0];
171 jacobian(0,1) = jac[ort][0][1];
172 jacobian(1,0) = jac[ort][1][0];
173 jacobian(1,1) = jac[ort][1][1];
176 template<
typename VT>
177 KOKKOS_INLINE_FUNCTION
184 const ordinal_type ort) {
185 #ifdef HAVE_INTREPID2_DEBUG
186 INTREPID2_TEST_FOR_ABORT( !( -1.0 <= pt0 && pt0 <= 1.0 ),
187 ">>> ERROR (Intrepid::OrientationTools::getModifiedQuadrilateralPoint): " \
188 "Input point(0) is out of range [-1, 1].");
190 INTREPID2_TEST_FOR_ABORT( !( -1.0 <= pt1 && pt1 <= 1.0 ),
191 ">>> ERROR (Intrepid::OrientationTools::getModifiedQuadrilateralPoint): " \
192 "Input point(1) is out of range [-1, 1].");
195 const VT lambda[2][2] = { { pt0, -pt0 },
199 case 0: ot0 = lambda[0][0]; ot1 = lambda[1][0];
break;
200 case 1: ot0 = lambda[1][1]; ot1 = lambda[0][0];
break;
201 case 2: ot0 = lambda[0][1]; ot1 = lambda[1][1];
break;
202 case 3: ot0 = lambda[1][0]; ot1 = lambda[0][1];
break;
204 case 4: ot0 = lambda[1][0]; ot1 = lambda[0][0];
break;
205 case 5: ot0 = lambda[0][1]; ot1 = lambda[1][0];
break;
206 case 6: ot0 = lambda[1][1]; ot1 = lambda[0][1];
break;
207 case 7: ot0 = lambda[0][0]; ot1 = lambda[1][1];
break;
209 INTREPID2_TEST_FOR_ABORT(
true,
210 ">>> ERROR (Intrepid2::OrientationTools::getModifiedQuadrilateralPoint): " \
211 "Orientation is invalid (0--7)." );
215 template<
typename JacobianViewType>
216 KOKKOS_INLINE_FUNCTION
220 #ifdef HAVE_INTREPID2_DEBUG
221 INTREPID2_TEST_FOR_ABORT( ort <0 || ort >7,
222 ">>> ERROR (Intrepid2::OrientationTools::getQuadrilateralJacobian): " \
223 "Orientation is invalid (0--7)." );
226 ordinal_type jac[8][2][2] = { { { 1, 0 },
243 jacobian(0,0) = jac[ort][0][0];
244 jacobian(0,1) = jac[ort][0][1];
245 jacobian(1,0) = jac[ort][1][0];
246 jacobian(1,1) = jac[ort][1][1];
249 template<
typename outPointViewType,
250 typename refPointViewType>
255 const refPointViewType refPoints,
256 const shards::CellTopology cellTopo,
257 const ordinal_type cellOrt) {
258 #ifdef HAVE_INTREPID2_DEBUG
260 const auto cellDim = cellTopo.getDimension();
261 INTREPID2_TEST_FOR_EXCEPTION( !( (1 <= cellDim) && (cellDim <= 2 ) ), std::invalid_argument,
262 ">>> ERROR (Intrepid::OrientationTools::mapToModifiedReference): " \
263 "Method defined only for 1 and 2-dimensional subcells.");
265 INTREPID2_TEST_FOR_EXCEPTION( !( outPoints.extent(0) == refPoints.extent(0) ), std::invalid_argument,
266 ">>> ERROR (Intrepid::OrientationTools::mapToModifiedReference): " \
267 "Size of input and output point arrays does not match each other.");
275 template<
typename outPointViewType,
276 typename refPointViewType>
281 const refPointViewType refPoints,
282 const unsigned cellTopoKey,
283 const ordinal_type cellOrt) {
285 const ordinal_type numPts = outPoints.extent(0);
286 switch (cellTopoKey) {
287 case shards::Line<>::key : {
288 for (ordinal_type pt=0;pt<numPts;++pt)
294 case shards::Triangle<>::key : {
295 for (ordinal_type pt=0;pt<numPts;++pt)
297 refPoints(pt, 0), refPoints(pt, 1),
301 case shards::Quadrilateral<>::key : {
302 for (ordinal_type pt=0;pt<numPts;++pt)
304 refPoints(pt, 0), refPoints(pt, 1),
309 INTREPID2_TEST_FOR_ABORT(
true,
310 ">>> ERROR (Intrepid2::OrientationTools::mapToModifiedReference): " \
311 "Invalid cell topology key." );
318 template<
typename outPo
intViewType>
323 const shards::CellTopology cellTopo,
324 const ordinal_type cellOrt) {
325 #ifdef HAVE_INTREPID2_DEBUG
327 const auto cellDim = cellTopo.getDimension();
328 INTREPID2_TEST_FOR_EXCEPTION( !( (1 <= cellDim) && (cellDim <= 2 ) ), std::invalid_argument,
329 ">>> ERROR (Intrepid::OrientationTools::getJacobianOfOrientationMap): " \
330 "Method defined only for 1 and 2-dimensional subcells.");
332 INTREPID2_TEST_FOR_ABORT( jacobian.rank() != 2,
333 ">>> ERROR (Intrepid2::OrientationTools::getJacobianOfOrientationMap): " \
334 "Jacobian should have rank 2" );
336 INTREPID2_TEST_FOR_EXCEPTION( ((jacobian.extent(0) != cellDim) || (jacobian.extent(1) != cellDim)), std::invalid_argument,
337 ">>> ERROR (Intrepid::OrientationTools::getJacobianOfOrientationMap): " \
338 "Size of jacobian is not compatible with cell topology.");
345 template<
typename outPo
intViewType>
350 const unsigned cellTopoKey,
351 const ordinal_type cellOrt) {
352 switch (cellTopoKey) {
353 case shards::Line<>::key :
356 case shards::Triangle<>::key :
359 case shards::Quadrilateral<>::key :
363 INTREPID2_TEST_FOR_ABORT(
true,
364 ">>> ERROR (Intrepid2::OrientationTools::mapToModifiedReference): " \
365 "Invalid cell topology key." );