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 #include "KokkosBatched_Trsv_Serial_Internal.hpp"
54 #include "KokkosBatched_Util.hpp"
55 #endif
56 
57 namespace Intrepid2 {
58 
111 template<typename DeviceType>
113 public:
114  using ExecSpaceType = typename DeviceType::execution_space;
115  using MemSpaceType = typename DeviceType::memory_space;
116  using EvalPointsType = typename ProjectionStruct<DeviceType, double>::EvalPointsType;
117 
118 
138  template<typename basisCoeffsValueType, class ...basisCoeffsProperties,
139  typename funValsValueType, class ...funValsProperties,
140  typename BasisType,
141  typename ortValueType, class ...ortProperties>
142  static void
143  getL2BasisCoeffs(Kokkos::DynRankView<basisCoeffsValueType,basisCoeffsProperties...> basisCoeffs,
144  const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetAtEvalPoints,
145  const Kokkos::DynRankView<ortValueType, ortProperties...> cellOrientations,
146  const BasisType* cellBasis,
148 
149 
173  template<typename basisCoeffsValueType, class ...basisCoeffsProperties,
174  typename funValsValueType, class ...funValsProperties,
175  typename BasisType,
176  typename ortValueType, class ...ortProperties>
177  static void
178  getL2DGBasisCoeffs(Kokkos::DynRankView<basisCoeffsValueType,basisCoeffsProperties...> basisCoeffs,
179  const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetAtEvalPoints,
180  const Kokkos::DynRankView<ortValueType, ortProperties...> cellOrientations,
181  const BasisType* cellBasis,
183 
184 
207  template<typename basisViewType, typename targetViewType, typename BasisType>
208  static void
209  getL2DGBasisCoeffs(basisViewType basisCoeffs,
210  const targetViewType targetAtTargetEPoints,
211  const BasisType* cellBasis,
213 
235  template<class BasisCoeffsViewType, class TargetValueViewType, class TargetGradViewType,
236  class BasisType, class OrientationViewType>
237  static void
238  getHGradBasisCoeffs(BasisCoeffsViewType basisCoeffs,
239  const TargetValueViewType targetAtEvalPoints,
240  const TargetGradViewType targetGradAtGradEvalPoints,
241  const OrientationViewType cellOrientations,
242  const BasisType* cellBasis,
244 
245 
269  template<typename basisCoeffsValueType, class ...basisCoeffsProperties,
270  typename funValsValueType, class ...funValsProperties,
271  typename BasisType,
272  typename ortValueType, class ...ortProperties>
273  static void
274  getHCurlBasisCoeffs(Kokkos::DynRankView<basisCoeffsValueType,basisCoeffsProperties...> basisCoeffs,
275  const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetAtEvalPoints,
276  const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetCurlAtCurlEvalPoints,
277  const Kokkos::DynRankView<ortValueType, ortProperties...> cellOrientations,
278  const BasisType* cellBasis,
280 
302  template<typename basisCoeffsValueType, class ...basisCoeffsProperties,
303  typename funValsValueType, class ...funValsProperties,
304  typename BasisType,
305  typename ortValueType, class ...ortProperties>
306  static void
307  getHDivBasisCoeffs(Kokkos::DynRankView<basisCoeffsValueType,basisCoeffsProperties...> basisCoeffs,
308  const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetAtEvalPoints,
309  const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetDivAtDivEvalPoints,
310  const Kokkos::DynRankView<ortValueType, ortProperties...> cellOrientations,
311  const BasisType* cellBasis,
313 
314 
332  template<typename basisCoeffsValueType, class ...basisCoeffsProperties,
333  typename funValsValueType, class ...funValsProperties,
334  typename BasisType,
335  typename ortValueType, class ...ortProperties>
336  static void
337  getHVolBasisCoeffs(Kokkos::DynRankView<basisCoeffsValueType,basisCoeffsProperties...> basisCoeffs,
338  const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetAtEvalPoints,
339  [[maybe_unused]] const Kokkos::DynRankView<ortValueType, ortProperties...> cellOrientations,
340  const BasisType* cellBasis,
342 
343 
344 
360  template<typename dstViewType,
361  typename dstBasisType,
362  typename srcViewType,
363  typename srcBasisType,
364  typename OrientationViewType>
365  static void
366  projectField(dstViewType dstCoeffs,
367  const dstBasisType* dstBasis,
368  const srcViewType srcCoeffs,
369  const srcBasisType* srcBasis,
370  const OrientationViewType cellOrientations){
371 
372 
373  INTREPID2_TEST_FOR_EXCEPTION(dstBasis->getFunctionSpace() != srcBasis->getFunctionSpace(), std::runtime_error,
374  "The source and destination bases are not compatible. They need to belong to the same function space");
375  INTREPID2_TEST_FOR_EXCEPTION(dstBasis->getBaseCellTopology().getKey() != srcBasis->getBaseCellTopology().getKey(), std::runtime_error,
376  "The source and destination bases are not compatible. They do not have the same basic cell topology");
377 
379  projStruct.createL2ProjectionStruct(dstBasis, srcBasis->getDegree());
380 
381 
382  ordinal_type numCells = cellOrientations.extent(0);
383  ordinal_type dim = srcBasis->getBaseCellTopology().getDimension();
384  ordinal_type srcBasisCardinality = srcBasis->getCardinality();
385  ordinal_type fieldDimension = (srcBasis->getFunctionSpace() == Intrepid2::FUNCTION_SPACE_HCURL || srcBasis->getFunctionSpace() == Intrepid2::FUNCTION_SPACE_HDIV) ? dim : 1;
386 
387  auto evaluationPoints = projStruct.getAllEvalPoints();
388  ordinal_type numPoints = evaluationPoints.extent(0);
389 
390  using outViewType = Kokkos::DynRankView<typename srcBasisType::OutputValueType, DeviceType>;
391  outViewType srcAtEvalPoints, refBasisAtEvalPoints, basisAtEvalPoints;
392  if(fieldDimension == dim) {
393  srcAtEvalPoints = outViewType("srcAtEvalPoints", numCells, numPoints, dim);
394  refBasisAtEvalPoints = outViewType("refBasisAtEvalPoints", srcBasisCardinality, numPoints, dim);
395  basisAtEvalPoints = outViewType("basisAtEvalPoints", numCells, srcBasisCardinality, numPoints, dim);
396  } else {
397  srcAtEvalPoints = outViewType("srcAtEvalPoints", numCells, numPoints);
398  refBasisAtEvalPoints = outViewType("refBasisAtEvalPoints", srcBasisCardinality, numPoints);
399  basisAtEvalPoints = outViewType("basisAtEvalPoints", numCells, srcBasisCardinality, numPoints);
400  }
401 
402  srcBasis->getValues(refBasisAtEvalPoints,evaluationPoints);
403 
404  // Modify basis values to account for orientations
406  refBasisAtEvalPoints,
407  cellOrientations,
408  srcBasis);
409 
410  Kokkos::parallel_for(Kokkos::RangePolicy<typename DeviceType::execution_space>(0,numCells),
411  KOKKOS_LAMBDA (const int &ic) {
412  for(int j=0; j<numPoints; ++j) {
413  for(int k=0; k<srcBasisCardinality; ++k) {
414  for(int d=0; d<fieldDimension; ++d)
415  srcAtEvalPoints.access(ic,j,d) += srcCoeffs(ic,k)*basisAtEvalPoints.access(ic,k,j,d);
416  }
417  }
418  });
419  ExecSpaceType().fence();
420 
421  getL2BasisCoeffs(dstCoeffs,
422  srcAtEvalPoints,
423  cellOrientations,
424  dstBasis,
425  &projStruct);
426  }
427 
428 
429 
439  struct ElemSystem {
440 
441 
442  std::string systemName_;
443  bool matrixIndependentOfCell_;
444 
452  ElemSystem (std::string systemName, bool matrixIndependentOfCell) :
453  systemName_(systemName), matrixIndependentOfCell_(matrixIndependentOfCell){};
454 
455 
456 
482  template<typename ViewType1, typename ViewType2, typename ViewType3, typename ViewType4>
483  void solve(ViewType1 basisCoeffs, ViewType2 elemMat, ViewType2 elemRhs, ViewType2 tau,
484  ViewType3 w,const ViewType4 elemDof, ordinal_type n, ordinal_type m=0) {
485 #ifdef HAVE_INTREPID2_KOKKOSKERNELS
486  solveDevice(basisCoeffs, elemMat, elemRhs, tau,
487  w, elemDof, n, m);
488 #else
489  solveHost(basisCoeffs, elemMat, elemRhs, tau,
490  w, elemDof, n, m);
491 #endif
492 
493  }
494 
497 #ifdef HAVE_INTREPID2_KOKKOSKERNELS
498  template<typename ViewType1, typename ViewType2, typename ViewType3, typename ViewType4>
499  void solveDevice(ViewType1 basisCoeffs, ViewType2 elemMat, ViewType2 elemRhs, ViewType2 taul,
500  ViewType3 work,const ViewType4 elemDof, ordinal_type n, ordinal_type m) {
501  using HostDeviceType = Kokkos::Device<Kokkos::DefaultHostExecutionSpace,Kokkos::HostSpace>;
502 
503  ordinal_type numCells = basisCoeffs.extent(0);
504 
505  if(matrixIndependentOfCell_) {
506  auto A0 = Kokkos::subview(elemMat, 0, Kokkos::ALL(), Kokkos::ALL());
507  auto tau0 = Kokkos::subview(taul, 0, Kokkos::ALL());
508 
509  Kokkos::DynRankView<typename ViewType2::value_type, HostDeviceType> A0_host("A0_host", A0.extent(0),A0.extent(1));
510  auto A0_device = Kokkos::create_mirror_view(typename DeviceType::memory_space(), A0_host);
511  Kokkos::deep_copy(A0_device, A0);
512  Kokkos::deep_copy(A0_host, A0_device);
513 
514  for(ordinal_type i=n; i<n+m; ++i)
515  for(ordinal_type j=0; j<n; ++j)
516  A0_host(i,j) = A0_host(j,i);
517 
518  Kokkos::DynRankView<typename ViewType2::value_type, HostDeviceType> tau0_host("A0_host", tau0.extent(0));
519  auto tau0_device = Kokkos::create_mirror_view(typename DeviceType::memory_space(), tau0_host);
520  auto w0_host = Kokkos::create_mirror_view(Kokkos::subview(work, 0, Kokkos::ALL()));
521 
522  //computing QR of A0. QR is saved in A0 and tau0
523  KokkosBatched::SerialQR_Internal::invoke(A0_host.extent(0), A0_host.extent(1),
524  A0_host.data(), A0_host.stride_0(), A0_host.stride_1(),
525  tau0_host.data(), tau0_host.stride_0(), w0_host.data());
526 
527  Kokkos::deep_copy(A0_device, A0_host);
528  Kokkos::deep_copy(A0, A0_device);
529  Kokkos::deep_copy(tau0_device, tau0_host);
530  Kokkos::deep_copy(tau0, tau0_device);
531 
532  Kokkos::parallel_for (systemName_,
533  Kokkos::RangePolicy<ExecSpaceType, int> (0, numCells),
534  KOKKOS_LAMBDA (const size_t ic) {
535  auto w = Kokkos::subview(work, ic, Kokkos::ALL());
536 
537  auto b = Kokkos::subview(elemRhs, ic, Kokkos::ALL());
538 
539  //b'*Q0 -> b
540  KokkosBatched::SerialApplyQ_RightForwardInternal::invoke(
541  1, A0.extent(0), A0.extent(1),
542  A0.data(), A0.stride_0(), A0.stride_1(),
543  tau0.data(), tau0.stride_0(),
544  b.data(), 1, b.stride_0(),
545  w.data());
546 
547  // R0^{-1} b -> b
548  KokkosBatched::SerialTrsvInternalUpper<KokkosBatched::Algo::Trsv::Unblocked>::invoke(false,
549  A0.extent(0),
550  1.0,
551  A0.data(), A0.stride_0(), A0.stride_1(),
552  b.data(), b.stride_0());
553 
554  //scattering b into the basis coefficients
555  for(ordinal_type i=0; i<n; ++i){
556  basisCoeffs(ic,elemDof(i)) = b(i);
557  }
558  });
559 
560  } else {
561 
562  Kokkos::parallel_for (systemName_,
563  Kokkos::RangePolicy<ExecSpaceType, int> (0, numCells),
564  KOKKOS_LAMBDA (const size_t ic) {
565 
566  auto A = Kokkos::subview(elemMat, ic, Kokkos::ALL(), Kokkos::ALL());
567  auto tau = Kokkos::subview(taul, ic, Kokkos::ALL());
568  auto w = Kokkos::subview(work, ic, Kokkos::ALL());
569 
570  for(ordinal_type i=n; i<n+m; ++i)
571  for(ordinal_type j=0; j<n; ++j)
572  A(i,j) = A(j,i);
573 
574  //computing QR of A. QR is saved in A and tau
575  KokkosBatched::SerialQR_Internal::invoke(A.extent(0), A.extent(1),
576  A.data(), A.stride_0(), A.stride_1(), tau.data(), tau.stride_0(), w.data());
577 
578  auto b = Kokkos::subview(elemRhs, ic, Kokkos::ALL());
579 
580  //b'*Q -> b
581  KokkosBatched::SerialApplyQ_RightForwardInternal::invoke(
582  1, A.extent(0), A.extent(1),
583  A.data(), A.stride_0(), A.stride_1(),
584  tau.data(), tau.stride_0(),
585  b.data(), 1, b.stride_0(),
586  w.data());
587 
588  // R^{-1} b -> b
589  KokkosBatched::SerialTrsvInternalUpper<KokkosBatched::Algo::Trsv::Unblocked>::invoke(false,
590  A.extent(0),
591  1.0,
592  A.data(), A.stride_0(), A.stride_1(),
593  b.data(), b.stride_0());
594 
595  //scattering b into the basis coefficients
596  for(ordinal_type i=0; i<n; ++i){
597  basisCoeffs(ic,elemDof(i)) = b(i);
598  }
599  });
600  }
601  }
602 #endif
603 
607  template<typename ViewType1, typename ViewType2, typename ViewType3, typename ViewType4>
608  void solveHost(ViewType1 basisCoeffs, ViewType2 elemMat, ViewType2 elemRhs, ViewType2 ,
609  ViewType3, const ViewType4 elemDof, ordinal_type n, ordinal_type m) {
610  using value_type = typename ViewType2::value_type;
611  using device_type = DeviceType;
612  using host_exec_space = Kokkos::DefaultHostExecutionSpace;
613  using host_memory_space = Kokkos::HostSpace;
614  using host_device_type = Kokkos::Device<host_exec_space,host_memory_space>;
615  using vector_host_type = Kokkos::View<value_type*,host_device_type>;
616  using scratch_host_type = Kokkos::View<value_type*,host_exec_space::scratch_memory_space>;
617  using matrix_host_type = Kokkos::View<value_type**,Kokkos::LayoutLeft,host_device_type>;
618  using do_not_init_tag = Kokkos::ViewAllocateWithoutInitializing;
619  using host_team_policy_type = Kokkos::TeamPolicy<host_exec_space>;
620  using host_range_policy_type = Kokkos::RangePolicy<host_exec_space>;
621 
623  Kokkos::fence();
624 
626  const ordinal_type numCells = basisCoeffs.extent(0);
627  const ordinal_type numRows = m+n, numCols = n;
628 
630  Teuchos::LAPACK<ordinal_type,value_type> lapack;
631 
633  Kokkos::View<ordinal_type*,host_device_type> elemDof_host(do_not_init_tag("elemDof_host"), elemDof.extent(0));
634  {
635  auto elemDof_device = Kokkos::create_mirror_view(typename device_type::memory_space(), elemDof_host);
636  Kokkos::deep_copy(elemDof_device, elemDof); Kokkos::fence();
637  Kokkos::deep_copy(elemDof_host, elemDof_device);
638  }
639 
641  auto elemRhs_host = Kokkos::create_mirror_view_and_copy(host_memory_space(), elemRhs);
642  auto elemMat_host = Kokkos::create_mirror_view_and_copy(host_memory_space(), elemMat);
643 
645  auto basisCoeffs_host = Kokkos::create_mirror_view_and_copy(host_memory_space(), basisCoeffs);
646 
647  if (matrixIndependentOfCell_) {
649  matrix_host_type A(do_not_init_tag("A"), numRows, numRows);
650  {
651  for (ordinal_type j=0;j<numRows;++j)
652  for (ordinal_type i=0;i<numRows;++i)
653  A(i, j) = elemMat_host(0, i, j);
654 
655  for (ordinal_type j=0;j<numCols;++j)
656  for (ordinal_type i=numCols;i<numRows;++i)
657  A(i, j) = A(j, i);
658  }
659 
660  ordinal_type lwork(-1);
661  {
662  ordinal_type info(0);
663  value_type work[2];
664  lapack.GELS('N',
665  numRows, numRows, numCells,
666  nullptr, std::max(1,numRows),
667  nullptr, std::max(1,numRows),
668  &work[0], lwork,
669  &info);
670  lwork = work[0];
671  }
672 
673  matrix_host_type C(do_not_init_tag("C"), numRows, numCells);
674 
675  host_range_policy_type policy(0, numCells);
676  {
677  Kokkos::parallel_for
678  ("ProjectionTools::solveHost::matrixIndependentOfCell::pack",
679  policy, [=](const ordinal_type & ic) {
680  for (ordinal_type i=0;i<numRows;++i)
681  C(i,ic) = elemRhs_host(ic, i);
682  });
683  }
684  {
686  vector_host_type work(do_not_init_tag("work"), lwork);
687  ordinal_type info(0);
688  lapack.GELS('N',
689  numRows, numRows, numCells,
690  A.data(), std::max(1,numRows),
691  C.data(), std::max(1,numRows),
692  work.data(), lwork,
693  &info);
694  INTREPID2_TEST_FOR_EXCEPTION
695  (info != 0, std::runtime_error, "GELS return non-zero info code");
696  }
697  {
698  Kokkos::parallel_for
699  ("ProjectionTools::solveHost::matrixIndependentOfCell::unpack",
700  policy, [=](const ordinal_type & ic) {
701  for (ordinal_type i=0;i<numCols;++i)
702  basisCoeffs_host(ic,elemDof_host(i)) = C(i,ic);
703  });
704  }
705  } else {
706  const ordinal_type level(0);
707  host_team_policy_type policy(numCells, 1, 1);
708 
710  ordinal_type lwork(-1);
711  {
712  ordinal_type info(0);
713  value_type work[2];
714  lapack.GELS('N',
715  numRows, numRows, 1,
716  nullptr, std::max(1,numRows),
717  nullptr, std::max(1,numRows),
718  &work[0], lwork,
719  &info);
720  lwork = work[0];
721  }
722 
723  const ordinal_type per_team_extent = numRows*numRows + numRows + lwork;
724  const ordinal_type per_team_scratch = scratch_host_type::shmem_size(per_team_extent);
725  policy.set_scratch_size(level, Kokkos::PerTeam(per_team_scratch));
726 
728  Kokkos::parallel_for
729  ("ProjectionTools::solveHost::matrixDependentOfCell",
730  policy, [=](const typename host_team_policy_type::member_type& member) {
731  const ordinal_type ic = member.league_rank();
732 
733  scratch_host_type scratch(member.team_scratch(level), per_team_extent);
734  value_type * sptr = scratch.data();
735 
737  matrix_host_type A(sptr, numRows, numRows); sptr += A.span();
738  for (ordinal_type j=0;j<numRows;++j)
739  for (ordinal_type i=0;i<numRows;++i)
740  A(i, j) = elemMat_host(ic, i, j);
741 
742  for (ordinal_type j=0;j<numCols;++j)
743  for (ordinal_type i=numCols;i<numRows;++i)
744  A(i, j) = A(j, i);
745 
746  vector_host_type c(sptr, numRows); sptr += c.span();
747  for (ordinal_type i=0;i<numRows;++i)
748  c(i) = elemRhs_host(ic, i);
749 
750  vector_host_type work(sptr, lwork); sptr += work.span();
751  ordinal_type info(0);
752  lapack.GELS('N',
753  numRows, numRows, 1,
754  A.data(), std::max(1,numRows),
755  c.data(), std::max(1,numRows),
756  work.data(), lwork,
757  &info);
758  INTREPID2_TEST_FOR_EXCEPTION
759  (info != 0, std::runtime_error, "GELS return non-zero info code");
760 
762  for (ordinal_type i=0;i<numCols;++i)
763  basisCoeffs_host(ic,elemDof_host(i)) = c(i);
764  });
765  }
766  Kokkos::deep_copy(basisCoeffs, basisCoeffs_host);
767  }
768  };
769 
770 };
771 
772 } //Intrepid2
773 
774 
775 // include templated function definitions
781 
782 #endif
783 
784 
785 
786 
787 
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.