190 const EPointType pointType ) {
192 constexpr ordinal_type spaceDim = 3;
193 this->basisCardinality_ = CardinalityHDivTet(order);
194 this->basisDegree_ = order;
195 this->basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Tetrahedron<4> >() );
196 this->basisType_ = BASIS_FEM_LAGRANGIAN;
197 this->basisCoordinates_ = COORDINATES_CARTESIAN;
198 this->functionSpace_ = FUNCTION_SPACE_HDIV;
199 pointType_ = pointType;
201 const ordinal_type card = this->basisCardinality_;
203 const ordinal_type cardPn = Intrepid2::getPnCardinality<spaceDim>(order);
204 const ordinal_type cardPnm1 = Intrepid2::getPnCardinality<spaceDim>(order-1);
205 const ordinal_type cardPnm2 = Intrepid2::getPnCardinality<spaceDim>(order-2);
206 const ordinal_type cardVecPn = spaceDim*cardPn;
207 const ordinal_type cardVecPnm1 = spaceDim*cardPnm1;
208 const ordinal_type dim_PkH = cardPnm1 - cardPnm2;
212 INTREPID2_TEST_FOR_EXCEPTION( order >
Parameters::MaxOrder, std::invalid_argument,
"polynomial order exceeds the max supported by this class");
215 constexpr ordinal_type tagSize = 4;
217 ordinal_type tags[maxCard][tagSize];
220 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
221 dofCoords(
"Hdiv::Tet::In::dofCoords", card, spaceDim);
223 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
224 dofCoeffs(
"Hdiv::Tet::In::dofCoeffs", card, spaceDim);
226 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
227 coeffs(
"Hdiv::Tet::In::coeffs", cardVecPn, card);
233 const ordinal_type lwork = card*card;
234 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
235 V1(
"Hdiv::Tet::In::V1", cardVecPn, card);
246 for (ordinal_type i=0;i<cardPnm1;i++) {
247 for (ordinal_type k=0; k<3;k++) {
248 V1(k*cardPn+i,k*cardPnm1+i) = 1.0;
255 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> cubPoints(
"Hdiv::Tet::In::cubPoints", myCub.
getNumPoints() , spaceDim );
256 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> cubWeights(
"Hdiv::Tet::In::cubWeights", myCub.
getNumPoints() );
260 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> phisAtCubPoints(
"Hdiv::Tet::In::phisAtCubPoints", cardPn , myCub.
getNumPoints() );
261 Impl::Basis_HGRAD_TET_Cn_FEM_ORTH::getValues<Kokkos::HostSpace::execution_space,Parameters::MaxNumPtsPerBasisEval>(phisAtCubPoints, cubPoints, order, OPERATOR_VALUE);
264 for (ordinal_type i=0;i<dim_PkH;i++) {
265 for (ordinal_type j=0;j<cardPn;j++) {
266 V1(j,cardVecPnm1+i) = 0.0;
267 for (ordinal_type d=0; d< spaceDim; ++d)
269 V1(j+d*cardPn,cardVecPnm1+i) +=
270 cubWeights(k) * cubPoints(k,d)
271 * phisAtCubPoints(cardPnm2+i,k)
272 * phisAtCubPoints(j,k);
278 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
279 V2(
"Hdiv::Tet::In::V2", card ,cardVecPn);
281 const ordinal_type numFaces = this->basisCellTopology_.getFaceCount();
283 shards::CellTopology faceTop(shards::getCellTopologyData<shards::Triangle<3> >() );
290 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> triPts(
"Hdiv::Tet::In::triPts", numPtsPerFace , 2 );
293 const ordinal_type offset = 1;
301 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> facePts(
"Hdiv::Tet::In::facePts", numPtsPerFace , spaceDim );
302 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> phisAtFacePoints(
"Hdiv::Tet::In::phisAtFacePoints", cardPn , numPtsPerFace );
303 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> faceNormal(
"Hcurl::Tet::In::faceNormal", spaceDim );
306 for (ordinal_type face=0;face<numFaces;face++) {
311 this->basisCellTopology_ );
317 this->basisCellTopology_ );
320 Impl::Basis_HGRAD_TET_Cn_FEM_ORTH::getValues<Kokkos::HostSpace::execution_space,Parameters::MaxNumPtsPerBasisEval>(phisAtFacePoints, facePts, order, OPERATOR_VALUE);
323 for (ordinal_type j=0;j<numPtsPerFace;j++) {
325 const ordinal_type i_card = numPtsPerFace*face+j;
328 for (ordinal_type k=0;k<cardPn;k++) {
330 for (ordinal_type l=0; l<spaceDim; l++)
331 V2(i_card,k+l*cardPn) = faceNormal(l) * phisAtFacePoints(k,j);
335 for(ordinal_type l=0; l<spaceDim; ++l) {
336 dofCoords(i_card,l) = facePts(j,l);
337 dofCoeffs(i_card,l) = faceNormal(l);
341 tags[i_card][1] = face;
343 tags[i_card][3] = numPtsPerFace;
356 if (numPtsPerCell > 0) {
357 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
358 internalPoints(
"Hdiv::Tet::In::internalPoints", numPtsPerCell , spaceDim );
360 this->basisCellTopology_ ,
365 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
366 phisAtInternalPoints(
"Hdiv::Tet::In::phisAtInternalPoints", cardPn , numPtsPerCell );
367 Impl::Basis_HGRAD_TET_Cn_FEM_ORTH::getValues<Kokkos::HostSpace::execution_space,Parameters::MaxNumPtsPerBasisEval>( phisAtInternalPoints , internalPoints , order, OPERATOR_VALUE );
370 for (ordinal_type j=0;j<numPtsPerCell;j++) {
372 const ordinal_type i_card = numFaces*numPtsPerFace+spaceDim*j;
374 for (ordinal_type k=0;k<cardPn;k++) {
375 for (ordinal_type l=0;l<spaceDim;l++) {
376 V2(i_card+l,l*cardPn+k) = phisAtInternalPoints(k,j);
381 for(ordinal_type d=0; d<spaceDim; ++d) {
382 for(ordinal_type l=0; l<spaceDim; ++l) {
383 dofCoords(i_card+d,l) = internalPoints(j,l);
384 dofCoeffs(i_card+d,l) = (l==d);
387 tags[i_card+d][0] = spaceDim;
388 tags[i_card+d][1] = 0;
389 tags[i_card+d][2] = spaceDim*j+d;
390 tags[i_card+d][3] = spaceDim*numPtsPerCell;
397 Kokkos::DynRankView<scalarType,Kokkos::LayoutLeft,Kokkos::HostSpace>
398 vmat(
"Hdiv::Tet::In::vmat", card, card),
399 work(
"Hdiv::Tet::In::work", lwork),
400 ipiv(
"Hdiv::Tet::In::ipiv", card);
403 for(ordinal_type i=0; i< card; ++i) {
404 for(ordinal_type j=0; j< card; ++j) {
406 for(ordinal_type k=0; k< cardVecPn; ++k)
407 s += V2(i,k)*V1(k,j);
412 ordinal_type info = 0;
413 Teuchos::LAPACK<ordinal_type,scalarType> lapack;
415 lapack.GETRF(card, card,
416 vmat.data(), vmat.stride_1(),
417 (ordinal_type*)ipiv.data(),
420 INTREPID2_TEST_FOR_EXCEPTION( info != 0,
422 ">>> ERROR: (Intrepid2::Basis_HDIV_TET_In_FEM) lapack.GETRF returns nonzero info." );
425 vmat.data(), vmat.stride_1(),
426 (ordinal_type*)ipiv.data(),
430 INTREPID2_TEST_FOR_EXCEPTION( info != 0,
432 ">>> ERROR: (Intrepid2::Basis_HDIV_TET_In_FEM) lapack.GETRI returns nonzero info." );
434 for (ordinal_type i=0;i<cardVecPn;++i)
435 for (ordinal_type j=0;j<card;++j){
437 for(ordinal_type k=0; k< card; ++k)
438 s += V1(i,k)*vmat(k,j);
442 this->coeffs_ = Kokkos::create_mirror_view(
typename DT::memory_space(), coeffs);
443 Kokkos::deep_copy(this->coeffs_ , coeffs);
445 this->dofCoords_ = Kokkos::create_mirror_view(
typename DT::memory_space(), dofCoords);
446 Kokkos::deep_copy(this->dofCoords_, dofCoords);
448 this->dofCoeffs_ = Kokkos::create_mirror_view(
typename DT::memory_space(), dofCoeffs);
449 Kokkos::deep_copy(this->dofCoeffs_, dofCoeffs);
455 const ordinal_type posScDim = 0;
456 const ordinal_type posScOrd = 1;
457 const ordinal_type posDfOrd = 2;
459 OrdinalTypeArray1DHost tagView(&tags[0][0], card*tagSize);
463 this->setOrdinalTagData(this->tagToOrdinal_,
466 this->basisCardinality_,