Intrepid2
Intrepid2_ProjectionTools.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Intrepid2 Package
4 //
5 // Copyright 2007 NTESS and the Intrepid2 contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
14 #ifndef __INTREPID2_PROJECTIONTOOLS_HPP__
15 #define __INTREPID2_PROJECTIONTOOLS_HPP__
16 
17 #include "Intrepid2_ConfigDefs.hpp"
18 #include "Intrepid2_Types.hpp"
19 #include "Intrepid2_Utils.hpp"
20 
21 #include "Shards_CellTopology.hpp"
22 #include "Shards_BasicTopologies.hpp"
23 
24 #include "Intrepid2_PointTools.hpp"
25 
26 #include "Intrepid2_Basis.hpp"
27 
29 
30 // -- Lower order family
33 
36 
40 
44 
45 #include "Teuchos_LAPACK.hpp"
47 
49 
50 #ifdef HAVE_INTREPID2_KOKKOSKERNELS
51 #include "KokkosBatched_QR_Serial_Internal.hpp"
52 #include "KokkosBatched_ApplyQ_Serial_Internal.hpp"
53 #if KOKKOS_VERSION >= 40599
54 #include "KokkosBatched_Trsv_Decl.hpp"
55 #else
56 #include "KokkosBatched_Trsv_Serial_Internal.hpp"
57 #endif
58 #include "KokkosBatched_Util.hpp"
59 #endif
60 
61 namespace Intrepid2 {
62 
115 template<typename DeviceType>
117 public:
118  using ExecSpaceType = typename DeviceType::execution_space;
119  using MemSpaceType = typename DeviceType::memory_space;
120  using EvalPointsType = typename ProjectionStruct<DeviceType, double>::EvalPointsType;
121 
122 
142  template<typename basisCoeffsValueType, class ...basisCoeffsProperties,
143  typename funValsValueType, class ...funValsProperties,
144  typename BasisType,
145  typename ortValueType, class ...ortProperties>
146  static void
147  getL2BasisCoeffs(Kokkos::DynRankView<basisCoeffsValueType,basisCoeffsProperties...> basisCoeffs,
148  const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetAtEvalPoints,
149  const Kokkos::DynRankView<ortValueType, ortProperties...> cellOrientations,
150  const BasisType* cellBasis,
152 
153 
177  template<typename basisCoeffsValueType, class ...basisCoeffsProperties,
178  typename funValsValueType, class ...funValsProperties,
179  typename BasisType,
180  typename ortValueType, class ...ortProperties>
181  static void
182  getL2DGBasisCoeffs(Kokkos::DynRankView<basisCoeffsValueType,basisCoeffsProperties...> basisCoeffs,
183  const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetAtEvalPoints,
184  const Kokkos::DynRankView<ortValueType, ortProperties...> cellOrientations,
185  const BasisType* cellBasis,
187 
188 
211  template<typename basisViewType, typename targetViewType, typename BasisType>
212  static void
213  getL2DGBasisCoeffs(basisViewType basisCoeffs,
214  const targetViewType targetAtTargetEPoints,
215  const BasisType* cellBasis,
217 
239  template<class BasisCoeffsViewType, class TargetValueViewType, class TargetGradViewType,
240  class BasisType, class OrientationViewType>
241  static void
242  getHGradBasisCoeffs(BasisCoeffsViewType basisCoeffs,
243  const TargetValueViewType targetAtEvalPoints,
244  const TargetGradViewType targetGradAtGradEvalPoints,
245  const OrientationViewType cellOrientations,
246  const BasisType* cellBasis,
248 
249 
273  template<typename basisCoeffsValueType, class ...basisCoeffsProperties,
274  typename funValsValueType, class ...funValsProperties,
275  typename BasisType,
276  typename ortValueType, class ...ortProperties>
277  static void
278  getHCurlBasisCoeffs(Kokkos::DynRankView<basisCoeffsValueType,basisCoeffsProperties...> basisCoeffs,
279  const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetAtEvalPoints,
280  const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetCurlAtCurlEvalPoints,
281  const Kokkos::DynRankView<ortValueType, ortProperties...> cellOrientations,
282  const BasisType* cellBasis,
284 
306  template<typename basisCoeffsValueType, class ...basisCoeffsProperties,
307  typename funValsValueType, class ...funValsProperties,
308  typename BasisType,
309  typename ortValueType, class ...ortProperties>
310  static void
311  getHDivBasisCoeffs(Kokkos::DynRankView<basisCoeffsValueType,basisCoeffsProperties...> basisCoeffs,
312  const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetAtEvalPoints,
313  const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetDivAtDivEvalPoints,
314  const Kokkos::DynRankView<ortValueType, ortProperties...> cellOrientations,
315  const BasisType* cellBasis,
317 
318 
336  template<typename basisCoeffsValueType, class ...basisCoeffsProperties,
337  typename funValsValueType, class ...funValsProperties,
338  typename BasisType,
339  typename ortValueType, class ...ortProperties>
340  static void
341  getHVolBasisCoeffs(Kokkos::DynRankView<basisCoeffsValueType,basisCoeffsProperties...> basisCoeffs,
342  const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetAtEvalPoints,
343  [[maybe_unused]] const Kokkos::DynRankView<ortValueType, ortProperties...> cellOrientations,
344  const BasisType* cellBasis,
346 
347 
348 
364  template<typename dstViewType,
365  typename dstBasisType,
366  typename srcViewType,
367  typename srcBasisType,
368  typename OrientationViewType>
369  static void
370  projectField(dstViewType dstCoeffs,
371  const dstBasisType* dstBasis,
372  const srcViewType srcCoeffs,
373  const srcBasisType* srcBasis,
374  const OrientationViewType cellOrientations){
375 
376 
377  INTREPID2_TEST_FOR_EXCEPTION(dstBasis->getFunctionSpace() != srcBasis->getFunctionSpace(), std::runtime_error,
378  "The source and destination bases are not compatible. They need to belong to the same function space");
379  INTREPID2_TEST_FOR_EXCEPTION(dstBasis->getBaseCellTopology().getKey() != srcBasis->getBaseCellTopology().getKey(), std::runtime_error,
380  "The source and destination bases are not compatible. They do not have the same basic cell topology");
381 
383  projStruct.createL2ProjectionStruct(dstBasis, srcBasis->getDegree());
384 
385 
386  ordinal_type numCells = cellOrientations.extent(0);
387  ordinal_type dim = srcBasis->getBaseCellTopology().getDimension();
388  ordinal_type srcBasisCardinality = srcBasis->getCardinality();
389  ordinal_type fieldDimension = (srcBasis->getFunctionSpace() == Intrepid2::FUNCTION_SPACE_HCURL || srcBasis->getFunctionSpace() == Intrepid2::FUNCTION_SPACE_HDIV) ? dim : 1;
390 
391  auto evaluationPoints = projStruct.getAllEvalPoints();
392  ordinal_type numPoints = evaluationPoints.extent(0);
393 
394  using outViewType = Kokkos::DynRankView<typename srcBasisType::OutputValueType, DeviceType>;
395  outViewType srcAtEvalPoints, refBasisAtEvalPoints, basisAtEvalPoints;
396  if(fieldDimension == dim) {
397  srcAtEvalPoints = outViewType("srcAtEvalPoints", numCells, numPoints, dim);
398  refBasisAtEvalPoints = outViewType("refBasisAtEvalPoints", srcBasisCardinality, numPoints, dim);
399  basisAtEvalPoints = outViewType("basisAtEvalPoints", numCells, srcBasisCardinality, numPoints, dim);
400  } else {
401  srcAtEvalPoints = outViewType("srcAtEvalPoints", numCells, numPoints);
402  refBasisAtEvalPoints = outViewType("refBasisAtEvalPoints", srcBasisCardinality, numPoints);
403  basisAtEvalPoints = outViewType("basisAtEvalPoints", numCells, srcBasisCardinality, numPoints);
404  }
405 
406  srcBasis->getValues(refBasisAtEvalPoints,evaluationPoints);
407 
408  // Modify basis values to account for orientations
410  refBasisAtEvalPoints,
411  cellOrientations,
412  srcBasis);
413 
414  Kokkos::parallel_for(Kokkos::RangePolicy<typename DeviceType::execution_space>(0,numCells),
415  KOKKOS_LAMBDA (const int &ic) {
416  for(int j=0; j<numPoints; ++j) {
417  for(int k=0; k<srcBasisCardinality; ++k) {
418  for(int d=0; d<fieldDimension; ++d)
419  srcAtEvalPoints.access(ic,j,d) += srcCoeffs(ic,k)*basisAtEvalPoints.access(ic,k,j,d);
420  }
421  }
422  });
423  ExecSpaceType().fence();
424 
425  getL2BasisCoeffs(dstCoeffs,
426  srcAtEvalPoints,
427  cellOrientations,
428  dstBasis,
429  &projStruct);
430  }
431 
432 
433 
443  struct ElemSystem {
444 
445 
446  std::string systemName_;
447  bool matrixIndependentOfCell_;
448 
456  ElemSystem (std::string systemName, bool matrixIndependentOfCell) :
457  systemName_(systemName), matrixIndependentOfCell_(matrixIndependentOfCell){};
458 
459 
460 
486  template<typename ViewType1, typename ViewType2, typename ViewType3, typename ViewType4>
487  void solve(ViewType1 basisCoeffs, ViewType2 elemMat, ViewType2 elemRhs, ViewType2 tau,
488  ViewType3 w,const ViewType4 elemDof, ordinal_type n, ordinal_type m=0) {
489 #ifdef HAVE_INTREPID2_KOKKOSKERNELS
490  solveDevice(basisCoeffs, elemMat, elemRhs, tau,
491  w, elemDof, n, m);
492 #else
493  solveHost(basisCoeffs, elemMat, elemRhs, tau,
494  w, elemDof, n, m);
495 #endif
496 
497  }
498 
501 #ifdef HAVE_INTREPID2_KOKKOSKERNELS
502  template<typename ViewType1, typename ViewType2, typename ViewType3, typename ViewType4>
503  void solveDevice(ViewType1 basisCoeffs, ViewType2 elemMat, ViewType2 elemRhs, ViewType2 taul,
504  ViewType3 work,const ViewType4 elemDof, ordinal_type n, ordinal_type m) {
505  using HostDeviceType = Kokkos::Device<Kokkos::DefaultHostExecutionSpace,Kokkos::HostSpace>;
506 
507  ordinal_type numCells = basisCoeffs.extent(0);
508 
509  if(matrixIndependentOfCell_) {
510  auto A0 = Kokkos::subview(elemMat, 0, Kokkos::ALL(), Kokkos::ALL());
511  auto tau0 = Kokkos::subview(taul, 0, Kokkos::ALL());
512 
513  Kokkos::DynRankView<typename ViewType2::value_type, HostDeviceType> A0_host("A0_host", A0.extent(0),A0.extent(1));
514  auto A0_device = Kokkos::create_mirror_view(typename DeviceType::memory_space(), A0_host);
515  Kokkos::deep_copy(A0_device, A0);
516  Kokkos::deep_copy(A0_host, A0_device);
517 
518  for(ordinal_type i=n; i<n+m; ++i)
519  for(ordinal_type j=0; j<n; ++j)
520  A0_host(i,j) = A0_host(j,i);
521 
522  Kokkos::DynRankView<typename ViewType2::value_type, HostDeviceType> tau0_host("A0_host", tau0.extent(0));
523  auto tau0_device = Kokkos::create_mirror_view(typename DeviceType::memory_space(), tau0_host);
524  auto w0_host = Kokkos::create_mirror_view(Kokkos::subview(work, 0, Kokkos::ALL()));
525 
526  //computing QR of A0. QR is saved in A0 and tau0
527 #if KOKKOS_VERSION >= 40599
528  KokkosBatched::Impl::SerialQR_Internal::invoke
529 #else
530  KokkosBatched::SerialQR_Internal::invoke
531 #endif
532  (A0_host.extent(0), A0_host.extent(1),
533  A0_host.data(), A0_host.stride_0(), A0_host.stride_1(),
534  tau0_host.data(), tau0_host.stride_0(), w0_host.data());
535 
536  Kokkos::deep_copy(A0_device, A0_host);
537  Kokkos::deep_copy(A0, A0_device);
538  Kokkos::deep_copy(tau0_device, tau0_host);
539  Kokkos::deep_copy(tau0, tau0_device);
540 
541  Kokkos::parallel_for (systemName_,
542  Kokkos::RangePolicy<ExecSpaceType, int> (0, numCells),
543  KOKKOS_LAMBDA (const size_t ic) {
544  auto w = Kokkos::subview(work, ic, Kokkos::ALL());
545 
546  auto b = Kokkos::subview(elemRhs, ic, Kokkos::ALL());
547 
548  //b'*Q0 -> b
549  KokkosBatched::SerialApplyQ_RightForwardInternal::invoke(
550  1, A0.extent(0), A0.extent(1),
551  A0.data(), A0.stride_0(), A0.stride_1(),
552  tau0.data(), tau0.stride_0(),
553  b.data(), 1, b.stride_0(),
554  w.data());
555 
556  // R0^{-1} b -> b
557 #if KOKKOS_VERSION >= 40599
558  KokkosBatched::SerialTrsv<KokkosBatched::Uplo::Upper, KokkosBatched::Trans::NoTranspose, KokkosBatched::Diag::NonUnit, KokkosBatched::Algo::Trsv::Unblocked>::invoke(1.0, A0, b);
559 #else
560  KokkosBatched::SerialTrsvInternalUpper<KokkosBatched::Algo::Trsv::Unblocked>::invoke(false,
561  A0.extent(0),
562  1.0,
563  A0.data(), A0.stride_0(), A0.stride_1(),
564  b.data(), b.stride_0());
565 #endif
566 
567  //scattering b into the basis coefficients
568  for(ordinal_type i=0; i<n; ++i){
569  basisCoeffs(ic,elemDof(i)) = b(i);
570  }
571  });
572 
573  } else {
574 
575  Kokkos::parallel_for (systemName_,
576  Kokkos::RangePolicy<ExecSpaceType, int> (0, numCells),
577  KOKKOS_LAMBDA (const size_t ic) {
578 
579  auto A = Kokkos::subview(elemMat, ic, Kokkos::ALL(), Kokkos::ALL());
580  auto tau = Kokkos::subview(taul, ic, Kokkos::ALL());
581  auto w = Kokkos::subview(work, ic, Kokkos::ALL());
582 
583  for(ordinal_type i=n; i<n+m; ++i)
584  for(ordinal_type j=0; j<n; ++j)
585  A(i,j) = A(j,i);
586 
587  //computing QR of A. QR is saved in A and tau
588 #if KOKKOS_VERSION >= 40599
589  KokkosBatched::Impl::SerialQR_Internal::invoke
590 #else
591  KokkosBatched::SerialQR_Internal::invoke
592 #endif
593  (A.extent(0), A.extent(1),
594  A.data(), A.stride_0(), A.stride_1(), tau.data(), tau.stride_0(), w.data());
595 
596  auto b = Kokkos::subview(elemRhs, ic, Kokkos::ALL());
597 
598  //b'*Q -> b
599  KokkosBatched::SerialApplyQ_RightForwardInternal::invoke(
600  1, A.extent(0), A.extent(1),
601  A.data(), A.stride_0(), A.stride_1(),
602  tau.data(), tau.stride_0(),
603  b.data(), 1, b.stride_0(),
604  w.data());
605 
606  // R^{-1} b -> b
607 #if KOKKOS_VERSION >= 40599
608  KokkosBatched::SerialTrsv<KokkosBatched::Uplo::Upper, KokkosBatched::Trans::NoTranspose, KokkosBatched::Diag::NonUnit, KokkosBatched::Algo::Trsv::Unblocked>::invoke(1.0, A, b);
609 #else
610  KokkosBatched::SerialTrsvInternalUpper<KokkosBatched::Algo::Trsv::Unblocked>::invoke(false,
611  A.extent(0),
612  1.0,
613  A.data(), A.stride_0(), A.stride_1(),
614  b.data(), b.stride_0());
615 #endif
616 
617  //scattering b into the basis coefficients
618  for(ordinal_type i=0; i<n; ++i){
619  basisCoeffs(ic,elemDof(i)) = b(i);
620  }
621  });
622  }
623  }
624 #endif
625 
629  template<typename ViewType1, typename ViewType2, typename ViewType3, typename ViewType4>
630  void solveHost(ViewType1 basisCoeffs, ViewType2 elemMat, ViewType2 elemRhs, ViewType2 ,
631  ViewType3, const ViewType4 elemDof, ordinal_type n, ordinal_type m) {
632  using value_type = typename ViewType2::value_type;
633  using device_type = DeviceType;
634  using host_exec_space = Kokkos::DefaultHostExecutionSpace;
635  using host_memory_space = Kokkos::HostSpace;
636  using host_device_type = Kokkos::Device<host_exec_space,host_memory_space>;
637  using vector_host_type = Kokkos::View<value_type*,host_device_type>;
638  using scratch_host_type = Kokkos::View<value_type*,host_exec_space::scratch_memory_space>;
639  using matrix_host_type = Kokkos::View<value_type**,Kokkos::LayoutLeft,host_device_type>;
640  using do_not_init_tag = Kokkos::ViewAllocateWithoutInitializing;
641  using host_team_policy_type = Kokkos::TeamPolicy<host_exec_space>;
642  using host_range_policy_type = Kokkos::RangePolicy<host_exec_space>;
643 
645  Kokkos::fence();
646 
648  const ordinal_type numCells = basisCoeffs.extent(0);
649  const ordinal_type numRows = m+n, numCols = n;
650 
652  Teuchos::LAPACK<ordinal_type,value_type> lapack;
653 
655  Kokkos::View<ordinal_type*,host_device_type> elemDof_host(do_not_init_tag("elemDof_host"), elemDof.extent(0));
656  {
657  auto elemDof_device = Kokkos::create_mirror_view(typename device_type::memory_space(), elemDof_host);
658  Kokkos::deep_copy(elemDof_device, elemDof); Kokkos::fence();
659  Kokkos::deep_copy(elemDof_host, elemDof_device);
660  }
661 
663  auto elemRhs_host = Kokkos::create_mirror_view_and_copy(host_memory_space(), elemRhs);
664  auto elemMat_host = Kokkos::create_mirror_view_and_copy(host_memory_space(), elemMat);
665 
667  auto basisCoeffs_host = Kokkos::create_mirror_view_and_copy(host_memory_space(), basisCoeffs);
668 
669  if (matrixIndependentOfCell_) {
671  matrix_host_type A(do_not_init_tag("A"), numRows, numRows);
672  {
673  for (ordinal_type j=0;j<numRows;++j)
674  for (ordinal_type i=0;i<numRows;++i)
675  A(i, j) = elemMat_host(0, i, j);
676 
677  for (ordinal_type j=0;j<numCols;++j)
678  for (ordinal_type i=numCols;i<numRows;++i)
679  A(i, j) = A(j, i);
680  }
681 
682  ordinal_type lwork(-1);
683  {
684  ordinal_type info(0);
685  value_type work[2];
686  lapack.GELS('N',
687  numRows, numRows, numCells,
688  nullptr, std::max(1,numRows),
689  nullptr, std::max(1,numRows),
690  &work[0], lwork,
691  &info);
692  lwork = work[0];
693  }
694 
695  matrix_host_type C(do_not_init_tag("C"), numRows, numCells);
696 
697  host_range_policy_type policy(0, numCells);
698  {
699  Kokkos::parallel_for
700  ("ProjectionTools::solveHost::matrixIndependentOfCell::pack",
701  policy, [=](const ordinal_type & ic) {
702  for (ordinal_type i=0;i<numRows;++i)
703  C(i,ic) = elemRhs_host(ic, i);
704  });
705  }
706  {
708  vector_host_type work(do_not_init_tag("work"), lwork);
709  ordinal_type info(0);
710  lapack.GELS('N',
711  numRows, numRows, numCells,
712  A.data(), std::max(1,numRows),
713  C.data(), std::max(1,numRows),
714  work.data(), lwork,
715  &info);
716  INTREPID2_TEST_FOR_EXCEPTION
717  (info != 0, std::runtime_error, "GELS return non-zero info code");
718  }
719  {
720  Kokkos::parallel_for
721  ("ProjectionTools::solveHost::matrixIndependentOfCell::unpack",
722  policy, [=](const ordinal_type & ic) {
723  for (ordinal_type i=0;i<numCols;++i)
724  basisCoeffs_host(ic,elemDof_host(i)) = C(i,ic);
725  });
726  }
727  } else {
728  const ordinal_type level(0);
729  host_team_policy_type policy(numCells, 1, 1);
730 
732  ordinal_type lwork(-1);
733  {
734  ordinal_type info(0);
735  value_type work[2];
736  lapack.GELS('N',
737  numRows, numRows, 1,
738  nullptr, std::max(1,numRows),
739  nullptr, std::max(1,numRows),
740  &work[0], lwork,
741  &info);
742  lwork = work[0];
743  }
744 
745  const ordinal_type per_team_extent = numRows*numRows + numRows + lwork;
746  const ordinal_type per_team_scratch = scratch_host_type::shmem_size(per_team_extent);
747  policy.set_scratch_size(level, Kokkos::PerTeam(per_team_scratch));
748 
750  Kokkos::parallel_for
751  ("ProjectionTools::solveHost::matrixDependentOfCell",
752  policy, [=](const typename host_team_policy_type::member_type& member) {
753  const ordinal_type ic = member.league_rank();
754 
755  scratch_host_type scratch(member.team_scratch(level), per_team_extent);
756  value_type * sptr = scratch.data();
757 
759  matrix_host_type A(sptr, numRows, numRows); sptr += A.span();
760  for (ordinal_type j=0;j<numRows;++j)
761  for (ordinal_type i=0;i<numRows;++i)
762  A(i, j) = elemMat_host(ic, i, j);
763 
764  for (ordinal_type j=0;j<numCols;++j)
765  for (ordinal_type i=numCols;i<numRows;++i)
766  A(i, j) = A(j, i);
767 
768  vector_host_type c(sptr, numRows); sptr += c.span();
769  for (ordinal_type i=0;i<numRows;++i)
770  c(i) = elemRhs_host(ic, i);
771 
772  vector_host_type work(sptr, lwork); sptr += work.span();
773  ordinal_type info(0);
774  lapack.GELS('N',
775  numRows, numRows, 1,
776  A.data(), std::max(1,numRows),
777  c.data(), std::max(1,numRows),
778  work.data(), lwork,
779  &info);
780  INTREPID2_TEST_FOR_EXCEPTION
781  (info != 0, std::runtime_error, "GELS return non-zero info code");
782 
784  for (ordinal_type i=0;i<numCols;++i)
785  basisCoeffs_host(ic,elemDof_host(i)) = c(i);
786  });
787  }
788  Kokkos::deep_copy(basisCoeffs, basisCoeffs_host);
789  }
790  };
791 
792 };
793 
794 } //Intrepid2
795 
796 
797 // include templated function definitions
803 
804 #endif
805 
806 
807 
808 
809 
static void getHCurlBasisCoeffs(Kokkos::DynRankView< basisCoeffsValueType, basisCoeffsProperties...> basisCoeffs, const Kokkos::DynRankView< funValsValueType, funValsProperties...> targetAtEvalPoints, const Kokkos::DynRankView< funValsValueType, funValsProperties...> targetCurlAtCurlEvalPoints, const Kokkos::DynRankView< ortValueType, ortProperties...> cellOrientations, const BasisType *cellBasis, ProjectionStruct< DeviceType, typename BasisType::scalarType > *projStruct)
Computes the basis coefficients of the HCurl projection of the target function.
static void getHGradBasisCoeffs(BasisCoeffsViewType basisCoeffs, const TargetValueViewType targetAtEvalPoints, const TargetGradViewType targetGradAtGradEvalPoints, const OrientationViewType cellOrientations, const BasisType *cellBasis, ProjectionStruct< DeviceType, typename BasisType::scalarType > *projStruct)
Computes the basis coefficients of the HGrad projection of the target function.
Header file for the Intrepid2::Basis_HDIV_TET_I1_FEM class.
Header file for the Intrepid2::Basis_HDIV_HEX_I1_FEM class.
Header file for the Intrepid2::Basis_HDIV_WEDGE_I1_FEM class.
Header file for the Intrepid2::ProjectionTools containing definitions for HCURL projections.
void solve(ViewType1 basisCoeffs, ViewType2 elemMat, ViewType2 elemRhs, ViewType2 tau, ViewType3 w, const ViewType4 elemDof, ordinal_type n, ordinal_type m=0)
Solve the system and returns the basis coefficients solve the system either using Kokkos Kernel QR or...
Header file for the Intrepid2::ProjectionTools containing definitions for L2 projections.
static void getHDivBasisCoeffs(Kokkos::DynRankView< basisCoeffsValueType, basisCoeffsProperties...> basisCoeffs, const Kokkos::DynRankView< funValsValueType, funValsProperties...> targetAtEvalPoints, const Kokkos::DynRankView< funValsValueType, funValsProperties...> targetDivAtDivEvalPoints, const Kokkos::DynRankView< ortValueType, ortProperties...> cellOrientations, const BasisType *cellBasis, ProjectionStruct< DeviceType, typename BasisType::scalarType > *projStruct)
Computes the basis coefficients of the HDiv projection of the target function.
Header function for Intrepid2::Util class and other utility functions.
Header file for the Intrepid2::Basis_HDIV_QUAD_I1_FEM class.
void solveHost(ViewType1 basisCoeffs, ViewType2 elemMat, ViewType2 elemRhs, ViewType2, ViewType3, const ViewType4 elemDof, ordinal_type n, ordinal_type m)
Parallel implementation of solve, using Kokkos Kernels QR factoriation.
static void getL2DGBasisCoeffs(Kokkos::DynRankView< basisCoeffsValueType, basisCoeffsProperties...> basisCoeffs, const Kokkos::DynRankView< funValsValueType, funValsProperties...> targetAtEvalPoints, const Kokkos::DynRankView< ortValueType, ortProperties...> cellOrientations, const BasisType *cellBasis, ProjectionStruct< DeviceType, typename BasisType::scalarType > *projStruct)
Computes evaluation points for local L2 projection for broken HGRAD HCURL HDIV and HVOL spaces...
A class providing static members to perform projection-based interpolations:
Header file for the Intrepid2::Basis_HDIV_TRI_I1_FEM class.
static void modifyBasisByOrientation(Kokkos::DynRankView< outputValueType, outputProperties...> output, const Kokkos::DynRankView< inputValueType, inputProperties...> input, const OrientationViewType orts, const BasisType *basis, const bool transpose=false)
Modify basis due to orientation.
Header file for the Intrepid2::OrientationTools and Intrepid2::Impl::OrientationTools classes...
Header file for the Intrepid2::ProjectionTools containing definitions for HDIV projections.
Contains definitions of custom data types in Intrepid2.
ElemSystem(std::string systemName, bool matrixIndependentOfCell)
Functor constructor.
Header file for the Intrepid2::ProjectionStruct.
Header file for the Intrepid2::ProjectionTools containing definitions for HGRAD projections.
void createL2ProjectionStruct(const BasisPtrType cellBasis, const ordinal_type targetCubDegree)
Initialize the ProjectionStruct for L2 projections.
Header file for the Intrepid2::Basis_HCURL_QUAD_I1_FEM class.
static void getHVolBasisCoeffs(Kokkos::DynRankView< basisCoeffsValueType, basisCoeffsProperties...> basisCoeffs, const Kokkos::DynRankView< funValsValueType, funValsProperties...> targetAtEvalPoints, [[maybe_unused]] const Kokkos::DynRankView< ortValueType, ortProperties...> cellOrientations, const BasisType *cellBasis, ProjectionStruct< DeviceType, typename BasisType::scalarType > *projStruct)
Computes the basis coefficients of the HVol projection of the target function.
Header file for the Intrepid2::Basis_HCURL_WEDGE_I1_FEM class.
Header file for the Intrepid2::Basis_HCURL_TET_I1_FEM class.
Header file for the Intrepid2::Basis_HCURL_HEX_I1_FEM class.
Header file for the Intrepid2::ProjectionTools containing definitions for HVOL projections.
static void getL2BasisCoeffs(Kokkos::DynRankView< basisCoeffsValueType, basisCoeffsProperties...> basisCoeffs, const Kokkos::DynRankView< funValsValueType, funValsProperties...> targetAtEvalPoints, const Kokkos::DynRankView< ortValueType, ortProperties...> cellOrientations, const BasisType *cellBasis, ProjectionStruct< DeviceType, typename BasisType::scalarType > *projStruct)
Computes the basis coefficients of the L2 projection of the target function.
Header file for the Intrepid2::Basis_HCURL_TRI_I1_FEM class.
Class to solve a square system A x = b on each cell A is expected to be saddle a point (KKT) matrix o...
An helper class to compute the evaluation points and weights needed for performing projections...
Stateless class that acts as a factory for a family of nodal bases (hypercube topologies only at this...
static void projectField(dstViewType dstCoeffs, const dstBasisType *dstBasis, const srcViewType srcCoeffs, const srcBasisType *srcBasis, const OrientationViewType cellOrientations)
Computes the L2 projection of a finite element field into a compatible finite element space...
Header file for the abstract base class Intrepid2::Basis.
Header file for Intrepid2::PointTools class to provide utilities for barycentric coordinates, equispaced lattices, and warp-blend point distrubtions.