Intrepid2
Intrepid2_ProjectionTools.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ************************************************************************
3 //
4 // Intrepid2 Package
5 // Copyright (2007) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Kyungjoo Kim (kyukim@sandia.gov), or
38 // Mauro Perego (mperego@sandia.gov)
39 //
40 // ************************************************************************
41 // @HEADER
42 
47 #ifndef __INTREPID2_PROJECTIONTOOLS_HPP__
48 #define __INTREPID2_PROJECTIONTOOLS_HPP__
49 
50 #include "Intrepid2_ConfigDefs.hpp"
51 #include "Intrepid2_Types.hpp"
52 #include "Intrepid2_Utils.hpp"
53 
54 #include "Shards_CellTopology.hpp"
55 #include "Shards_BasicTopologies.hpp"
56 
57 #include "Intrepid2_PointTools.hpp"
58 
59 #include "Intrepid2_Basis.hpp"
60 
62 
63 // -- Lower order family
66 
69 
73 
77 
78 #include "Teuchos_LAPACK.hpp"
80 
82 
83 #ifdef HAVE_INTREPID2_KOKKOSKERNELS
84 #include "KokkosBatched_QR_Serial_Internal.hpp"
85 #include "KokkosBatched_ApplyQ_Serial_Internal.hpp"
86 #include "KokkosBatched_Trsv_Serial_Internal.hpp"
87 #include "KokkosBatched_Util.hpp"
88 #endif
89 
90 namespace Intrepid2 {
91 
144 template<typename DeviceType>
146 public:
147  using ExecSpaceType = typename DeviceType::execution_space;
148  using MemSpaceType = typename DeviceType::memory_space;
149  using EvalPointsType = typename ProjectionStruct<DeviceType, double>::EvalPointsType;
150 
151 
171  template<typename basisCoeffsValueType, class ...basisCoeffsProperties,
172  typename funValsValueType, class ...funValsProperties,
173  typename BasisType,
174  typename ortValueType, class ...ortProperties>
175  static void
176  getL2BasisCoeffs(Kokkos::DynRankView<basisCoeffsValueType,basisCoeffsProperties...> basisCoeffs,
177  const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetAtEvalPoints,
178  const Kokkos::DynRankView<ortValueType, ortProperties...> cellOrientations,
179  const BasisType* cellBasis,
181 
182 
206  template<typename basisCoeffsValueType, class ...basisCoeffsProperties,
207  typename funValsValueType, class ...funValsProperties,
208  typename BasisType,
209  typename ortValueType, class ...ortProperties>
210  static void
211  getL2DGBasisCoeffs(Kokkos::DynRankView<basisCoeffsValueType,basisCoeffsProperties...> basisCoeffs,
212  const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetAtEvalPoints,
213  const Kokkos::DynRankView<ortValueType, ortProperties...> cellOrientations,
214  const BasisType* cellBasis,
216 
217 
240  template<typename basisViewType, typename targetViewType, typename BasisType>
241  static void
242  getL2DGBasisCoeffs(basisViewType basisCoeffs,
243  const targetViewType targetAtTargetEPoints,
244  const BasisType* cellBasis,
246 
268  template<class BasisCoeffsViewType, class TargetValueViewType, class TargetGradViewType,
269  class BasisType, class OrientationViewType>
270  static void
271  getHGradBasisCoeffs(BasisCoeffsViewType basisCoeffs,
272  const TargetValueViewType targetAtEvalPoints,
273  const TargetGradViewType targetGradAtGradEvalPoints,
274  const OrientationViewType cellOrientations,
275  const BasisType* cellBasis,
277 
278 
302  template<typename basisCoeffsValueType, class ...basisCoeffsProperties,
303  typename funValsValueType, class ...funValsProperties,
304  typename BasisType,
305  typename ortValueType, class ...ortProperties>
306  static void
307  getHCurlBasisCoeffs(Kokkos::DynRankView<basisCoeffsValueType,basisCoeffsProperties...> basisCoeffs,
308  const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetAtEvalPoints,
309  const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetCurlAtCurlEvalPoints,
310  const Kokkos::DynRankView<ortValueType, ortProperties...> cellOrientations,
311  const BasisType* cellBasis,
313 
335  template<typename basisCoeffsValueType, class ...basisCoeffsProperties,
336  typename funValsValueType, class ...funValsProperties,
337  typename BasisType,
338  typename ortValueType, class ...ortProperties>
339  static void
340  getHDivBasisCoeffs(Kokkos::DynRankView<basisCoeffsValueType,basisCoeffsProperties...> basisCoeffs,
341  const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetAtEvalPoints,
342  const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetDivAtDivEvalPoints,
343  const Kokkos::DynRankView<ortValueType, ortProperties...> cellOrientations,
344  const BasisType* cellBasis,
346 
347 
365  template<typename basisCoeffsValueType, class ...basisCoeffsProperties,
366  typename funValsValueType, class ...funValsProperties,
367  typename BasisType,
368  typename ortValueType, class ...ortProperties>
369  static void
370  getHVolBasisCoeffs(Kokkos::DynRankView<basisCoeffsValueType,basisCoeffsProperties...> basisCoeffs,
371  const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetAtEvalPoints,
372  [[maybe_unused]] const Kokkos::DynRankView<ortValueType, ortProperties...> cellOrientations,
373  const BasisType* cellBasis,
375 
376 
377 
393  template<typename dstViewType,
394  typename dstBasisType,
395  typename srcViewType,
396  typename srcBasisType,
397  typename OrientationViewType>
398  static void
399  projectField(dstViewType dstCoeffs,
400  const dstBasisType* dstBasis,
401  const srcViewType srcCoeffs,
402  const srcBasisType* srcBasis,
403  const OrientationViewType cellOrientations){
404 
405 
406  INTREPID2_TEST_FOR_EXCEPTION(dstBasis->getFunctionSpace() != srcBasis->getFunctionSpace(), std::runtime_error,
407  "The source and destination bases are not compatible. They need to belong to the same function space");
408  INTREPID2_TEST_FOR_EXCEPTION(dstBasis->getBaseCellTopology().getKey() != srcBasis->getBaseCellTopology().getKey(), std::runtime_error,
409  "The source and destination bases are not compatible. They do not have the same basic cell topology");
410 
412  projStruct.createL2ProjectionStruct(dstBasis, srcBasis->getDegree());
413 
414 
415  ordinal_type numCells = cellOrientations.extent(0);
416  ordinal_type dim = srcBasis->getBaseCellTopology().getDimension();
417  ordinal_type srcBasisCardinality = srcBasis->getCardinality();
418  ordinal_type fieldDimension = (srcBasis->getFunctionSpace() == Intrepid2::FUNCTION_SPACE_HCURL || srcBasis->getFunctionSpace() == Intrepid2::FUNCTION_SPACE_HDIV) ? dim : 1;
419 
420  auto evaluationPoints = projStruct.getAllEvalPoints();
421  ordinal_type numPoints = evaluationPoints.extent(0);
422 
423  using outViewType = Kokkos::DynRankView<typename srcBasisType::OutputValueType, DeviceType>;
424  outViewType srcAtEvalPoints, refBasisAtEvalPoints, basisAtEvalPoints;
425  if(fieldDimension == dim) {
426  srcAtEvalPoints = outViewType("srcAtEvalPoints", numCells, numPoints, dim);
427  refBasisAtEvalPoints = outViewType("refBasisAtEvalPoints", srcBasisCardinality, numPoints, dim);
428  basisAtEvalPoints = outViewType("basisAtEvalPoints", numCells, srcBasisCardinality, numPoints, dim);
429  } else {
430  srcAtEvalPoints = outViewType("srcAtEvalPoints", numCells, numPoints);
431  refBasisAtEvalPoints = outViewType("refBasisAtEvalPoints", srcBasisCardinality, numPoints);
432  basisAtEvalPoints = outViewType("basisAtEvalPoints", numCells, srcBasisCardinality, numPoints);
433  }
434 
435  srcBasis->getValues(refBasisAtEvalPoints,evaluationPoints);
436 
437  // Modify basis values to account for orientations
439  refBasisAtEvalPoints,
440  cellOrientations,
441  srcBasis);
442 
443  Kokkos::parallel_for(Kokkos::RangePolicy<typename DeviceType::execution_space>(0,numCells),
444  KOKKOS_LAMBDA (const int &ic) {
445  for(int j=0; j<numPoints; ++j) {
446  for(int k=0; k<srcBasisCardinality; ++k) {
447  for(int d=0; d<fieldDimension; ++d)
448  srcAtEvalPoints.access(ic,j,d) += srcCoeffs(ic,k)*basisAtEvalPoints.access(ic,k,j,d);
449  }
450  }
451  });
452  ExecSpaceType().fence();
453 
454  getL2BasisCoeffs(dstCoeffs,
455  srcAtEvalPoints,
456  cellOrientations,
457  dstBasis,
458  &projStruct);
459  }
460 
461 
462 
472  struct ElemSystem {
473 
474 
475  std::string systemName_;
476  bool matrixIndependentOfCell_;
477 
485  ElemSystem (std::string systemName, bool matrixIndependentOfCell) :
486  systemName_(systemName), matrixIndependentOfCell_(matrixIndependentOfCell){};
487 
488 
489 
515  template<typename ViewType1, typename ViewType2, typename ViewType3, typename ViewType4>
516  void solve(ViewType1 basisCoeffs, ViewType2 elemMat, ViewType2 elemRhs, ViewType2 tau,
517  ViewType3 w,const ViewType4 elemDof, ordinal_type n, ordinal_type m=0) {
518 #ifdef HAVE_INTREPID2_KOKKOSKERNELS
519  solveDevice(basisCoeffs, elemMat, elemRhs, tau,
520  w, elemDof, n, m);
521 #else
522  solveHost(basisCoeffs, elemMat, elemRhs, tau,
523  w, elemDof, n, m);
524 #endif
525 
526  }
527 
530 #ifdef HAVE_INTREPID2_KOKKOSKERNELS
531  template<typename ViewType1, typename ViewType2, typename ViewType3, typename ViewType4>
532  void solveDevice(ViewType1 basisCoeffs, ViewType2 elemMat, ViewType2 elemRhs, ViewType2 taul,
533  ViewType3 work,const ViewType4 elemDof, ordinal_type n, ordinal_type m) {
534  using HostDeviceType = Kokkos::Device<Kokkos::DefaultHostExecutionSpace,Kokkos::HostSpace>;
535 
536  ordinal_type numCells = basisCoeffs.extent(0);
537 
538  if(matrixIndependentOfCell_) {
539  auto A0 = Kokkos::subview(elemMat, 0, Kokkos::ALL(), Kokkos::ALL());
540  auto tau0 = Kokkos::subview(taul, 0, Kokkos::ALL());
541 
542  Kokkos::DynRankView<typename ViewType2::value_type, HostDeviceType> A0_host("A0_host", A0.extent(0),A0.extent(1));
543  auto A0_device = Kokkos::create_mirror_view(typename DeviceType::memory_space(), A0_host);
544  Kokkos::deep_copy(A0_device, A0);
545  Kokkos::deep_copy(A0_host, A0_device);
546 
547  for(ordinal_type i=n; i<n+m; ++i)
548  for(ordinal_type j=0; j<n; ++j)
549  A0_host(i,j) = A0_host(j,i);
550 
551  Kokkos::DynRankView<typename ViewType2::value_type, HostDeviceType> tau0_host("A0_host", tau0.extent(0));
552  auto tau0_device = Kokkos::create_mirror_view(typename DeviceType::memory_space(), tau0_host);
553  auto w0_host = Kokkos::create_mirror_view(Kokkos::subview(work, 0, Kokkos::ALL()));
554 
555  //computing QR of A0. QR is saved in A0 and tau0
556  KokkosBatched::SerialQR_Internal::invoke(A0_host.extent(0), A0_host.extent(1),
557  A0_host.data(), A0_host.stride_0(), A0_host.stride_1(),
558  tau0_host.data(), tau0_host.stride_0(), w0_host.data());
559 
560  Kokkos::deep_copy(A0_device, A0_host);
561  Kokkos::deep_copy(A0, A0_device);
562  Kokkos::deep_copy(tau0_device, tau0_host);
563  Kokkos::deep_copy(tau0, tau0_device);
564 
565  Kokkos::parallel_for (systemName_,
566  Kokkos::RangePolicy<ExecSpaceType, int> (0, numCells),
567  KOKKOS_LAMBDA (const size_t ic) {
568  auto w = Kokkos::subview(work, ic, Kokkos::ALL());
569 
570  auto b = Kokkos::subview(elemRhs, ic, Kokkos::ALL());
571 
572  //b'*Q0 -> b
573  KokkosBatched::SerialApplyQ_RightForwardInternal::invoke(
574  1, A0.extent(0), A0.extent(1),
575  A0.data(), A0.stride_0(), A0.stride_1(),
576  tau0.data(), tau0.stride_0(),
577  b.data(), 1, b.stride_0(),
578  w.data());
579 
580  // R0^{-1} b -> b
581  KokkosBatched::SerialTrsvInternalUpper<KokkosBatched::Algo::Trsv::Unblocked>::invoke(false,
582  A0.extent(0),
583  1.0,
584  A0.data(), A0.stride_0(), A0.stride_1(),
585  b.data(), b.stride_0());
586 
587  //scattering b into the basis coefficients
588  for(ordinal_type i=0; i<n; ++i){
589  basisCoeffs(ic,elemDof(i)) = b(i);
590  }
591  });
592 
593  } else {
594 
595  Kokkos::parallel_for (systemName_,
596  Kokkos::RangePolicy<ExecSpaceType, int> (0, numCells),
597  KOKKOS_LAMBDA (const size_t ic) {
598 
599  auto A = Kokkos::subview(elemMat, ic, Kokkos::ALL(), Kokkos::ALL());
600  auto tau = Kokkos::subview(taul, ic, Kokkos::ALL());
601  auto w = Kokkos::subview(work, ic, Kokkos::ALL());
602 
603  for(ordinal_type i=n; i<n+m; ++i)
604  for(ordinal_type j=0; j<n; ++j)
605  A(i,j) = A(j,i);
606 
607  //computing QR of A. QR is saved in A and tau
608  KokkosBatched::SerialQR_Internal::invoke(A.extent(0), A.extent(1),
609  A.data(), A.stride_0(), A.stride_1(), tau.data(), tau.stride_0(), w.data());
610 
611  auto b = Kokkos::subview(elemRhs, ic, Kokkos::ALL());
612 
613  //b'*Q -> b
614  KokkosBatched::SerialApplyQ_RightForwardInternal::invoke(
615  1, A.extent(0), A.extent(1),
616  A.data(), A.stride_0(), A.stride_1(),
617  tau.data(), tau.stride_0(),
618  b.data(), 1, b.stride_0(),
619  w.data());
620 
621  // R^{-1} b -> b
622  KokkosBatched::SerialTrsvInternalUpper<KokkosBatched::Algo::Trsv::Unblocked>::invoke(false,
623  A.extent(0),
624  1.0,
625  A.data(), A.stride_0(), A.stride_1(),
626  b.data(), b.stride_0());
627 
628  //scattering b into the basis coefficients
629  for(ordinal_type i=0; i<n; ++i){
630  basisCoeffs(ic,elemDof(i)) = b(i);
631  }
632  });
633  }
634  }
635 #endif
636 
640  template<typename ViewType1, typename ViewType2, typename ViewType3, typename ViewType4>
641  void solveHost(ViewType1 basisCoeffs, ViewType2 elemMat, ViewType2 elemRhs, ViewType2 ,
642  ViewType3, const ViewType4 elemDof, ordinal_type n, ordinal_type m) {
643  using value_type = typename ViewType2::value_type;
644  using device_type = DeviceType;
645  using host_exec_space = Kokkos::DefaultHostExecutionSpace;
646  using host_memory_space = Kokkos::HostSpace;
647  using host_device_type = Kokkos::Device<host_exec_space,host_memory_space>;
648  using vector_host_type = Kokkos::View<value_type*,host_device_type>;
649  using scratch_host_type = Kokkos::View<value_type*,host_exec_space::scratch_memory_space>;
650  using matrix_host_type = Kokkos::View<value_type**,Kokkos::LayoutLeft,host_device_type>;
651  using do_not_init_tag = Kokkos::ViewAllocateWithoutInitializing;
652  using host_team_policy_type = Kokkos::TeamPolicy<host_exec_space>;
653  using host_range_policy_type = Kokkos::RangePolicy<host_exec_space>;
654 
656  Kokkos::fence();
657 
659  const ordinal_type numCells = basisCoeffs.extent(0);
660  const ordinal_type numRows = m+n, numCols = n;
661 
663  Teuchos::LAPACK<ordinal_type,value_type> lapack;
664 
666  Kokkos::View<ordinal_type*,host_device_type> elemDof_host(do_not_init_tag("elemDof_host"), elemDof.extent(0));
667  {
668  auto elemDof_device = Kokkos::create_mirror_view(typename device_type::memory_space(), elemDof_host);
669  Kokkos::deep_copy(elemDof_device, elemDof); Kokkos::fence();
670  Kokkos::deep_copy(elemDof_host, elemDof_device);
671  }
672 
674  auto elemRhs_host = Kokkos::create_mirror_view_and_copy(host_memory_space(), elemRhs);
675  auto elemMat_host = Kokkos::create_mirror_view_and_copy(host_memory_space(), elemMat);
676 
678  auto basisCoeffs_host = Kokkos::create_mirror_view_and_copy(host_memory_space(), basisCoeffs);
679 
680  if (matrixIndependentOfCell_) {
682  matrix_host_type A(do_not_init_tag("A"), numRows, numRows);
683  {
684  for (ordinal_type j=0;j<numRows;++j)
685  for (ordinal_type i=0;i<numRows;++i)
686  A(i, j) = elemMat_host(0, i, j);
687 
688  for (ordinal_type j=0;j<numCols;++j)
689  for (ordinal_type i=numCols;i<numRows;++i)
690  A(i, j) = A(j, i);
691  }
692 
693  ordinal_type lwork(-1);
694  {
695  ordinal_type info(0);
696  value_type work[2];
697  lapack.GELS('N',
698  numRows, numRows, numCells,
699  nullptr, std::max(1,numRows),
700  nullptr, std::max(1,numRows),
701  &work[0], lwork,
702  &info);
703  lwork = work[0];
704  }
705 
706  matrix_host_type C(do_not_init_tag("C"), numRows, numCells);
707 
708  host_range_policy_type policy(0, numCells);
709  {
710  Kokkos::parallel_for
711  ("ProjectionTools::solveHost::matrixIndependentOfCell::pack",
712  policy, [=](const ordinal_type & ic) {
713  for (ordinal_type i=0;i<numRows;++i)
714  C(i,ic) = elemRhs_host(ic, i);
715  });
716  }
717  {
719  vector_host_type work(do_not_init_tag("work"), lwork);
720  ordinal_type info(0);
721  lapack.GELS('N',
722  numRows, numRows, numCells,
723  A.data(), std::max(1,numRows),
724  C.data(), std::max(1,numRows),
725  work.data(), lwork,
726  &info);
727  INTREPID2_TEST_FOR_EXCEPTION
728  (info != 0, std::runtime_error, "GELS return non-zero info code");
729  }
730  {
731  Kokkos::parallel_for
732  ("ProjectionTools::solveHost::matrixIndependentOfCell::unpack",
733  policy, [=](const ordinal_type & ic) {
734  for (ordinal_type i=0;i<numCols;++i)
735  basisCoeffs_host(ic,elemDof_host(i)) = C(i,ic);
736  });
737  }
738  } else {
739  const ordinal_type level(0);
740  host_team_policy_type policy(numCells, 1, 1);
741 
743  ordinal_type lwork(-1);
744  {
745  ordinal_type info(0);
746  value_type work[2];
747  lapack.GELS('N',
748  numRows, numRows, 1,
749  nullptr, std::max(1,numRows),
750  nullptr, std::max(1,numRows),
751  &work[0], lwork,
752  &info);
753  lwork = work[0];
754  }
755 
756  const ordinal_type per_team_extent = numRows*numRows + numRows + lwork;
757  const ordinal_type per_team_scratch = scratch_host_type::shmem_size(per_team_extent);
758  policy.set_scratch_size(level, Kokkos::PerTeam(per_team_scratch));
759 
761  Kokkos::parallel_for
762  ("ProjectionTools::solveHost::matrixDependentOfCell",
763  policy, [=](const typename host_team_policy_type::member_type& member) {
764  const ordinal_type ic = member.league_rank();
765 
766  scratch_host_type scratch(member.team_scratch(level), per_team_extent);
767  value_type * sptr = scratch.data();
768 
770  matrix_host_type A(sptr, numRows, numRows); sptr += A.span();
771  for (ordinal_type j=0;j<numRows;++j)
772  for (ordinal_type i=0;i<numRows;++i)
773  A(i, j) = elemMat_host(ic, i, j);
774 
775  for (ordinal_type j=0;j<numCols;++j)
776  for (ordinal_type i=numCols;i<numRows;++i)
777  A(i, j) = A(j, i);
778 
779  vector_host_type c(sptr, numRows); sptr += c.span();
780  for (ordinal_type i=0;i<numRows;++i)
781  c(i) = elemRhs_host(ic, i);
782 
783  vector_host_type work(sptr, lwork); sptr += work.span();
784  ordinal_type info(0);
785  lapack.GELS('N',
786  numRows, numRows, 1,
787  A.data(), std::max(1,numRows),
788  c.data(), std::max(1,numRows),
789  work.data(), lwork,
790  &info);
791  INTREPID2_TEST_FOR_EXCEPTION
792  (info != 0, std::runtime_error, "GELS return non-zero info code");
793 
795  for (ordinal_type i=0;i<numCols;++i)
796  basisCoeffs_host(ic,elemDof_host(i)) = c(i);
797  });
798  }
799  Kokkos::deep_copy(basisCoeffs, basisCoeffs_host);
800  }
801  };
802 
803 };
804 
805 } //Intrepid2
806 
807 
808 // include templated function definitions
814 
815 #endif
816 
817 
818 
819 
820 
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.