190 const EPointType pointType ) {
192 constexpr ordinal_type spaceDim = 2;
193 this->basisCardinality_ = CardinalityHCurlTri(order);
194 this->basisDegree_ = order;
195 this->basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Triangle<3> >() );
196 this->basisType_ = BASIS_FEM_LAGRANGIAN;
197 this->basisCoordinates_ = COORDINATES_CARTESIAN;
198 this->functionSpace_ = FUNCTION_SPACE_HCURL;
199 pointType_ = (pointType == POINTTYPE_DEFAULT) ? POINTTYPE_EQUISPACED : 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;
211 INTREPID2_TEST_FOR_EXCEPTION( order >
Parameters::MaxOrder, std::invalid_argument,
"polynomial order exceeds the max supported by this class");
214 constexpr ordinal_type tagSize = 4;
216 ordinal_type tags[maxCard][tagSize];
219 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
220 dofCoords(
"Hcurl::Tri::In::dofCoords", card, spaceDim);
222 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
223 coeffs(
"Hcurl::Tri::In::coeffs", cardVecPn, card);
225 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
226 dofCoeffs(
"Hcurl::Tri::In::dofCoeffs", card, spaceDim);
232 const ordinal_type lwork = card*card;
233 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
234 V1(
"Hcurl::Tri::In::V1", cardVecPn, card);
245 for (ordinal_type i=0;i<cardPnm1;i++)
246 for (ordinal_type d=0;d<spaceDim;d++)
247 V1(d*cardPn+i,d*cardPnm1+i) = 1.0;
253 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> cubPoints(
"Hcurl::Tri::In::cubPoints", myCub.
getNumPoints() , spaceDim );
254 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> cubWeights(
"Hcurl::Tri::In::cubWeights", myCub.
getNumPoints() );
258 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> phisAtCubPoints(
"Hcurl::Tri::In::phisAtCubPoints", cardPn , myCub.
getNumPoints() );
259 Impl::Basis_HGRAD_TRI_Cn_FEM_ORTH::getValues<Kokkos::HostSpace::execution_space,Parameters::MaxNumPtsPerBasisEval>(phisAtCubPoints, cubPoints, order, OPERATOR_VALUE);
262 for (ordinal_type i=0;i<order;i++) {
263 for (ordinal_type j=0;j<cardPn;j++) {
265 V1(j,cardVecPnm1+i) -=
266 cubWeights(k) * cubPoints(k,1)
267 * phisAtCubPoints(cardPnm2+i,k)
268 * phisAtCubPoints(j,k);
269 V1(j+cardPn,cardVecPnm1+i) +=
270 cubWeights(k) * cubPoints(k,0)
271 * phisAtCubPoints(cardPnm2+i,k)
272 * phisAtCubPoints(j,k);
278 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
279 V2(
"Hcurl::Tri::In::V2", card ,cardVecPn);
281 const ordinal_type numEdges = this->basisCellTopology_.getEdgeCount();
283 shards::CellTopology edgeTop(shards::getCellTopologyData<shards::Line<2> >() );
291 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> linePts(
"Hcurl::Tri::In::linePts", numPtsPerEdge , 1 );
294 const ordinal_type offset = 1;
301 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> edgePts(
"Hcurl::Tri::In::edgePts", numPtsPerEdge , spaceDim );
302 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> phisAtEdgePoints(
"Hcurl::Tri::In::phisAtEdgePoints", cardPn , numPtsPerEdge );
303 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> edgeTan(
"Hcurl::Tri::In::edgeTan", spaceDim );
306 for (ordinal_type edge=0;edge<numEdges;edge++) {
309 this->basisCellTopology_ );
315 this->basisCellTopology_ );
317 Impl::Basis_HGRAD_TRI_Cn_FEM_ORTH::getValues<Kokkos::HostSpace::execution_space,Parameters::MaxNumPtsPerBasisEval>(phisAtEdgePoints , edgePts, order, OPERATOR_VALUE);
320 for (ordinal_type j=0;j<numPtsPerEdge;j++) {
322 const ordinal_type i_card = numPtsPerEdge*edge+j;
325 for (ordinal_type k=0;k<cardPn;k++) {
326 V2(i_card,k) = edgeTan(0) * phisAtEdgePoints(k,j);
327 V2(i_card,k+cardPn) = edgeTan(1) * phisAtEdgePoints(k,j);
332 for(ordinal_type k=0; k<spaceDim; ++k) {
333 dofCoords(i_card,k) = edgePts(j,k);
334 dofCoeffs(i_card,k) = edgeTan(k);
338 tags[i_card][1] = edge;
340 tags[i_card][3] = numPtsPerEdge;
356 if (numPtsPerCell > 0) {
357 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
358 internalPoints(
"Hcurl::Tri::In::internalPoints", numPtsPerCell , spaceDim );
360 this->basisCellTopology_ ,
365 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
366 phisAtInternalPoints(
"Hcurl::Tri::In::phisAtInternalPoints", cardPn , numPtsPerCell );
367 Impl::Basis_HGRAD_TRI_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 = numEdges*order+spaceDim*j;
374 for (ordinal_type k=0;k<cardPn;k++) {
376 V2(i_card,k) = phisAtInternalPoints(k,j);
378 V2(i_card+1,cardPn+k) = phisAtInternalPoints(k,j);
382 for(ordinal_type d=0; d<spaceDim; ++d) {
383 for(ordinal_type dim=0; dim<spaceDim; ++dim) {
384 dofCoords(i_card+d,dim) = internalPoints(j,dim);
385 dofCoeffs(i_card+d,dim) = (d==dim);
388 tags[i_card+d][0] = spaceDim;
389 tags[i_card+d][1] = 0;
390 tags[i_card+d][2] = spaceDim*j+d;
391 tags[i_card+d][3] = spaceDim*numPtsPerCell;
398 Kokkos::DynRankView<scalarType,Kokkos::LayoutLeft,Kokkos::HostSpace>
399 vmat(
"Hcurl::Tri::In::vmat", card, card),
400 work(
"Hcurl::Tri::In::work", lwork),
401 ipiv(
"Hcurl::Tri::In::ipiv", card);
404 for(ordinal_type i=0; i< card; ++i) {
405 for(ordinal_type j=0; j< card; ++j) {
407 for(ordinal_type k=0; k< cardVecPn; ++k)
408 s += V2(i,k)*V1(k,j);
413 ordinal_type info = 0;
414 Teuchos::LAPACK<ordinal_type,scalarType> lapack;
416 lapack.GETRF(card, card,
417 vmat.data(), vmat.stride_1(),
418 (ordinal_type*)ipiv.data(),
421 INTREPID2_TEST_FOR_EXCEPTION( info != 0,
423 ">>> ERROR: (Intrepid2::Basis_HCURL_TRI_In_FEM) lapack.GETRF returns nonzero info." );
426 vmat.data(), vmat.stride_1(),
427 (ordinal_type*)ipiv.data(),
431 INTREPID2_TEST_FOR_EXCEPTION( info != 0,
433 ">>> ERROR: (Intrepid2::Basis_HCURL_TRI_In_FEM) lapack.GETRI returns nonzero info." );
435 for (ordinal_type i=0;i<cardVecPn;++i)
436 for (ordinal_type j=0;j<card;++j){
438 for(ordinal_type k=0; k< card; ++k)
439 s += V1(i,k)*vmat(k,j);
443 this->coeffs_ = Kokkos::create_mirror_view(
typename DT::memory_space(), coeffs);
444 Kokkos::deep_copy(this->coeffs_ , coeffs);
446 this->dofCoords_ = Kokkos::create_mirror_view(
typename DT::memory_space(), dofCoords);
447 Kokkos::deep_copy(this->dofCoords_, dofCoords);
449 this->dofCoeffs_ = Kokkos::create_mirror_view(
typename DT::memory_space(), dofCoeffs);
450 Kokkos::deep_copy(this->dofCoeffs_, dofCoeffs);
456 const ordinal_type posScDim = 0;
457 const ordinal_type posScOrd = 1;
458 const ordinal_type posDfOrd = 2;
460 OrdinalTypeArray1DHost tagView(&tags[0][0], card*tagSize);
464 this->setOrdinalTagData(this->tagToOrdinal_,
467 this->basisCardinality_,