Intrepid2
Intrepid2_Basis.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),
38 // Mauro Perego (mperego@sandia.gov), or
39 // Nate Roberts (nvrober@sandia.gov)
40 //
41 // ************************************************************************
42 // @HEADER
43 
50 #ifndef __INTREPID2_BASIS_HPP__
51 #define __INTREPID2_BASIS_HPP__
52 
53 #include "Intrepid2_ConfigDefs.hpp"
54 #include "Intrepid2_Types.hpp"
55 #include "Intrepid2_Utils.hpp"
56 
58 #include "Kokkos_Vector.hpp"
59 #include "Shards_CellTopology.hpp"
60 
61 namespace Intrepid2 {
62 
92  template<typename ExecSpaceType = void,
93  typename outputValueType = double,
94  typename pointValueType = double>
95  class Basis {
96  public:
99  using ExecutionSpace = ExecSpaceType;
100 
103  using OutputValueType = outputValueType;
104 
107  using PointValueType = pointValueType;
108 
111  using OrdinalViewType = Kokkos::View<ordinal_type,ExecSpaceType>;
112  using ordinal_view_type INTREPID2_DEPRECATED_TYPENAME_REPLACEMENT("use OrdinalViewType instead","OrdinalViewType") = OrdinalViewType INTREPID2_DEPRECATED_TYPENAME_TRAILING_ATTRIBUTE("use OrdinalViewType instead");
113 
116  using EBasisViewType = Kokkos::View<EBasis,ExecSpaceType>;
117  using ebasis_view_type INTREPID2_DEPRECATED_TYPENAME_REPLACEMENT("use EBasisViewType instead","EBasisViewType") = EBasisViewType INTREPID2_DEPRECATED_TYPENAME_TRAILING_ATTRIBUTE("use EBasisViewType instead");
118 
121  using ECoordinatesViewType = Kokkos::View<ECoordinates,ExecSpaceType>;
122  using ecoordinates_view_type INTREPID2_DEPRECATED_TYPENAME_REPLACEMENT("use ECoordinatesViewType instead","ECoordinatesViewType") = ECoordinatesViewType INTREPID2_DEPRECATED_TYPENAME_TRAILING_ATTRIBUTE("use ECoordinatesViewType instead");
123 
124  // ** tag interface
125  // - tag interface is not decorated with Kokkos inline so it should be allocated on hostspace
126 
129  using OrdinalTypeArray1DHost = Kokkos::View<ordinal_type*,typename ExecSpaceType::array_layout,Kokkos::HostSpace>;
130  using ordinal_type_array_1d_host INTREPID2_DEPRECATED_TYPENAME_REPLACEMENT("use OrdinalTypeArray1DHost instead","OrdinalTypeArray1DHost") = OrdinalTypeArray1DHost INTREPID2_DEPRECATED_TYPENAME_TRAILING_ATTRIBUTE("use OrdinalTypeArray1DHost instead");
131 
134  using OrdinalTypeArray2DHost = Kokkos::View<ordinal_type**,typename ExecSpaceType::array_layout,Kokkos::HostSpace>;
135  using ordinal_type_array_2d_host INTREPID2_DEPRECATED_TYPENAME_REPLACEMENT("use OrdinalTypeArray2DHost instead","OrdinalTypeArray2DHost") = OrdinalTypeArray2DHost INTREPID2_DEPRECATED_TYPENAME_TRAILING_ATTRIBUTE("use OrdinalTypeArray2DHost instead");
136 
139  using OrdinalTypeArray3DHost = Kokkos::View<ordinal_type***,typename ExecSpaceType::array_layout,Kokkos::HostSpace>;
140  using ordinal_type_array_3d_host INTREPID2_DEPRECATED_TYPENAME_REPLACEMENT("use OrdinalTypeArray3DHost instead","OrdinalTypeArray3DHost") = OrdinalTypeArray3DHost INTREPID2_DEPRECATED_TYPENAME_TRAILING_ATTRIBUTE("use OrdinalTypeArray3DHost instead");
141 
144  using OrdinalTypeArrayStride1DHost = Kokkos::View<ordinal_type*, Kokkos::LayoutStride, Kokkos::HostSpace>;
145  using ordinal_type_array_stride_1d_host INTREPID2_DEPRECATED_TYPENAME_REPLACEMENT("use OrdinalTypeArrayStride1DHost instead","OrdinalTypeArrayStride1DHost") = OrdinalTypeArrayStride1DHost INTREPID2_DEPRECATED_TYPENAME_TRAILING_ATTRIBUTE("use OrdinalTypeArrayStride1DHost instead");
146 
149  using OrdinalTypeArray1D = Kokkos::View<ordinal_type*,ExecSpaceType>;
150  using ordinal_type_array_1d INTREPID2_DEPRECATED_TYPENAME_REPLACEMENT("use OrdinalTypeArray1D instead","OrdinalTypeArray1D") = OrdinalTypeArray1D INTREPID2_DEPRECATED_TYPENAME_TRAILING_ATTRIBUTE("use OrdinalTypeArray1D instead");
151 
154  using OrdinalTypeArray2D = Kokkos::View<ordinal_type**,ExecSpaceType>;
155  using ordinal_type_array_2d INTREPID2_DEPRECATED_TYPENAME_REPLACEMENT("use OrdinalTypeArray2D instead","OrdinalTypeArray2D") = OrdinalTypeArray2D INTREPID2_DEPRECATED_TYPENAME_TRAILING_ATTRIBUTE("use OrdinalTypeArray2D instead");
156 
159  using OrdinalTypeArray3D = Kokkos::View<ordinal_type***,ExecSpaceType>;
160  using ordinal_type_array_3d INTREPID2_DEPRECATED_TYPENAME_REPLACEMENT("use OrdinalTypeArray3D instead","OrdinalTypeArray3D") = OrdinalTypeArray3D INTREPID2_DEPRECATED_TYPENAME_TRAILING_ATTRIBUTE("use OrdinalTypeArray3D instead");
161 
164  using OrdinalTypeArrayStride1D = Kokkos::View<ordinal_type*, Kokkos::LayoutStride, ExecSpaceType>;
165  using ordinal_type_array_stride_1d INTREPID2_DEPRECATED_TYPENAME_REPLACEMENT("use OrdinalTypeArrayStride1D instead","OrdinalTypeArrayStride1D") = OrdinalTypeArrayStride1D INTREPID2_DEPRECATED_TYPENAME_TRAILING_ATTRIBUTE("use OrdinalTypeArrayStride1D instead");
166 
169  typedef typename ScalarTraits<pointValueType>::scalar_type scalarType;
170  protected:
171 
174  ordinal_type basisCardinality_;
175 
178  ordinal_type basisDegree_;
179 
184  shards::CellTopology basisCellTopology_;
185 
189 
193 
196  EFunctionSpace functionSpace_ = FUNCTION_SPACE_MAX;
197 
200  //Kokkos::View<bool,ExecSpaceType> basisTagsAreSet_;
201 
214 
227 
239  template<typename OrdinalTypeView3D,
240  typename OrdinalTypeView2D,
241  typename OrdinalTypeView1D>
242  void setOrdinalTagData( OrdinalTypeView3D &tagToOrdinal,
243  OrdinalTypeView2D &ordinalToTag,
244  const OrdinalTypeView1D tags,
245  const ordinal_type basisCard,
246  const ordinal_type tagSize,
247  const ordinal_type posScDim,
248  const ordinal_type posScOrd,
249  const ordinal_type posDfOrd ) {
250  // Create ordinalToTag
251  ordinalToTag = OrdinalTypeView2D("ordinalToTag", basisCard, tagSize);
252 
253  // Initialize with -1
254  Kokkos::deep_copy( ordinalToTag, -1 );
255 
256  // Copy tags
257  for (ordinal_type i=0;i<basisCard;++i)
258  for (ordinal_type j=0;j<tagSize;++j)
259  ordinalToTag(i, j) = tags(i*tagSize + j);
260 
261  // Find out dimension of tagToOrdinal
262  auto maxScDim = 0; // first dimension of tagToOrdinal
263  for (ordinal_type i=0;i<basisCard;++i)
264  if (maxScDim < tags(i*tagSize + posScDim))
265  maxScDim = tags(i*tagSize + posScDim);
266  ++maxScDim;
267 
268  auto maxScOrd = 0; // second dimension of tagToOrdinal
269  for (ordinal_type i=0;i<basisCard;++i)
270  if (maxScOrd < tags(i*tagSize + posScOrd))
271  maxScOrd = tags(i*tagSize + posScOrd);
272  ++maxScOrd;
273 
274  auto maxDfOrd = 0; // third dimension of tagToOrdinal
275  for (ordinal_type i=0;i<basisCard;++i)
276  if (maxDfOrd < tags(i*tagSize + posDfOrd))
277  maxDfOrd = tags(i*tagSize + posDfOrd);
278  ++maxDfOrd;
279 
280  // Create tagToOrdinal
281  tagToOrdinal = OrdinalTypeView3D("tagToOrdinal", maxScDim, maxScOrd, maxDfOrd);
282 
283  // Initialize with -1
284  Kokkos::deep_copy( tagToOrdinal, -1 );
285 
286  // Overwrite elements of the array corresponding to tags with local DoF Id's, leave all other = -1
287  for (ordinal_type i=0;i<basisCard;++i)
288  tagToOrdinal(tags(i*tagSize), tags(i*tagSize+1), tags(i*tagSize+2)) = i;
289  }
290 
291  // dof coords
294  Kokkos::DynRankView<scalarType,ExecSpaceType> dofCoords_;
295 
296  // dof coeffs
304  Kokkos::DynRankView<scalarType,ExecSpaceType> dofCoeffs_;
305 
314  public:
315 
316  Basis() = default;
317  virtual~Basis() = default;
318 
319  // receives input arguments
322  OutputValueType getDummyOutputValue() { return outputValueType(); }
323 
326  PointValueType getDummyPointValue() { return pointValueType(); }
327 
330  using OutputViewType = Kokkos::DynRankView<OutputValueType,Kokkos::LayoutStride,ExecSpaceType>;
331  using outputViewType INTREPID2_DEPRECATED_TYPENAME_REPLACEMENT("use OutputViewType instead","OutputViewType") = OutputViewType INTREPID2_DEPRECATED_TYPENAME_TRAILING_ATTRIBUTE("use OutputViewType instead");
332 
335  using PointViewType = Kokkos::DynRankView<PointValueType,Kokkos::LayoutStride,ExecSpaceType>;
336  using pointViewType INTREPID2_DEPRECATED_TYPENAME_REPLACEMENT("use PointViewType instead","PointViewType") = PointViewType INTREPID2_DEPRECATED_TYPENAME_TRAILING_ATTRIBUTE("use PointViewType instead");
337 
340  using ScalarViewType = Kokkos::DynRankView<scalarType,Kokkos::LayoutStride,ExecSpaceType>;
341  using scalarViewType INTREPID2_DEPRECATED_TYPENAME_REPLACEMENT("use ScalarViewType instead","ScalarViewType") = ScalarViewType INTREPID2_DEPRECATED_TYPENAME_TRAILING_ATTRIBUTE("use ScalarViewType instead");
342 
361  virtual
362  void
363  getValues( OutputViewType /* outputValues */,
364  const PointViewType /* inputPoints */,
365  const EOperator /* operatorType */ = OPERATOR_VALUE ) const {
366  INTREPID2_TEST_FOR_EXCEPTION( true, std::logic_error,
367  ">>> ERROR (Basis::getValues): this method (FEM) is not supported or should be over-riden accordingly by derived classes.");
368  }
369 
389  virtual
390  void
391  getValues( OutputViewType /* outputValues */,
392  const PointViewType /* inputPoints */,
393  const PointViewType /* cellVertices */,
394  const EOperator /* operatorType */ = OPERATOR_VALUE ) const {
395  INTREPID2_TEST_FOR_EXCEPTION( true, std::logic_error,
396  ">>> ERROR (Basis::getValues): this method (FVM) is not supported or should be over-riden accordingly by derived classes.");
397  }
398 
399 
403  virtual
404  void
405  getDofCoords( ScalarViewType /* dofCoords */ ) const {
406  INTREPID2_TEST_FOR_EXCEPTION( true, std::logic_error,
407  ">>> ERROR (Basis::getDofCoords): this method is not supported or should be over-riden accordingly by derived classes.");
408  }
409 
418  virtual
419  void
420  getDofCoeffs( ScalarViewType /* dofCoeffs */ ) const {
421  INTREPID2_TEST_FOR_EXCEPTION( true, std::logic_error,
422  ">>> ERROR (Basis::getDofCoeffs): this method is not supported or should be over-riden accordingly by derived classes.");
423  }
424 
433  {
434  INTREPID2_TEST_FOR_EXCEPTION( basisType_ != BASIS_FEM_HIERARCHICAL, std::logic_error,
435  ">>> ERROR (Basis::getFieldOrdinalsForDegree): this method is not supported for non-hierarchical bases.");
436  int degreeEntryLength = fieldOrdinalPolynomialDegree_.extent_int(1);
437  int requestedDegreeLength = degrees.extent_int(0);
438  INTREPID2_TEST_FOR_EXCEPTION(degreeEntryLength != requestedDegreeLength, std::invalid_argument, "length of degrees does not match the entries in fieldOrdinalPolynomialDegree_");
439  Kokkos::vector<int> fieldOrdinalsVector;
440  for (int basisOrdinal=0; basisOrdinal<fieldOrdinalPolynomialDegree_.extent_int(0); basisOrdinal++)
441  {
442  bool matches = true;
443  for (int d=0; d<degreeEntryLength; d++)
444  {
445  if (fieldOrdinalPolynomialDegree_(basisOrdinal,d) > degrees(d)) matches = false;
446  }
447  if (matches) fieldOrdinalsVector.push_back(basisOrdinal);
448  }
449  OrdinalTypeArray1DHost fieldOrdinals("fieldOrdinalsForDegree",fieldOrdinalsVector.size());
450  for (int i=0; i<fieldOrdinalsVector.size(); i++)
451  {
452  fieldOrdinals(i) = fieldOrdinalsVector[i];
453  }
454  return fieldOrdinals;
455  }
456 
467  Kokkos::vector<int> getFieldOrdinalsForDegree(Kokkos::vector<int> &degrees) const
468  {
469  INTREPID2_TEST_FOR_EXCEPTION( basisType_ != BASIS_FEM_HIERARCHICAL, std::logic_error,
470  ">>> ERROR (Basis::getFieldOrdinalsForDegree): this method is not supported for non-hierarchical bases.");
471  OrdinalTypeArray1DHost degreesView("degrees",degrees.size());
472  for (int d=0; d<degrees.size(); d++)
473  {
474  degreesView(d) = degrees[d];
475  }
476  auto fieldOrdinalsView = getFieldOrdinalsForDegree(degreesView);
477  Kokkos::vector<int> fieldOrdinalsVector(fieldOrdinalsView.extent_int(0));
478  for (int i=0; i<fieldOrdinalsView.extent_int(0); i++)
479  {
480  fieldOrdinalsVector[i] = fieldOrdinalsView(i);
481  }
482  return fieldOrdinalsVector;
483  }
484 
492  {
493  INTREPID2_TEST_FOR_EXCEPTION( basisType_ != BASIS_FEM_HIERARCHICAL, std::logic_error,
494  ">>> ERROR (Basis::getPolynomialDegreeOfField): this method is not supported for non-hierarchical bases.");
495  INTREPID2_TEST_FOR_EXCEPTION(fieldOrdinal < 0, std::invalid_argument, "field ordinal must be non-negative");
496  INTREPID2_TEST_FOR_EXCEPTION(fieldOrdinal >= fieldOrdinalPolynomialDegree_.extent_int(0), std::invalid_argument, "field ordinal out of bounds");
497 
498  return Kokkos::subview(fieldOrdinalPolynomialDegree_,fieldOrdinal,Kokkos::ALL);
499  }
500 
508  Kokkos::vector<int> getPolynomialDegreeOfFieldAsVector(int fieldOrdinal) const
509  {
510  INTREPID2_TEST_FOR_EXCEPTION( basisType_ != BASIS_FEM_HIERARCHICAL, std::logic_error,
511  ">>> ERROR (Basis::getPolynomialDegreeOfFieldAsVector): this method is not supported for non-hierarchical bases.");
512  auto polynomialDegreeView = getPolynomialDegreeOfField(fieldOrdinal);
513  Kokkos::vector<int> polynomialDegree(polynomialDegreeView.extent_int(0));
514 
515  for (int d=0; d<polynomialDegree.size(); d++)
516  {
517  polynomialDegree[d] = polynomialDegreeView(d);
518  }
519  return polynomialDegree;
520  }
521 
525  {
526  INTREPID2_TEST_FOR_EXCEPTION( basisType_ != BASIS_FEM_HIERARCHICAL, std::logic_error,
527  ">>> ERROR (Basis::getPolynomialDegreeLength): this method is not supported for non-hierarchical bases.");
528  return fieldOrdinalPolynomialDegree_.extent_int(1);
529  }
530 
535  virtual
536  const char*
537  getName() const {
538  return "Intrepid2_Basis";
539  }
540 
543  virtual
544  bool
546  return false;
547  }
548 
553  ordinal_type
554  getCardinality() const {
555  return basisCardinality_;
556  }
557 
558 
563  ordinal_type
564  getDegree() const {
565  return basisDegree_;
566  }
567 
572  EFunctionSpace
574  return functionSpace_;
575  }
576 
582  shards::CellTopology
584  return basisCellTopology_;
585  }
586 
587 
592  EBasis
593  getBasisType() const {
594  return basisType_;
595  }
596 
597 
604  return basisCoordinates_;
605  }
606 
614  ordinal_type
615  getDofCount( const ordinal_type subcDim,
616  const ordinal_type subcOrd ) const {
617  if ( subcDim >= 0 && subcDim < static_cast<ordinal_type>(tagToOrdinal_.extent(0)) &&
618  subcOrd >= 0 && subcOrd < static_cast<ordinal_type>(tagToOrdinal_.extent(1)) )
619  {
620  int firstDofOrdinal = tagToOrdinal_(subcDim, subcOrd, 0); // will be -1 if no dofs for subcell
621  if (firstDofOrdinal == -1) return static_cast<ordinal_type>(0);
622  // otherwise, lookup its tag and return the dof count stored there
623  return static_cast<ordinal_type>(this->getDofTag(firstDofOrdinal)[3]);
624  }
625  else
626  {
627  // subcDim and/or subcOrd out of bounds -> no dofs associated with subcell
628  return static_cast<ordinal_type>(0);
629  }
630  }
631 
640  ordinal_type
641  getDofOrdinal( const ordinal_type subcDim,
642  const ordinal_type subcOrd,
643  const ordinal_type subcDofOrd ) const {
644  // this should be abort and able to be called as a device function
645 #ifdef HAVE_INTREPID2_DEBUG
646  INTREPID2_TEST_FOR_EXCEPTION( subcDim < 0 || subcDim >= static_cast<ordinal_type>(tagToOrdinal_.extent(0)), std::out_of_range,
647  ">>> ERROR (Basis::getDofOrdinal): subcDim is out of range");
648  INTREPID2_TEST_FOR_EXCEPTION( subcOrd < 0 || subcOrd >= static_cast<ordinal_type>(tagToOrdinal_.extent(1)), std::out_of_range,
649  ">>> ERROR (Basis::getDofOrdinal): subcOrd is out of range");
650  INTREPID2_TEST_FOR_EXCEPTION( subcDofOrd < 0 || subcDofOrd >= static_cast<ordinal_type>(tagToOrdinal_.extent(2)), std::out_of_range,
651  ">>> ERROR (Basis::getDofOrdinal): subcDofOrd is out of range");
652 #endif
653  ordinal_type r_val = -1;
654  if ( subcDim < static_cast<ordinal_type>(tagToOrdinal_.extent(0)) &&
655  subcOrd < static_cast<ordinal_type>(tagToOrdinal_.extent(1)) &&
656  subcDofOrd < static_cast<ordinal_type>(tagToOrdinal_.extent(2)) )
657  r_val = tagToOrdinal_(subcDim, subcOrd, subcDofOrd);
658 #ifdef HAVE_INTREPID2_DEBUG
659  INTREPID2_TEST_FOR_EXCEPTION( r_val == -1, std::runtime_error,
660  ">>> ERROR (Basis::getDofOrdinal): Invalid DoF tag is found.");
661 #endif
662  return r_val;
663  }
664 
668  return tagToOrdinal_;
669  }
670 
671 
683  getDofTag( const ordinal_type dofOrd ) const {
684 #ifdef HAVE_INTREPID2_DEBUG
685  INTREPID2_TEST_FOR_EXCEPTION( dofOrd < 0 || dofOrd >= static_cast<ordinal_type>(ordinalToTag_.extent(0)), std::out_of_range,
686  ">>> ERROR (Basis::getDofTag): dofOrd is out of range");
687 #endif
688  return Kokkos::subview(ordinalToTag_, dofOrd, Kokkos::ALL());
689  }
690 
691 
701  getAllDofTags() const {
702  return ordinalToTag_;
703  }
704 
705  }; // class Basis
706 
707 
708  //--------------------------------------------------------------------------------------------//
709  // //
710  // Helper functions of the Basis class //
711  // //
712  //--------------------------------------------------------------------------------------------//
713 
714  //
715  // functions for orders, cardinality, etc.
716  //
717 
718 
730  KOKKOS_INLINE_FUNCTION
731  ordinal_type getFieldRank(const EFunctionSpace spaceType);
732 
768  KOKKOS_INLINE_FUNCTION
769  ordinal_type getOperatorRank(const EFunctionSpace spaceType,
770  const EOperator operatorType,
771  const ordinal_type spaceDim);
772 
778  KOKKOS_INLINE_FUNCTION
779  ordinal_type getOperatorOrder(const EOperator operatorType);
780 
781  template<EOperator operatorType>
782  KOKKOS_INLINE_FUNCTION
783  constexpr ordinal_type getOperatorOrder();
784 
808  template<ordinal_type spaceDim>
809  KOKKOS_INLINE_FUNCTION
810  ordinal_type getDkEnumeration(const ordinal_type xMult,
811  const ordinal_type yMult = -1,
812  const ordinal_type zMult = -1);
813 
814 
825  template<ordinal_type spaceDim>
826  KOKKOS_INLINE_FUNCTION
827  ordinal_type getPnEnumeration(const ordinal_type p,
828  const ordinal_type q = 0,
829  const ordinal_type r = 0);
830 
831 
832 
851 template<typename value_type>
852 KOKKOS_INLINE_FUNCTION
853 void getJacobyRecurrenceCoeffs (
854  value_type &an,
855  value_type &bn,
856  value_type &cn,
857  const ordinal_type alpha,
858  const ordinal_type beta ,
859  const ordinal_type n);
860 
861 
862 
863 
864 
865  // /** \brief Returns multiplicities of dx, dy, and dz based on the enumeration of the partial
866  // derivative, its order and the space dimension. Inverse of the getDkEnumeration() method.
867 
868  // \param partialMult [out] - array with the multiplicities f dx, dy and dz
869  // \param derivativeEnum [in] - enumeration of the partial derivative
870  // \param operatorType [in] - k-th partial derivative Dk
871  // \param spaceDim [in] - space dimension
872  // */
873  // template<typename OrdinalArrayType>
874  // KOKKOS_INLINE_FUNCTION
875  // void getDkMultiplicities(OrdinalArrayType partialMult,
876  // const ordinal_type derivativeEnum,
877  // const EOperator operatorType,
878  // const ordinal_type spaceDim);
879 
898  KOKKOS_INLINE_FUNCTION
899  ordinal_type getDkCardinality(const EOperator operatorType,
900  const ordinal_type spaceDim);
901 
902  template<EOperator operatorType, ordinal_type spaceDim>
903  KOKKOS_INLINE_FUNCTION
904  constexpr ordinal_type getDkCardinality();
905 
906 
907 
917  template<ordinal_type spaceDim>
918  KOKKOS_INLINE_FUNCTION
919  ordinal_type getPnCardinality (ordinal_type n);
920 
921  template<ordinal_type spaceDim, ordinal_type n>
922  KOKKOS_INLINE_FUNCTION
923  constexpr ordinal_type getPnCardinality ();
924 
925 
926 
927  //
928  // Argument check
929  //
930 
931 
942  template<typename outputValueViewType,
943  typename inputPointViewType>
944  void getValues_HGRAD_Args( const outputValueViewType outputValues,
945  const inputPointViewType inputPoints,
946  const EOperator operatorType,
947  const shards::CellTopology cellTopo,
948  const ordinal_type basisCard );
949 
960  template<typename outputValueViewType,
961  typename inputPointViewType>
962  void getValues_HCURL_Args( const outputValueViewType outputValues,
963  const inputPointViewType inputPoints,
964  const EOperator operatorType,
965  const shards::CellTopology cellTopo,
966  const ordinal_type basisCard );
967 
978  template<typename outputValueViewType,
979  typename inputPointViewType>
980  void getValues_HDIV_Args( const outputValueViewType outputValues,
981  const inputPointViewType inputPoints,
982  const EOperator operatorType,
983  const shards::CellTopology cellTopo,
984  const ordinal_type basisCard );
985 
996  template<typename outputValueViewType,
997  typename inputPointViewType>
998  void getValues_HVOL_Args( const outputValueViewType outputValues,
999  const inputPointViewType inputPoints,
1000  const EOperator operatorType,
1001  const shards::CellTopology cellTopo,
1002  const ordinal_type basisCard );
1003 
1004 }// namespace Intrepid2
1005 
1006 #include <Intrepid2_BasisDef.hpp>
1007 
1008 //--------------------------------------------------------------------------------------------//
1009 // //
1010 // D O C U M E N T A T I O N P A G E S //
1011 // //
1012 //--------------------------------------------------------------------------------------------//
1114 #endif
Intrepid2::Basis::getCardinality
ordinal_type getCardinality() const
Returns cardinality of the basis.
Definition: Intrepid2_Basis.hpp:554
Intrepid2::Basis::basisCardinality_
ordinal_type basisCardinality_
Cardinality of the basis, i.e., the number of basis functions/degrees-of-freedom.
Definition: Intrepid2_Basis.hpp:174
Intrepid2::Basis< void, double, double >::ExecutionSpace
void ExecutionSpace
(Kokkos) Execution space for basis.
Definition: Intrepid2_Basis.hpp:99
Intrepid2::Basis::getPolynomialDegreeOfFieldAsVector
Kokkos::vector< int > getPolynomialDegreeOfFieldAsVector(int fieldOrdinal) const
For hierarchical bases, returns the polynomial degree (which may have multiple values in higher spati...
Definition: Intrepid2_Basis.hpp:508
Intrepid2::Basis::dofCoords_
Kokkos::DynRankView< scalarType, ExecSpaceType > dofCoords_
Coordinates of degrees-of-freedom for basis functions defined in physical space.
Definition: Intrepid2_Basis.hpp:294
Intrepid2::Basis::getBaseCellTopology
shards::CellTopology getBaseCellTopology() const
Returns the base cell topology for which the basis is defined. See Shards documentation https://trili...
Definition: Intrepid2_Basis.hpp:583
Intrepid2::Basis::getDofCount
ordinal_type getDofCount(const ordinal_type subcDim, const ordinal_type subcOrd) const
DoF count for specified subcell.
Definition: Intrepid2_Basis.hpp:615
Intrepid2::Basis::getName
virtual const char * getName() const
Returns basis name.
Definition: Intrepid2_Basis.hpp:537
Intrepid2::Basis::basisDegree_
ordinal_type basisDegree_
Degree of the largest complete polynomial space that can be represented by the basis.
Definition: Intrepid2_Basis.hpp:178
Intrepid2::Basis< void, double, double >::OrdinalTypeArrayStride1D
Kokkos::View< ordinal_type *, Kokkos::LayoutStride, void > OrdinalTypeArrayStride1D
View type for 1d device array.
Definition: Intrepid2_Basis.hpp:164
Intrepid2::Basis::getBasisType
EBasis getBasisType() const
Returns the basis type.
Definition: Intrepid2_Basis.hpp:593
Intrepid2::Basis::getValues
virtual void getValues(OutputViewType, const PointViewType, const PointViewType, const EOperator=OPERATOR_VALUE) const
Evaluation of an FVD basis evaluation on a physical cell.
Definition: Intrepid2_Basis.hpp:391
Intrepid2::Basis::getPolynomialDegreeOfField
OrdinalTypeArray1DHost getPolynomialDegreeOfField(int fieldOrdinal) const
For hierarchical bases, returns the polynomial degree (which may have multiple values in higher spati...
Definition: Intrepid2_Basis.hpp:491
Intrepid2::Basis::requireOrientation
virtual bool requireOrientation() const
True if orientation is required.
Definition: Intrepid2_Basis.hpp:545
Intrepid2::Basis::getAllDofOrdinal
const OrdinalTypeArray3DHost getAllDofOrdinal() const
DoF tag to ordinal data structure.
Definition: Intrepid2_Basis.hpp:667
Intrepid2_CellTopologyTags.hpp
Definition of cell topology information.
Intrepid2::Basis< void, double, double >::OrdinalTypeArray2D
Kokkos::View< ordinal_type **, void > OrdinalTypeArray2D
View type for 2d device array.
Definition: Intrepid2_Basis.hpp:154
Intrepid2::Basis
An abstract base class that defines interface for concrete basis implementations for Finite Element (...
Definition: Intrepid2_Basis.hpp:95
Intrepid2::Basis::getAllDofTags
const OrdinalTypeArray2DHost getAllDofTags() const
Retrieves all DoF tags.
Definition: Intrepid2_Basis.hpp:701
Intrepid2::EOperator
EOperator
Enumeration of primitive operators available in Intrepid. Primitive operators act on reconstructed fu...
Definition: Intrepid2_Types.hpp:271
Intrepid2::Basis::functionSpace_
EFunctionSpace functionSpace_
The function space in which the basis is defined.
Definition: Intrepid2_Basis.hpp:196
Intrepid2::Basis< void, double, double >::OrdinalTypeArray3DHost
Kokkos::View< ordinal_type ***, typename ExecSpaceType::array_layout, Kokkos::HostSpace > OrdinalTypeArray3DHost
View type for 3d host array.
Definition: Intrepid2_Basis.hpp:139
Intrepid2::Basis::getPolynomialDegreeLength
int getPolynomialDegreeLength() const
For hierarchical bases, returns the number of entries required to specify the polynomial degree of a ...
Definition: Intrepid2_Basis.hpp:524
Intrepid2::Basis< void, double, double >::OrdinalTypeArray3D
Kokkos::View< ordinal_type ***, void > OrdinalTypeArray3D
View type for 3d device array.
Definition: Intrepid2_Basis.hpp:159
Intrepid2_Utils.hpp
Header function for Intrepid2::Util class and other utility functions.
Intrepid2::Basis::getCoordinateSystem
ECoordinates getCoordinateSystem() const
Returns the type of coordinate system for which the basis is defined.
Definition: Intrepid2_Basis.hpp:603
Intrepid2::Basis::fieldOrdinalPolynomialDegree_
OrdinalTypeArray2DHost fieldOrdinalPolynomialDegree_
Polynomial degree for each degree of freedom. Only defined for hierarchical bases right now....
Definition: Intrepid2_Basis.hpp:313
Intrepid2::Basis::getFieldOrdinalsForDegree
Kokkos::vector< int > getFieldOrdinalsForDegree(Kokkos::vector< int > &degrees) const
For hierarchical bases, returns the field ordinals that have at most the specified degree in each dim...
Definition: Intrepid2_Basis.hpp:467
Intrepid2::Basis< void, double, double >::OrdinalTypeArray1D
Kokkos::View< ordinal_type *, void > OrdinalTypeArray1D
View type for 1d device array.
Definition: Intrepid2_Basis.hpp:149
Intrepid2::Basis::getDummyOutputValue
OutputValueType getDummyOutputValue()
Dummy array to receive input arguments.
Definition: Intrepid2_Basis.hpp:322
Intrepid2::Basis< void, double, double >::ScalarViewType
Kokkos::DynRankView< scalarType, Kokkos::LayoutStride, void > ScalarViewType
View type for scalars.
Definition: Intrepid2_Basis.hpp:340
Intrepid2::Basis::scalarType
ScalarTraits< pointValueType >::scalar_type scalarType
Scalar type for point values.
Definition: Intrepid2_Basis.hpp:169
Intrepid2::Basis::basisType_
EBasis basisType_
Type of the basis.
Definition: Intrepid2_Basis.hpp:188
Intrepid2::Basis::dofCoeffs_
Kokkos::DynRankView< scalarType, ExecSpaceType > dofCoeffs_
Coefficients for computing degrees of freedom for Lagrangian basis If P is an element of the space sp...
Definition: Intrepid2_Basis.hpp:304
Intrepid2_Types.hpp
Contains definitions of custom data types in Intrepid2.
Intrepid2::Basis::getDofCoords
virtual void getDofCoords(ScalarViewType) const
Returns spatial locations (coordinates) of degrees of freedom on the reference cell.
Definition: Intrepid2_Basis.hpp:405
Intrepid2::Basis< void, double, double >::OutputValueType
double OutputValueType
Output value type for basis; default is double.
Definition: Intrepid2_Basis.hpp:103
Intrepid2::Basis::getDummyPointValue
PointValueType getDummyPointValue()
Dummy array to receive input arguments.
Definition: Intrepid2_Basis.hpp:326
Intrepid2::Basis< void, double, double >::OrdinalViewType
Kokkos::View< ordinal_type, void > OrdinalViewType
View type for ordinal.
Definition: Intrepid2_Basis.hpp:111
Intrepid2::Basis< void, double, double >::OutputViewType
Kokkos::DynRankView< OutputValueType, Kokkos::LayoutStride, void > OutputViewType
View type for basis value output.
Definition: Intrepid2_Basis.hpp:330
Intrepid2::Basis::getFieldOrdinalsForDegree
OrdinalTypeArray1DHost getFieldOrdinalsForDegree(OrdinalTypeArray1DHost &degrees) const
For hierarchical bases, returns the field ordinals that have at most the specified degree in each dim...
Definition: Intrepid2_Basis.hpp:432
Intrepid2_BasisDef.hpp
Implementation file for the abstract base class Intrepid2::Basis.
Intrepid2::Basis< void, double, double >::OrdinalTypeArrayStride1DHost
Kokkos::View< ordinal_type *, Kokkos::LayoutStride, Kokkos::HostSpace > OrdinalTypeArrayStride1DHost
View type for 1d host array.
Definition: Intrepid2_Basis.hpp:144
Intrepid2::Basis< void, double, double >::ECoordinatesViewType
Kokkos::View< ECoordinates, void > ECoordinatesViewType
View for coordinate system type.
Definition: Intrepid2_Basis.hpp:121
Intrepid2::Basis::getDofCoeffs
virtual void getDofCoeffs(ScalarViewType) const
Coefficients for computing degrees of freedom for Lagrangian basis If P is an element of the space sp...
Definition: Intrepid2_Basis.hpp:420
Intrepid2::Basis::getDofOrdinal
ordinal_type getDofOrdinal(const ordinal_type subcDim, const ordinal_type subcOrd, const ordinal_type subcDofOrd) const
DoF tag to ordinal lookup.
Definition: Intrepid2_Basis.hpp:641
Intrepid2::Basis::getValues
virtual void getValues(OutputViewType, const PointViewType, const EOperator=OPERATOR_VALUE) const
Evaluation of a FEM basis on a reference cell.
Definition: Intrepid2_Basis.hpp:363
Intrepid2::Basis::getDofTag
const OrdinalTypeArrayStride1DHost getDofTag(const ordinal_type dofOrd) const
DoF ordinal to DoF tag lookup.
Definition: Intrepid2_Basis.hpp:683
Intrepid2::Basis::ordinalToTag_
OrdinalTypeArray2DHost ordinalToTag_
"true" if tagToOrdinal_ and ordinalToTag_ have been initialized
Definition: Intrepid2_Basis.hpp:213
Intrepid2::Basis< void, double, double >::PointViewType
Kokkos::DynRankView< PointValueType, Kokkos::LayoutStride, void > PointViewType
View type for input points.
Definition: Intrepid2_Basis.hpp:335
Intrepid2::ECoordinates
ECoordinates
Enumeration of coordinate systems for geometrical entities (cells, points).
Definition: Intrepid2_Types.hpp:196
Intrepid2::Basis::setOrdinalTagData
void setOrdinalTagData(OrdinalTypeView3D &tagToOrdinal, OrdinalTypeView2D &ordinalToTag, const OrdinalTypeView1D tags, const ordinal_type basisCard, const ordinal_type tagSize, const ordinal_type posScDim, const ordinal_type posScOrd, const ordinal_type posDfOrd)
Fills ordinalToTag_ and tagToOrdinal_ by basis-specific tag data.
Definition: Intrepid2_Basis.hpp:242
Intrepid2::Basis< void, double, double >::PointValueType
double PointValueType
Point value type for basis; default is double.
Definition: Intrepid2_Basis.hpp:107
Intrepid2::Basis< void, double, double >::EBasisViewType
Kokkos::View< EBasis, void > EBasisViewType
View for basis type.
Definition: Intrepid2_Basis.hpp:116
Intrepid2::Basis::basisCellTopology_
shards::CellTopology basisCellTopology_
Base topology of the cells for which the basis is defined. See the Shards package for definition of b...
Definition: Intrepid2_Basis.hpp:184
Intrepid2::Basis< void, double, double >::OrdinalTypeArray2DHost
Kokkos::View< ordinal_type **, typename ExecSpaceType::array_layout, Kokkos::HostSpace > OrdinalTypeArray2DHost
View type for 2d host array.
Definition: Intrepid2_Basis.hpp:134
Intrepid2::Basis::tagToOrdinal_
OrdinalTypeArray3DHost tagToOrdinal_
DoF tag to ordinal lookup table.
Definition: Intrepid2_Basis.hpp:226
Intrepid2::Basis< void, double, double >::OrdinalTypeArray1DHost
Kokkos::View< ordinal_type *, typename ExecSpaceType::array_layout, Kokkos::HostSpace > OrdinalTypeArray1DHost
View type for 1d host array.
Definition: Intrepid2_Basis.hpp:129
Intrepid2::Basis::getFunctionSpace
EFunctionSpace getFunctionSpace() const
Returns the function space for the basis.
Definition: Intrepid2_Basis.hpp:573
Intrepid2::EBasis
EBasis
Enumeration of basis types for discrete spaces in Intrepid.
Definition: Intrepid2_Types.hpp:449
Intrepid2::Basis::basisCoordinates_
ECoordinates basisCoordinates_
The coordinate system for which the basis is defined.
Definition: Intrepid2_Basis.hpp:192
Intrepid2::Basis::getDegree
ordinal_type getDegree() const
Returns the degree of the basis.
Definition: Intrepid2_Basis.hpp:564