49 #ifndef __INTREPID2_HGRAD_TET_C1_FEM_DEF_HPP__
50 #define __INTREPID2_HGRAD_TET_C1_FEM_DEF_HPP__
58 template<EOperator opType>
59 template<
typename OutputViewType,
60 typename inputViewType>
61 KOKKOS_INLINE_FUNCTION
63 Basis_HGRAD_TET_C1_FEM::Serial<opType>::
64 getValues( OutputViewType output,
65 const inputViewType input ) {
67 case OPERATOR_VALUE: {
68 const auto x = input(0);
69 const auto y = input(1);
70 const auto z = input(2);
73 output.access(0) = 1.0 - x - y -z;
81 output.access(0, 0) = -1.0;
82 output.access(0, 1) = -1.0;
83 output.access(0, 2) = -1.0;
85 output.access(1, 0) = 1.0;
86 output.access(1, 1) = 0.0;
87 output.access(1, 2) = 0.0;
89 output.access(2, 0) = 0.0;
90 output.access(2, 1) = 1.0;
91 output.access(2, 2) = 0.0;
93 output.access(3, 0) = 0.0;
94 output.access(3, 1) = 0.0;
95 output.access(3, 2) = 1.0;
99 const ordinal_type jend = output.extent(1);
100 const ordinal_type iend = output.extent(0);
102 for (ordinal_type j=0;j<jend;++j)
103 for (ordinal_type i=0;i<iend;++i)
104 output.access(i, j) = 0.0;
108 INTREPID2_TEST_FOR_ABORT( opType != OPERATOR_VALUE &&
109 opType != OPERATOR_GRAD &&
110 opType != OPERATOR_MAX,
111 ">>> ERROR: (Intrepid2::Basis_HGRAD_TET_C1_FEM::Serial::getValues) operator is not supported");
116 template<
typename DT,
117 typename outputValueValueType,
class ...outputValueProperties,
118 typename inputPointValueType,
class ...inputPointProperties>
120 Basis_HGRAD_TET_C1_FEM::
121 getValues(
const typename DT::execution_space& space,
122 Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
123 const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
124 const EOperator operatorType ) {
125 typedef Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValueViewType;
126 typedef Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPointViewType;
127 typedef typename ExecSpace<typename inputPointViewType::execution_space,typename DT::execution_space>::ExecSpaceType ExecSpaceType;
130 const auto loopSize = inputPoints.extent(0);
131 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(space, 0, loopSize);
133 switch (operatorType) {
135 case OPERATOR_VALUE: {
136 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_VALUE> FunctorType;
137 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
142 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_GRAD> FunctorType;
143 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
146 case OPERATOR_CURL: {
147 INTREPID2_TEST_FOR_EXCEPTION( operatorType == OPERATOR_CURL, std::invalid_argument,
148 ">>> ERROR (Basis_HGRAD_TET_C1_FEM): CURL is invalid operator for rank-0 (scalar) functions in 3D");
152 INTREPID2_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_DIV), std::invalid_argument,
153 ">>> ERROR (Basis_HGRAD_TET_C1_FEM): DIV is invalid operator for rank-0 (scalar) functions in 3D");
165 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_MAX> FunctorType;
166 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
170 INTREPID2_TEST_FOR_EXCEPTION( !( Intrepid2::isValidOperator(operatorType) ), std::invalid_argument,
171 ">>> ERROR (Basis_HGRAD_TET_C1_FEM): Invalid operator type");
178 template<
typename DT,
typename OT,
typename PT>
181 this->basisCardinality_ = 4;
182 this->basisDegree_ = 1;
183 this->basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Tetrahedron<4> >() );
184 this->basisType_ = BASIS_FEM_DEFAULT;
185 this->basisCoordinates_ = COORDINATES_CARTESIAN;
186 this->functionSpace_ = FUNCTION_SPACE_HGRAD;
191 const ordinal_type tagSize = 4;
192 const ordinal_type posScDim = 0;
193 const ordinal_type posScOrd = 1;
194 const ordinal_type posDfOrd = 2;
197 ordinal_type tags[16] = { 0, 0, 0, 1,
208 this->setOrdinalTagData(this->tagToOrdinal_,
211 this->basisCardinality_,
225 Kokkos::DynRankView<typename ScalarViewType::value_type,typename DT::execution_space::array_layout,Kokkos::HostSpace>
226 dofCoords(
"dofCoordsHost", this->basisCardinality_,this->basisCellTopology_.getDimension());
228 dofCoords(0,0) = 0.0; dofCoords(0,1) = 0.0; dofCoords(0,2) = 0.0;
229 dofCoords(1,0) = 1.0; dofCoords(1,1) = 0.0; dofCoords(1,2) = 0.0;
230 dofCoords(2,0) = 0.0; dofCoords(2,1) = 1.0; dofCoords(2,2) = 0.0;
231 dofCoords(3,0) = 0.0; dofCoords(3,1) = 0.0; dofCoords(3,2) = 1.0;
233 this->dofCoords_ = Kokkos::create_mirror_view(
typename DT::memory_space(), dofCoords);
234 Kokkos::deep_copy(this->dofCoords_, dofCoords);
Basis_HGRAD_TET_C1_FEM()
Constructor.
Kokkos::View< ordinal_type *, typename ExecutionSpace::array_layout, Kokkos::HostSpace > OrdinalTypeArray1DHost
View type for 1d host array.