164 const EPointType pointType ) {
166 constexpr ordinal_type spaceDim = 3;
167 this->basisCardinality_ = CardinalityHCurlTet(order);
168 this->basisDegree_ = order;
169 this->basisCellTopologyKey_ = shards::Tetrahedron<4>::key;
170 this->basisType_ = BASIS_FEM_LAGRANGIAN;
171 this->basisCoordinates_ = COORDINATES_CARTESIAN;
172 this->functionSpace_ = FUNCTION_SPACE_HCURL;
173 pointType_ = pointType;
174 const ordinal_type card = this->basisCardinality_;
176 const ordinal_type cardPn = Intrepid2::getPnCardinality<spaceDim>(order);
177 const ordinal_type cardPnm1 = Intrepid2::getPnCardinality<spaceDim>(order-1);
178 const ordinal_type cardPnm2 = Intrepid2::getPnCardinality<spaceDim>(order-2);
179 const ordinal_type cardVecPn = spaceDim*cardPn;
180 const ordinal_type cardVecPnm1 = spaceDim*cardPnm1;
181 const ordinal_type cardPnm1H = cardPnm1-cardPnm2;
185 INTREPID2_TEST_FOR_EXCEPTION( order >
Parameters::MaxOrder, std::invalid_argument,
"polynomial order exceeds the max supported by this class");
188 constexpr ordinal_type tagSize = 4;
190 ordinal_type tags[maxCard][tagSize];
193 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
194 dofCoords(
"Hcurl::Tet::In::dofCoords", card, spaceDim);
196 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
197 coeffs(
"Hcurl::Tet::In::coeffs", cardVecPn, card);
199 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
200 dofCoeffs(
"Hcurl::Tet::In::dofCoeffs", card, spaceDim);
206 Kokkos::DynRankView<scalarType,Kokkos::LayoutLeft,Kokkos::HostSpace>
207 V1(
"Hcurl::Tet::In::V1", cardVecPn, cardVecPnm1 + spaceDim*cardPnm1H);
211 for (ordinal_type i=0;i<cardPnm1;i++)
212 for (ordinal_type d=0;d<spaceDim;d++)
213 V1(i+d*cardPn,i+d*cardPnm1) = 1.0;
219 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> cubPoints(
"Hcurl::Tet::In::cubPoints", myCub.
getNumPoints() , spaceDim );
220 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> cubWeights(
"Hcurl::Tet::In::cubWeights", myCub.
getNumPoints() );
224 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> phisAtCubPoints(
"Hcurl::Tet::In::phisAtCubPoints", cardPn , myCub.
getNumPoints() );
225 Impl::Basis_HGRAD_TET_Cn_FEM_ORTH::getValues<Kokkos::HostSpace::execution_space,Parameters::MaxNumPtsPerBasisEval>(
typename Kokkos::HostSpace::execution_space{},
232 for (ordinal_type i=0;i<cardPn;i++) {
233 for (ordinal_type j=0;j<cardPnm1H;j++) {
234 for (ordinal_type d=0; d< spaceDim; ++d) {
235 scalarType integral(0);
237 integral += cubWeights(k) * cubPoints(k,d)
238 * phisAtCubPoints(cardPnm2+j,k)
239 * phisAtCubPoints(i,k);
240 ordinal_type d1 = (d+1) % spaceDim, d2 = (d+2) % spaceDim;
241 V1(i+d2*cardPn,cardVecPnm1+d1*cardPnm1H + j) = -integral;
242 V1(i+d1*cardPn,cardVecPnm1+d2*cardPnm1H + j) = integral;
252 Kokkos::DynRankView<scalarType,Kokkos::LayoutLeft,Kokkos::HostSpace>
253 S(
"Hcurl::Tet::In::S", cardVecPn,1),
254 U(
"Hcurl::Tet::In::U", cardVecPn, cardVecPn),
255 Vt(
"Hcurl::Tet::In::Vt", cardVecPn, cardVecPn),
256 work(
"Hcurl::Tet::In::work", 5*cardVecPn,1),
257 rWork(
"Hcurl::Tet::In::rW", 1,1);
261 ordinal_type info = 0;
262 Teuchos::LAPACK<ordinal_type,scalarType> lapack;
282#ifdef HAVE_INTREPID2_DEBUG
283 ordinal_type num_nonzero_sv = 0;
284 for (
int i=0;i<cardVecPn;i++)
285 num_nonzero_sv += (S(i,0) > 10*tolerence());
287 INTREPID2_TEST_FOR_EXCEPTION( num_nonzero_sv != card, std::invalid_argument,
288 ">>> ERROR: (Intrepid2::Basis_HCURL_TET_In_FEM( order, pointType), Matrix V1 should have rank equal to the cardinality of HCURL space");
292 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
293 V2(
"Hcurl::Tet::In::V2", card ,cardVecPn);
295 shards::CellTopology cellTopo(shards::getCellTopologyData<shards::Tetrahedron<4> >());
296 const ordinal_type numEdges = cellTopo.getEdgeCount();
297 const ordinal_type numFaces = cellTopo.getFaceCount();
302 shards::CellTopology edgeTopo(shards::getCellTopologyData<shards::Line<2> >() );
303 shards::CellTopology faceTopo(shards::getCellTopologyData<shards::Triangle<3> >() );
317 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> linePts(
"Hcurl::Tet::In::linePts", numPtsPerEdge , 1 );
318 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> triPts(
"Hcurl::Tet::In::triPts", numPtsPerFace , 2 );
321 const ordinal_type offset = 1;
336 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> edgePts(
"Hcurl::Tet::In::edgePts", numPtsPerEdge , spaceDim );
337 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> facePts(
"Hcurl::Tet::In::facePts", numPtsPerFace , spaceDim );
338 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> phisAtEdgePoints(
"Hcurl::Tet::In::phisAtEdgePoints", cardPn , numPtsPerEdge );
339 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> phisAtFacePoints(
"Hcurl::Tet::In::phisAtFacePoints", cardPn , numPtsPerFace);
341 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> edgeTan(
"Hcurl::Tet::In::edgeTan", spaceDim );
344 for (ordinal_type i=0;i<numEdges;i++) {
355 Impl::Basis_HGRAD_TET_Cn_FEM_ORTH::getValues<Kokkos::HostSpace::execution_space,Parameters::MaxNumPtsPerBasisEval>(
typename Kokkos::HostSpace::execution_space{},
362 for (ordinal_type j=0;j<numPtsPerEdge;j++) {
364 const ordinal_type i_card = numPtsPerEdge*i+j;
367 for (ordinal_type k=0;k<cardPn;k++)
368 for (ordinal_type d=0;d<spaceDim;d++)
369 V2(i_card,k+d*cardPn) = edgeTan(d) * phisAtEdgePoints(k,j);
372 for(ordinal_type k=0; k<spaceDim; ++k) {
373 dofCoords(i_card,k) = edgePts(j,k);
374 dofCoeffs(i_card,k) = edgeTan(k);
380 tags[i_card][3] = numPtsPerEdge;
385 if(numPtsPerFace >0) {
386 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> faceTan1(
"Hcurl::Tet::In::edgeTan", spaceDim );
387 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> faceTan2(
"Hcurl::Tet::In::edgeTan", spaceDim );
389 for (ordinal_type i=0;i<numFaces;i++) {
401 Impl::Basis_HGRAD_TET_Cn_FEM_ORTH::getValues<Kokkos::HostSpace::execution_space,Parameters::MaxNumPtsPerBasisEval>(
typename Kokkos::HostSpace::execution_space{},
408 for (ordinal_type j=0;j<numPtsPerFace;j++) {
410 const ordinal_type i_card = numEdges*numPtsPerEdge+2*numPtsPerFace*i+2*j;
411 const ordinal_type i_card_p1 = i_card+1;
414 for (ordinal_type k=0;k<cardPn;k++)
415 for (ordinal_type d=0;d<spaceDim;d++) {
416 V2(i_card,k+d*cardPn) = faceTan1(d) * phisAtFacePoints(k,j);
417 V2(i_card_p1,k+d*cardPn) = faceTan2(d) * phisAtFacePoints(k,j);
421 for(ordinal_type k=0; k<spaceDim; ++k) {
422 dofCoords(i_card,k) = facePts(j,k);
423 dofCoords(i_card_p1,k) = facePts(j,k);
424 dofCoeffs(i_card,k) = faceTan1(k);
425 dofCoeffs(i_card_p1,k) = faceTan2(k);
430 tags[i_card][2] = 2*j;
431 tags[i_card][3] = 2*numPtsPerFace;
433 tags[i_card_p1][0] = 2;
434 tags[i_card_p1][1] = i;
435 tags[i_card_p1][2] = 2*j+1;
436 tags[i_card_p1][3] = 2*numPtsPerFace;
444 if (numPtsPerCell > 0) {
445 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
446 cellPoints(
"Hcurl::Tet::In::cellPoints", numPtsPerCell , spaceDim );
453 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
454 phisAtCellPoints(
"Hcurl::Tet::In::phisAtCellPoints", cardPn , numPtsPerCell );
455 Impl::Basis_HGRAD_TET_Cn_FEM_ORTH::getValues<Kokkos::HostSpace::execution_space,Parameters::MaxNumPtsPerBasisEval>(
typename Kokkos::HostSpace::execution_space{},
462 for (ordinal_type j=0;j<numPtsPerCell;j++) {
464 const ordinal_type i_card = numEdges*numPtsPerEdge+2*numFaces*numPtsPerFace+spaceDim*j;
466 for (ordinal_type k=0;k<cardPn;k++)
467 for (ordinal_type d=0;d<spaceDim;d++)
468 V2(i_card+d,d*cardPn+k) = phisAtCellPoints(k,j);
472 for(ordinal_type d=0; d<spaceDim; ++d) {
473 for(ordinal_type dim=0; dim<spaceDim; ++dim) {
474 dofCoords(i_card+d,dim) = cellPoints(j,dim);
475 dofCoeffs(i_card+d,dim) = (d==dim);
478 tags[i_card+d][0] = spaceDim;
479 tags[i_card+d][1] = 0;
480 tags[i_card+d][2] = spaceDim*j+d;
481 tags[i_card+d][3] = spaceDim*numPtsPerCell;
488 const ordinal_type lwork = card*card;
489 Kokkos::DynRankView<scalarType,Kokkos::LayoutLeft,Kokkos::HostSpace>
490 vmat(
"Hcurl::Tet::In::vmat", card, card),
491 work1(
"Hcurl::Tet::In::work", lwork),
492 ipiv(
"Hcurl::Tet::In::ipiv", card);
495 for(ordinal_type i=0; i< card; ++i) {
496 for(ordinal_type j=0; j< card; ++j) {
498 for(ordinal_type k=0; k< cardVecPn; ++k)
506 lapack.GETRF(card, card,
507 vmat.data(), vmat.stride(1),
508 (ordinal_type*)ipiv.data(),
511 INTREPID2_TEST_FOR_EXCEPTION( info != 0,
513 ">>> ERROR: (Intrepid2::Basis_HCURL_TET_In_FEM) lapack.GETRF returns nonzero info." );
516 vmat.data(), vmat.stride(1),
517 (ordinal_type*)ipiv.data(),
521 INTREPID2_TEST_FOR_EXCEPTION( info != 0,
523 ">>> ERROR: (Intrepid2::Basis_HCURL_TET_In_FEM) lapack.GETRI returns nonzero info." );
525 for (ordinal_type i=0;i<cardVecPn;++i) {
526 for (ordinal_type j=0;j<card;++j){
528 for(ordinal_type k=0; k< card; ++k)
529 s += U(i,k)*vmat(k,j);
534 this->coeffs_ = Kokkos::create_mirror_view(
typename DT::memory_space(), coeffs);
535 Kokkos::deep_copy(this->coeffs_ , coeffs);
537 this->dofCoords_ = Kokkos::create_mirror_view(
typename DT::memory_space(), dofCoords);
538 Kokkos::deep_copy(this->dofCoords_, dofCoords);
540 this->dofCoeffs_ = Kokkos::create_mirror_view(
typename DT::memory_space(), dofCoeffs);
541 Kokkos::deep_copy(this->dofCoeffs_, dofCoeffs);
547 const ordinal_type posScDim = 0;
548 const ordinal_type posScOrd = 1;
549 const ordinal_type posDfOrd = 2;
555 this->setOrdinalTagData(this->tagToOrdinal_,
558 this->basisCardinality_,