Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_Intrepid_ConstBasis_impl.hpp
Go to the documentation of this file.
1 #ifndef __Panzer_Intrepid_ConstBasis_impl_hpp__
2 #define __Panzer_Intrepid_ConstBasis_impl_hpp__
3 
4 namespace panzer {
5 
6 
7 template<class Scalar, class ArrayScalar>
8 Basis_Constant<Scalar,ArrayScalar>::Basis_Constant(const shards::CellTopology & ct)
9  {
10  this -> basisCardinality_ = 1;
11  this -> basisDegree_ = 0;
12  this -> basisCellTopology_ = ct;
13  this -> basisType_ = Intrepid2::BASIS_FEM_DEFAULT;
14  this -> basisCoordinates_ = Intrepid2::COORDINATES_CARTESIAN;
15  this -> basisTagsAreSet_ = false;
16 
17  initializeTags();
18  this->basisTagsAreSet_ = true;
19  }
20 
21 
22 
23 template<class Scalar, class ArrayScalar>
25 
26  // Basis-dependent initializations
27  int tagSize = 4; // size of DoF tag, i.e., number of fields in the tag
28  int posScDim = 0; // position in the tag, counting from 0, of the subcell dim
29  int posScOrd = 1; // position in the tag, counting from 0, of the subcell ordinal
30  int posDfOrd = 2; // position in the tag, counting from 0, of DoF ordinal relative to the subcell
31 
32  int dim = this -> basisCellTopology_.getDimension();
33 
34  // An array with local DoF tags assigned to the basis functions, in the order of their local enumeration
35  int tags[] = { dim, 0, 0, 1 };
36 
37  // Basis-independent function sets tag and enum data in tagToOrdinal_ and ordinalToTag_ arrays:
38  Intrepid2::setOrdinalTagData(this -> tagToOrdinal_,
39  this -> ordinalToTag_,
40  tags,
41  this -> basisCardinality_,
42  tagSize,
43  posScDim,
44  posScOrd,
45  posDfOrd);
46 }
47 
48 
49 
50 template<class Scalar, class ArrayScalar>
51 void Basis_Constant<Scalar, ArrayScalar>::getValues(ArrayScalar & outputValues,
52  const ArrayScalar & inputPoints,
53  const Intrepid2::EOperator operatorType) const {
54 
55  // Verify arguments
56 #ifdef HAVE_INTREPID_DEBUG
57  Intrepid2::getValues_HGRAD_Args<Scalar, ArrayScalar>(outputValues,
58  inputPoints,
59  operatorType,
60  this -> getBaseCellTopology(),
61  this -> getCardinality() );
62 #endif
63 
64  // Number of evaluation points = dim 0 of inputPoints
65  int dim0 = inputPoints.dimension(0);
66 
67  switch (operatorType) {
68 
69  case Intrepid2::OPERATOR_VALUE:
70  for (int i0 = 0; i0 < dim0; i0++) {
71  // outputValues is a rank-2 array with dimensions (basisCardinality_, dim0)
72  outputValues(0, i0) = 1.0;
73  }
74  break;
75 
76  case Intrepid2::OPERATOR_GRAD:
77  case Intrepid2::OPERATOR_D1:
78  case Intrepid2::OPERATOR_CURL:
79  case Intrepid2::OPERATOR_DIV:
80  case Intrepid2::OPERATOR_D2:
81  case Intrepid2::OPERATOR_D3:
82  case Intrepid2::OPERATOR_D4:
83  case Intrepid2::OPERATOR_D5:
84  case Intrepid2::OPERATOR_D6:
85  case Intrepid2::OPERATOR_D7:
86  case Intrepid2::OPERATOR_D8:
87  case Intrepid2::OPERATOR_D9:
88  case Intrepid2::OPERATOR_D10:
89  default:
90  TEUCHOS_TEST_FOR_EXCEPTION( !( Intrepid2::isValidOperator(operatorType) ), std::invalid_argument,
91  ">>> ERROR (Basis_Constant): Invalid operator type");
92  }
93 }
94 
95 
96 
97 template<class Scalar, class ArrayScalar>
98 void Basis_Constant<Scalar, ArrayScalar>::getValues(ArrayScalar& outputValues,
99  const ArrayScalar & inputPoints,
100  const ArrayScalar & cellVertices,
101  const Intrepid2::EOperator operatorType) const {
102  TEUCHOS_TEST_FOR_EXCEPTION( (true), std::logic_error,
103  ">>> ERROR (Basis_Constant): FEM Basis calling an FVD member function");
104 }
105 
106 }// namespace panzer
107 #endif
Basis_Constant(const shards::CellTopology &ct)
Constructor.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void getValues(ArrayScalar &outputValues, const ArrayScalar &inputPoints, const Intrepid2::EOperator operatorType) const
Evaluation of a FEM basis on a reference Triangle cell.
void initializeTags()
Initializes tagToOrdinal_ and ordinalToTag_ lookup arrays.