48 #ifndef __INTREPID2_POINTTOOLS_DEF_HPP__
49 #define __INTREPID2_POINTTOOLS_DEF_HPP__
66 const ordinal_type order,
67 const ordinal_type offset ) {
68 #ifdef HAVE_INTREPID2_DEBUG
69 INTREPID2_TEST_FOR_EXCEPTION( order < 0 || offset < 0,
70 std::invalid_argument ,
71 ">>> ERROR (PointTools::getLatticeSize): order and offset must be positive values." );
73 ordinal_type r_val = 0;
74 switch (cellType.getBaseKey()) {
75 case shards::Tetrahedron<>::key: {
76 const auto effectiveOrder = order - 4 * offset;
77 r_val = (effectiveOrder < 0 ? 0 :(effectiveOrder+1)*(effectiveOrder+2)*(effectiveOrder+3)/6);
80 case shards::Triangle<>::key: {
81 const auto effectiveOrder = order - 3 * offset;
82 r_val = (effectiveOrder < 0 ? 0 : (effectiveOrder+1)*(effectiveOrder+2)/2);
85 case shards::Line<>::key: {
86 const auto effectiveOrder = order - 2 * offset;
87 r_val = (effectiveOrder < 0 ? 0 : (effectiveOrder+1));
91 INTREPID2_TEST_FOR_EXCEPTION(
true , std::invalid_argument ,
92 ">>> ERROR (Intrepid2::PointTools::getLatticeSize): the specified cell type is not supported." );
98 template<
typename pointValueType,
class ...pointProperties>
101 getLattice( Kokkos::DynRankView<pointValueType,pointProperties...> points,
102 const shards::CellTopology cell,
103 const ordinal_type order,
104 const ordinal_type offset,
105 const EPointType pointType ) {
106 #ifdef HAVE_INTREPID2_DEBUG
107 INTREPID2_TEST_FOR_EXCEPTION( points.rank() != 2,
108 std::invalid_argument ,
109 ">>> ERROR (PointTools::getLattice): points rank must be 2." );
110 INTREPID2_TEST_FOR_EXCEPTION( order < 0 || offset < 0,
111 std::invalid_argument ,
112 ">>> ERROR (PointTools::getLattice): order and offset must be positive values." );
114 const size_type latticeSize =
getLatticeSize( cell, order, offset );
115 const size_type spaceDim = cell.getDimension();
117 INTREPID2_TEST_FOR_EXCEPTION( points.extent(0) != latticeSize ||
118 points.extent(1) != spaceDim,
119 std::invalid_argument ,
120 ">>> ERROR (PointTools::getLattice): dimension does not match to lattice size." );
136 INTREPID2_TEST_FOR_EXCEPTION(
true ,
137 std::invalid_argument ,
138 ">>> ERROR (PointTools::getLattice): invalid EPointType." );
143 template<
typename pointValueType,
class ...pointProperties>
147 const ordinal_type order ) {
148 #ifdef HAVE_INTREPID2_DEBUG
149 INTREPID2_TEST_FOR_EXCEPTION( points.rank() != 2,
150 std::invalid_argument ,
151 ">>> ERROR (PointTools::getGaussPoints): points rank must be 1." );
152 INTREPID2_TEST_FOR_EXCEPTION( order < 0,
153 std::invalid_argument ,
154 ">>> ERROR (PointTools::getGaussPoints): order must be positive value." );
156 const ordinal_type np = order + 1;
157 const double alpha = 0.0, beta = 0.0;
160 Kokkos::View<pointValueType*,Kokkos::HostSpace>
161 zHost(
"PointTools::getGaussPoints::z", np),
162 wHost(
"PointTools::getGaussPoints::w", np);
169 typedef Kokkos::pair<ordinal_type,ordinal_type> range_type;
170 auto pts = Kokkos::subview( points, range_type(0,np), 0 );
172 auto z = Kokkos::DynRankView<pointValueType,Kokkos::HostSpace>(zHost.data(), np);
173 Kokkos::deep_copy(pts, z);
180 template<
typename pointValueType,
class ...pointProperties>
183 const shards::CellTopology cell,
184 const ordinal_type order,
185 const ordinal_type offset ) {
186 switch (cell.getBaseKey()) {
191 INTREPID2_TEST_FOR_EXCEPTION(
true , std::invalid_argument ,
192 ">>> ERROR (Intrepid2::PointTools::getEquispacedLattice): the specified cell type is not supported." );
198 template<
typename pointValueType,
class ...pointProperties>
201 const shards::CellTopology cell,
202 const ordinal_type order,
203 const ordinal_type offset ) {
204 switch (cell.getBaseKey()) {
209 INTREPID2_TEST_FOR_EXCEPTION(
true , std::invalid_argument ,
210 ">>> ERROR (Intrepid2::PointTools::getWarpBlendLattice): the specified cell type is not supported." );
217 template<
typename pointValueType,
class ...pointProperties>
221 const ordinal_type order,
222 const ordinal_type offset ) {
223 auto pointsHost = Kokkos::create_mirror_view(Kokkos::HostSpace::memory_space(), points);
226 pointsHost(0,0) = 0.0;
228 const pointValueType h = 2.0 / order;
229 const ordinal_type ibeg = offset, iend = order-offset+1;
230 for (ordinal_type i=ibeg;i<iend;++i)
231 pointsHost(i-ibeg, 0) = -1.0 + h * (pointValueType) i;
234 Kokkos::deep_copy(points, pointsHost);
237 template<
typename pointValueType,
class ...pointProperties>
241 const ordinal_type order,
242 const ordinal_type offset ) {
245 const ordinal_type np = order + 1;
246 const double alpha = 0.0, beta = 0.0;
247 const ordinal_type s = np - 2*offset;
251 Kokkos::View<pointValueType*,Kokkos::HostSpace>
252 zHost(
"PointTools::getGaussPoints::z", np),
253 wHost(
"PointTools::getGaussPoints::w", np);
260 typedef Kokkos::pair<ordinal_type,ordinal_type> range_type;
261 auto pts = Kokkos::subview( points, range_type(0, s), 0 );
264 auto z = Kokkos::DynRankView<pointValueType,Kokkos::HostSpace>(zHost.data() + offset, np-offset);
266 Kokkos::deep_copy(pts, z);
270 template<
typename pointValueType,
class ...pointProperties>
274 const ordinal_type order,
275 const ordinal_type offset ) {
276 TEUCHOS_TEST_FOR_EXCEPTION( order <= 0 ,
277 std::invalid_argument ,
278 ">>> ERROR (Intrepid2::PointTools::getEquispacedLatticeTriangle): order must be positive" );
280 auto pointsHost = Kokkos::create_mirror_view(Kokkos::HostSpace::memory_space(), points);
282 const pointValueType h = 1.0 / order;
283 ordinal_type cur = 0;
285 for (ordinal_type i=offset;i<=order-offset;i++) {
286 for (ordinal_type j=offset;j<=order-i-offset;j++) {
287 pointsHost(cur,0) = j * h ;
288 pointsHost(cur,1) = i * h;
292 Kokkos::deep_copy(points, pointsHost);
295 template<
typename pointValueType,
class ...pointProperties>
299 const ordinal_type order ,
300 const ordinal_type offset ) {
301 TEUCHOS_TEST_FOR_EXCEPTION( (order <= 0) ,
302 std::invalid_argument ,
303 ">>> ERROR (Intrepid2::PointTools::getEquispacedLatticeTetrahedron): order must be positive" );
305 auto pointsHost = Kokkos::create_mirror_view(Kokkos::HostSpace::memory_space(), points);
307 const pointValueType h = 1.0 / order;
308 ordinal_type cur = 0;
310 for (ordinal_type i=offset;i<=order-offset;i++) {
311 for (ordinal_type j=offset;j<=order-i-offset;j++) {
312 for (ordinal_type k=offset;k<=order-i-j-offset;k++) {
313 pointsHost(cur,0) = k * h;
314 pointsHost(cur,1) = j * h;
315 pointsHost(cur,2) = i * h;
320 Kokkos::deep_copy(points, pointsHost);
324 template<
typename pointValueType,
class ...pointProperties>
327 warpFactor( Kokkos::DynRankView<pointValueType,pointProperties...> warp,
328 const ordinal_type order,
329 const Kokkos::DynRankView<pointValueType,pointProperties...> xnodes ,
330 const Kokkos::DynRankView<pointValueType,pointProperties...> xout
333 TEUCHOS_TEST_FOR_EXCEPTION( ( warp.extent(0) != xout.extent(0) ) ,
334 std::invalid_argument ,
335 ">>> ERROR (PointTools::warpFactor): xout and warp must be same size." );
337 Kokkos::deep_copy(warp, pointValueType(0.0));
339 ordinal_type xout_dim0 = xout.extent(0);
340 Kokkos::DynRankView<pointValueType, Kokkos::DefaultHostExecutionSpace> d(
"d", xout_dim0 );
342 Kokkos::DynRankView<pointValueType, Kokkos::DefaultHostExecutionSpace> xeq_(
"xeq", order + 1 ,1);
344 const auto xeq = Kokkos::subview(xeq_, Kokkos::ALL(),0);
346 TEUCHOS_TEST_FOR_EXCEPTION( ( xeq.extent(0) != xnodes.extent(0) ) ,
347 std::invalid_argument ,
348 ">>> ERROR (PointTools::warpFactor): xeq and xnodes must be same size." );
351 for (ordinal_type i=0;i<=order;i++) {
353 Kokkos::deep_copy(d, xnodes(i,0) - xeq(i));
355 for (ordinal_type j=1;j<order;j++) {
357 for (ordinal_type k=0;k<xout_dim0;k++) {
358 d(k) = d(k) * ( (xout(k)-xeq(j)) / (xeq(i)-xeq(j)) );
365 for (ordinal_type k=0;k<xout_dim0;k++) {
366 d(k) = -d(k) / (xeq(i) - xeq(0));
371 for (ordinal_type k=0;k<xout_dim0;k++) {
372 d(k) = d(k) / (xeq(i) - xeq(order));
376 for (ordinal_type k=0;k<xout_dim0;k++) {
383 template<
typename pointValueType,
class ...pointProperties>
387 const ordinal_type order ,
388 const ordinal_type offset)
392 Kokkos::DynRankView<pointValueType, Kokkos::DefaultHostExecutionSpace> gaussX(
"gaussX", order + 1 , 1 );
399 pointValueType alpopt[] = {0.0000,0.0000,1.4152,0.1001,0.2751,0.9800,1.0999,
400 1.2832,1.3648, 1.4773, 1.4959, 1.5743, 1.5770, 1.6223, 1.6258};
402 pointValueType alpha;
404 if (order >= 1 && order < 16) {
405 alpha = alpopt[order-1];
411 const ordinal_type p = order;
412 ordinal_type N = (p+1)*(p+2)/2;
415 Kokkos::DynRankView<pointValueType, Kokkos::DefaultHostExecutionSpace> L1(
"L1", N );
416 Kokkos::DynRankView<pointValueType, Kokkos::DefaultHostExecutionSpace> L2(
"L2", N );
417 Kokkos::DynRankView<pointValueType, Kokkos::DefaultHostExecutionSpace> L3(
"L3", N );
418 Kokkos::DynRankView<pointValueType, Kokkos::DefaultHostExecutionSpace> X(
"X", N);
419 Kokkos::DynRankView<pointValueType, Kokkos::DefaultHostExecutionSpace> Y(
"Y", N);
422 for (ordinal_type n=1;n<=p+1;n++) {
423 for (ordinal_type m=1;m<=p+2-n;m++) {
424 L1(sk) = (n-1) / (pointValueType)p;
425 L3(sk) = (m-1) / (pointValueType)p;
426 L2(sk) = 1.0 - L1(sk) - L3(sk);
431 for (ordinal_type n=0;n<N;n++) {
432 X(n) = -L2(n) + L3(n);
433 Y(n) = (-L2(n) - L3(n) + 2*L1(n))/1.7320508075688772;
437 Kokkos::DynRankView<pointValueType, Kokkos::DefaultHostExecutionSpace> blend1(
"blend1", N);
438 Kokkos::DynRankView<pointValueType, Kokkos::DefaultHostExecutionSpace> blend2(
"blend2", N);
439 Kokkos::DynRankView<pointValueType, Kokkos::DefaultHostExecutionSpace> blend3(
"blend3", N);
441 for (ordinal_type n=0;n<N;n++) {
442 blend1(n) = 4.0 * L2(n) * L3(n);
443 blend2(n) = 4.0 * L1(n) * L3(n);
444 blend3(n) = 4.0 * L1(n) * L2(n);
448 Kokkos::DynRankView<pointValueType, Kokkos::DefaultHostExecutionSpace> L3mL2(
"L3mL2", N);
449 Kokkos::DynRankView<pointValueType, Kokkos::DefaultHostExecutionSpace> L1mL3(
"L1mL3", N);
450 Kokkos::DynRankView<pointValueType, Kokkos::DefaultHostExecutionSpace> L2mL1(
"L2mL1", N);
452 for (ordinal_type k=0;k<N;k++) {
453 L3mL2(k) = L3(k)-L2(k);
454 L1mL3(k) = L1(k)-L3(k);
455 L2mL1(k) = L2(k)-L1(k);
458 Kokkos::DynRankView<pointValueType, Kokkos::DefaultHostExecutionSpace> warpfactor1(
"warpfactor1", N);
459 Kokkos::DynRankView<pointValueType, Kokkos::DefaultHostExecutionSpace> warpfactor2(
"warpfactor2", N);
460 Kokkos::DynRankView<pointValueType, Kokkos::DefaultHostExecutionSpace> warpfactor3(
"warpfactor3", N);
462 warpFactor( warpfactor1, order , gaussX , L3mL2 );
463 warpFactor( warpfactor2, order , gaussX , L1mL3 );
464 warpFactor( warpfactor3, order , gaussX , L2mL1 );
466 Kokkos::DynRankView<pointValueType, Kokkos::DefaultHostExecutionSpace> warp1(
"warp1", N);
467 Kokkos::DynRankView<pointValueType, Kokkos::DefaultHostExecutionSpace> warp2(
"warp2", N);
468 Kokkos::DynRankView<pointValueType, Kokkos::DefaultHostExecutionSpace> warp3(
"warp3", N);
470 for (ordinal_type k=0;k<N;k++) {
471 warp1(k) = blend1(k) * warpfactor1(k) *
472 ( 1.0 + alpha * alpha * L1(k) * L1(k) );
473 warp2(k) = blend2(k) * warpfactor2(k) *
474 ( 1.0 + alpha * alpha * L2(k) * L2(k) );
475 warp3(k) = blend3(k) * warpfactor3(k) *
476 ( 1.0 + alpha * alpha * L3(k) * L3(k) );
479 for (ordinal_type k=0;k<N;k++) {
480 X(k) += 1.0 * warp1(k) + cos( 2.0 * M_PI / 3.0 ) * warp2(k) + cos(4*M_PI/3.0) * warp3(k);
481 Y(k) += 0.0 * warp1(k) + sin( 2.0 * M_PI / 3.0 ) * warp2(k) + sin( 4*M_PI/3.0) * warp3(k);
484 Kokkos::DynRankView<pointValueType, Kokkos::DefaultHostExecutionSpace> warXY(
"warXY", 1, N,2);
486 for (ordinal_type k=0;k<N;k++) {
487 warXY(0, k,0) = X(k);
488 warXY(0, k,1) = Y(k);
493 Kokkos::DynRankView<pointValueType, Kokkos::DefaultHostExecutionSpace> warburtonVerts(
"warburtonVerts", 1,3,2);
494 warburtonVerts(0,0,0) = -1.0;
495 warburtonVerts(0,0,1) = -1.0/std::sqrt(3.0);
496 warburtonVerts(0,1,0) = 1.0;
497 warburtonVerts(0,1,1) = -1.0/std::sqrt(3.0);
498 warburtonVerts(0,2,0) = 0.0;
499 warburtonVerts(0,2,1) = 2.0/std::sqrt(3.0);
501 Kokkos::DynRankView<pointValueType, Kokkos::DefaultHostExecutionSpace> refPts(
"refPts", 1, N,2);
506 shards::getCellTopologyData< shards::Triangle<3> >()
510 auto pointsHost = Kokkos::create_mirror_view(Kokkos::HostSpace::memory_space(), points);
512 ordinal_type noffcur = 0;
513 ordinal_type offcur = 0;
514 for (ordinal_type i=0;i<=order;i++) {
515 for (ordinal_type j=0;j<=order-i;j++) {
516 if ( (i >= offset) && (i <= order-offset) &&
517 (j >= offset) && (j <= order-i-offset) ) {
518 pointsHost(offcur,0) = refPts(0, noffcur,0);
519 pointsHost(offcur,1) = refPts(0, noffcur,1);
526 Kokkos::deep_copy(points, pointsHost);
531 template<
typename pointValueType,
class ...pointProperties>
535 const ordinal_type order ,
536 const pointValueType pval ,
537 const Kokkos::DynRankView<pointValueType,pointProperties...> ,
538 const Kokkos::DynRankView<pointValueType,pointProperties...> L2,
539 const Kokkos::DynRankView<pointValueType,pointProperties...> L3,
540 const Kokkos::DynRankView<pointValueType,pointProperties...> L4
547 template<
typename pointValueType,
class ...pointProperties>
550 evalshift( Kokkos::DynRankView<pointValueType,pointProperties...> dxy,
551 const ordinal_type order ,
552 const pointValueType pval ,
553 const Kokkos::DynRankView<pointValueType,pointProperties...> L1 ,
554 const Kokkos::DynRankView<pointValueType,pointProperties...> L2 ,
555 const Kokkos::DynRankView<pointValueType,pointProperties...> L3
559 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> gaussX(
"gaussX",order+1,1);
562 const ordinal_type N = L1.extent(0);
565 for (ordinal_type k=0;k<=order;k++) {
570 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> blend1(
"blend1",N);
571 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> blend2(
"blend2",N);
572 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> blend3(
"blend3",N);
574 for (ordinal_type i=0;i<N;i++) {
575 blend1(i) = L2(i) * L3(i);
576 blend2(i) = L1(i) * L3(i);
577 blend3(i) = L1(i) * L2(i);
581 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> warpfactor1(
"warpfactor1",N);
582 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> warpfactor2(
"warpfactor2",N);
583 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> warpfactor3(
"warpfactor3",N);
586 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> L3mL2(
"L3mL2",N);
587 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> L1mL3(
"L1mL3",N);
588 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> L2mL1(
"L2mL1",N);
590 for (ordinal_type k=0;k<N;k++) {
591 L3mL2(k) = L3(k)-L2(k);
592 L1mL3(k) = L1(k)-L3(k);
593 L2mL1(k) = L2(k)-L1(k);
596 evalwarp( warpfactor1 , order , gaussX , L3mL2 );
597 evalwarp( warpfactor2 , order , gaussX , L1mL3 );
598 evalwarp( warpfactor3 , order , gaussX , L2mL1 );
600 for (ordinal_type k=0;k<N;k++) {
601 warpfactor1(k) *= 4.0;
602 warpfactor2(k) *= 4.0;
603 warpfactor3(k) *= 4.0;
606 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> warp1(
"warp1",N);
607 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> warp2(
"warp2",N);
608 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> warp3(
"warp3",N);
610 for (ordinal_type k=0;k<N;k++) {
611 warp1(k) = blend1(k) * warpfactor1(k) *
612 ( 1.0 + pval * pval * L1(k) * L1(k) );
613 warp2(k) = blend2(k) * warpfactor2(k) *
614 ( 1.0 + pval * pval * L2(k) * L2(k) );
615 warp3(k) = blend3(k) * warpfactor3(k) *
616 ( 1.0 + pval * pval * L3(k) * L3(k) );
619 for (ordinal_type k=0;k<N;k++) {
620 dxy(k,0) = 1.0 * warp1(k) + cos( 2.0 * M_PI / 3.0 ) * warp2(k) + cos( 4.0*M_PI/3.0 ) * warp3(k);
621 dxy(k,1) = 0.0 * warp1(k) + sin( 2.0 * M_PI / 3.0 ) * warp2(k) + sin( 4.0*M_PI/3.0 ) * warp3(k);
626 template<
typename pointValueType,
class ...pointProperties>
629 evalwarp(Kokkos::DynRankView<pointValueType,pointProperties...> warp ,
630 const ordinal_type order ,
631 const Kokkos::DynRankView<pointValueType,pointProperties...> xnodes,
632 const Kokkos::DynRankView<pointValueType,pointProperties...> xout )
634 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> xeq(
"xeq",order+1);
636 ordinal_type xout_dim0 = xout.extent(0);
637 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> d(
"d",xout_dim0);
641 for (ordinal_type i=0;i<=order;i++) {
642 xeq(i) = -1.0 + 2.0 * ( order - i ) / order;
645 for (ordinal_type i=0;i<=order;i++) {
646 Kokkos::deep_copy(d, xnodes(i,0) - xeq(i));
647 for (ordinal_type j=1;j<order;j++) {
649 for (ordinal_type k=0;k<xout_dim0;k++) {
650 d(k) = d(k) * (xout(k)-xeq(j))/(xeq(i)-xeq(j));
655 for (ordinal_type k=0;k<xout_dim0;k++) {
656 d(k) = -d(k)/(xeq(i)-xeq(0));
660 for (ordinal_type k=0;k<xout_dim0;k++) {
661 d(k) = d(k)/(xeq(i)-xeq(order));
665 for (ordinal_type k=0;k<xout_dim0;k++) {
672 template<
typename pointValueType,
class ...pointProperties>
676 const ordinal_type order ,
677 const ordinal_type offset )
679 pointValueType alphastore[] = { 0,0,0,0.1002, 1.1332,1.5608,1.3413,1.2577,1.1603,
680 1.10153,0.6080,0.4523,0.8856,0.8717,0.9655};
681 pointValueType alpha;
684 alpha = alphastore[std::max(order-1,0)];
690 const ordinal_type N = (order+1)*(order+2)*(order+3)/6;
691 pointValueType tol = 1.e-10;
693 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> shift(
"shift",N,3);
694 Kokkos::deep_copy(shift,0.0);
697 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> equipoints(
"equipoints", N,3);
699 for (ordinal_type n=0;n<=order;n++) {
700 for (ordinal_type m=0;m<=order-n;m++) {
701 for (ordinal_type q=0;q<=order-n-m;q++) {
702 equipoints(sk,0) = -1.0 + (q * 2.0 ) / order;
703 equipoints(sk,1) = -1.0 + (m * 2.0 ) / order;
704 equipoints(sk,2) = -1.0 + (n * 2.0 ) / order;
712 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> L1(
"L1",N);
713 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> L2(
"L2",N);
714 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> L3(
"L3",N);
715 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> L4(
"L4",N);
716 for (ordinal_type i=0;i<N;i++) {
717 L1(i) = (1.0 + equipoints(i,2)) / 2.0;
718 L2(i) = (1.0 + equipoints(i,1)) / 2.0;
719 L3(i) = -(1.0 + equipoints(i,0) + equipoints(i,1) + equipoints(i,2)) / 2.0;
720 L4(i) = (1.0 + equipoints(i,0)) / 2.0;
725 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> warVerts_(
"warVerts",1,4,3);
726 auto warVerts = Kokkos::subview(warVerts_,0,Kokkos::ALL(),Kokkos::ALL());
727 warVerts(0,0) = -1.0;
728 warVerts(0,1) = -1.0/sqrt(3.0);
729 warVerts(0,2) = -1.0/sqrt(6.0);
731 warVerts(1,1) = -1.0/sqrt(3.0);
732 warVerts(1,2) = -1.0/sqrt(6.0);
734 warVerts(2,1) = 2.0 / sqrt(3.0);
735 warVerts(2,2) = -1.0/sqrt(6.0);
738 warVerts(3,2) = 3.0 / sqrt(6.0);
742 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> t1(
"t1",4,3);
743 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> t2(
"t2",4,3);
744 for (ordinal_type i=0;i<3;i++) {
745 t1(0,i) = warVerts(1,i) - warVerts(0,i);
746 t1(1,i) = warVerts(1,i) - warVerts(0,i);
747 t1(2,i) = warVerts(2,i) - warVerts(1,i);
748 t1(3,i) = warVerts(2,i) - warVerts(0,i);
749 t2(0,i) = warVerts(2,i) - 0.5 * ( warVerts(0,i) + warVerts(1,i) );
750 t2(1,i) = warVerts(3,i) - 0.5 * ( warVerts(0,i) + warVerts(1,i) );
751 t2(2,i) = warVerts(3,i) - 0.5 * ( warVerts(1,i) + warVerts(2,i) );
752 t2(3,i) = warVerts(3,i) - 0.5 * ( warVerts(0,i) + warVerts(2,i) );
756 for (ordinal_type n=0;n<4;n++) {
758 pointValueType normt1n = 0.0;
759 pointValueType normt2n = 0.0;
760 for (ordinal_type i=0;i<3;i++) {
761 normt1n += (t1(n,i) * t1(n,i));
762 normt2n += (t2(n,i) * t2(n,i));
764 normt1n = sqrt(normt1n);
765 normt2n = sqrt(normt2n);
767 for (ordinal_type i=0;i<3;i++) {
774 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> XYZ(
"XYZ",N,3);
775 for (ordinal_type i=0;i<N;i++) {
776 for (ordinal_type j=0;j<3;j++) {
777 XYZ(i,j) = L3(i)*warVerts(0,j) + L4(i)*warVerts(1,j) + L2(i)*warVerts(2,j) + L1(i)*warVerts(3,j);
781 for (ordinal_type face=1;face<=4;face++) {
782 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> La, Lb, Lc, Ld;
783 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> warp(
"warp",N,2);
784 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> blend(
"blend",N);
785 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> denom(
"denom",N);
788 La = L1; Lb = L2; Lc = L3; Ld = L4;
break;
790 La = L2; Lb = L1; Lc = L3; Ld = L4;
break;
792 La = L3; Lb = L1; Lc = L4; Ld = L2;
break;
794 La = L4; Lb = L1; Lc = L3; Ld = L2;
break;
800 for (ordinal_type k=0;k<N;k++) {
801 blend(k) = Lb(k) * Lc(k) * Ld(k);
804 for (ordinal_type k=0;k<N;k++) {
805 denom(k) = (Lb(k) + 0.5 * La(k)) * (Lc(k) + 0.5*La(k)) * (Ld(k) + 0.5 * La(k));
808 for (ordinal_type k=0;k<N;k++) {
809 if (denom(k) > tol) {
810 blend(k) *= ( 1.0 + alpha * alpha * La(k) * La(k) ) / denom(k);
816 for (ordinal_type k=0;k<N;k++) {
817 for (ordinal_type j=0;j<3;j++) {
818 shift(k,j) = shift(k,j) + blend(k) * warp(k,0) * t1(face-1,j)
819 + blend(k) * warp(k,1) * t2(face-1,j);
823 for (ordinal_type k=0;k<N;k++) {
824 if (La(k) < tol && ( Lb(k) < tol || Lc(k) < tol || Ld(k) < tol )) {
825 for (ordinal_type j=0;j<3;j++) {
826 shift(k,j) = warp(k,0) * t1(face-1,j) + warp(k,1) * t2(face-1,j);
833 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> updatedPoints(
"updatedPoints",1,N,3);
834 for (ordinal_type k=0;k<N;k++) {
835 for (ordinal_type j=0;j<3;j++) {
836 updatedPoints(0,k,j) = XYZ(k,j) + shift(k,j);
843 Kokkos::DynRankView<pointValueType,Kokkos::DefaultHostExecutionSpace> refPts(
"refPts",1,N,3);
846 shards::getCellTopologyData<shards::Tetrahedron<4> >()
849 auto pointsHost = Kokkos::create_mirror_view(Kokkos::HostSpace::memory_space(), points);
851 ordinal_type noffcur = 0;
852 ordinal_type offcur = 0;
853 for (ordinal_type i=0;i<=order;i++) {
854 for (ordinal_type j=0;j<=order-i;j++) {
855 for (ordinal_type k=0;k<=order-i-j;k++) {
856 if ( (i >= offset) && (i <= order-offset) &&
857 (j >= offset) && (j <= order-i-offset) &&
858 (k >= offset) && (k <= order-i-j-offset) ) {
859 pointsHost(offcur,0) = refPts(0,noffcur,0);
860 pointsHost(offcur,1) = refPts(0,noffcur,1);
861 pointsHost(offcur,2) = refPts(0,noffcur,2);
869 Kokkos::deep_copy(points, pointsHost);
Gauss-Jacobi/Gauss-Radau-Jacobi/Gauss-Lobatto zeros and weights.