189 const EPointType pointType ) {
192 INTREPID2_TEST_FOR_EXCEPTION( order >
Parameters::MaxOrder, std::invalid_argument,
"polynomial order exceeds the max supported by this class");
194 constexpr ordinal_type spaceDim = 2;
195 this->basisCardinality_ = CardinalityHDivTri(order);
196 this->basisDegree_ = order;
197 this->basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Triangle<3> >() );
198 this->basisType_ = BASIS_FEM_LAGRANGIAN;
199 this->basisCoordinates_ = COORDINATES_CARTESIAN;
200 this->functionSpace_ = FUNCTION_SPACE_HDIV;
201 pointType_ = (pointType == POINTTYPE_DEFAULT) ? POINTTYPE_EQUISPACED : pointType;
203 const ordinal_type card = this->basisCardinality_;
205 const ordinal_type cardPn = Intrepid2::getPnCardinality<spaceDim>(order);
206 const ordinal_type cardPnm1 = Intrepid2::getPnCardinality<spaceDim>(order-1);
207 const ordinal_type cardPnm2 = Intrepid2::getPnCardinality<spaceDim>(order-2);
208 const ordinal_type cardVecPn = spaceDim*cardPn;
209 const ordinal_type cardVecPnm1 = spaceDim*cardPnm1;
213 constexpr ordinal_type tagSize = 4;
215 ordinal_type tags[maxCard][tagSize];
218 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
219 dofCoords(
"Hdiv::Tri::In::dofCoords", card, spaceDim);
221 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
222 dofCoeffs(
"Hdiv::Tri::In::dofCoeffs", card, spaceDim);
224 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
225 coeffs(
"Hdiv::Tri::In::coeffs", cardVecPn, card);
231 const ordinal_type lwork = card*card;
232 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
233 V1(
"Hdiv::Tri::In::V1", cardVecPn, card);
243 for (ordinal_type i=0;i<cardPnm1;i++) {
245 V1(cardPn+i,cardPnm1+i) = 1.0;
251 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> cubPoints(
"Hdiv::Tri::In::cubPoints", myCub.
getNumPoints() , spaceDim );
252 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> cubWeights(
"Hdiv::Tri::In::cubWeights", myCub.
getNumPoints() );
256 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> phisAtCubPoints(
"Hdiv::Tri::In::phisAtCubPoints", cardPn , myCub.
getNumPoints() );
257 Impl::Basis_HGRAD_TRI_Cn_FEM_ORTH::getValues<Kokkos::HostSpace::execution_space,Parameters::MaxNumPtsPerBasisEval>(phisAtCubPoints, cubPoints, order, OPERATOR_VALUE);
260 for (ordinal_type i=0;i<order;i++) {
261 for (ordinal_type j=0;j<cardPn;j++) {
262 V1(j,cardVecPnm1+i) = 0.0;
263 for (ordinal_type d=0; d< spaceDim; ++d)
265 V1(j+d*cardPn,cardVecPnm1+i) +=
266 cubWeights(k) * cubPoints(k,d)
267 * phisAtCubPoints(cardPnm2+i,k)
268 * phisAtCubPoints(j,k);
274 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
275 V2(
"Hdiv::Tri::In::V2", card ,cardVecPn);
277 const ordinal_type numEdges = this->basisCellTopology_.getEdgeCount();
279 shards::CellTopology edgeTop(shards::getCellTopologyData<shards::Line<2> >() );
287 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> linePts(
"Hdiv::Tri::In::linePts", numPtsPerEdge , 1 );
290 const ordinal_type offset = 1;
297 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> edgePts(
"Hdiv::Tri::In::edgePts", numPtsPerEdge , spaceDim );
298 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> phisAtEdgePoints(
"Hdiv::Tri::In::phisAtEdgePoints", cardPn , numPtsPerEdge );
299 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace> edgeNormal(
"Hcurl::Tri::In::edgeNormal", spaceDim );
302 for (ordinal_type edge=0;edge<numEdges;edge++) {
305 this->basisCellTopology_ );
311 this->basisCellTopology_ );
313 Impl::Basis_HGRAD_TRI_Cn_FEM_ORTH::getValues<Kokkos::HostSpace::execution_space,Parameters::MaxNumPtsPerBasisEval>(phisAtEdgePoints , edgePts, order, OPERATOR_VALUE);
316 for (ordinal_type j=0;j<numPtsPerEdge;j++) {
318 const ordinal_type i_card = numPtsPerEdge*edge+j;
321 for (ordinal_type k=0;k<cardPn;k++) {
323 for (ordinal_type l=0; l<spaceDim; l++)
324 V2(i_card,k+l*cardPn) = edgeNormal(l) * phisAtEdgePoints(k,j);
329 for(ordinal_type l=0; l<spaceDim; ++l) {
330 dofCoords(i_card,l) = edgePts(j,l);
331 dofCoeffs(i_card,l) = edgeNormal(l);
335 tags[i_card][1] = edge;
337 tags[i_card][3] = numPtsPerEdge;
354 if (numPtsPerCell > 0) {
355 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
356 internalPoints(
"Hdiv::Tri::In::internalPoints", numPtsPerCell , spaceDim );
358 this->basisCellTopology_ ,
363 Kokkos::DynRankView<scalarType,typename DT::execution_space::array_layout,Kokkos::HostSpace>
364 phisAtInternalPoints(
"Hdiv::Tri::In::phisAtInternalPoints", cardPn , numPtsPerCell );
365 Impl::Basis_HGRAD_TRI_Cn_FEM_ORTH::getValues<Kokkos::HostSpace::execution_space,Parameters::MaxNumPtsPerBasisEval>( phisAtInternalPoints , internalPoints , order, OPERATOR_VALUE );
368 for (ordinal_type j=0;j<numPtsPerCell;j++) {
370 const ordinal_type i_card = numEdges*order+spaceDim*j;
372 for (ordinal_type k=0;k<cardPn;k++) {
373 for (ordinal_type l=0;l<spaceDim;l++) {
374 V2(i_card+l,l*cardPn+k) = phisAtInternalPoints(k,j);
379 for(ordinal_type d=0; d<spaceDim; ++d) {
380 for(ordinal_type l=0; l<spaceDim; ++l) {
381 dofCoords(i_card+d,l) = internalPoints(j,l);
382 dofCoeffs(i_card+d,l) = (l==d);
385 tags[i_card+d][0] = spaceDim;
386 tags[i_card+d][1] = 0;
387 tags[i_card+d][2] = spaceDim*j+d;
388 tags[i_card+d][3] = spaceDim*numPtsPerCell;
395 Kokkos::DynRankView<scalarType,Kokkos::LayoutLeft,Kokkos::HostSpace>
396 vmat(
"Hdiv::Tri::In::vmat", card, card),
397 work(
"Hdiv::Tri::In::work", lwork),
398 ipiv(
"Hdiv::Tri::In::ipiv", card);
401 for(ordinal_type i=0; i< card; ++i) {
402 for(ordinal_type j=0; j< card; ++j) {
404 for(ordinal_type k=0; k< cardVecPn; ++k)
405 s += V2(i,k)*V1(k,j);
410 ordinal_type info = 0;
411 Teuchos::LAPACK<ordinal_type,scalarType> lapack;
413 lapack.GETRF(card, card,
414 vmat.data(), vmat.stride_1(),
415 (ordinal_type*)ipiv.data(),
418 INTREPID2_TEST_FOR_EXCEPTION( info != 0,
420 ">>> ERROR: (Intrepid2::Basis_HDIV_TRI_In_FEM) lapack.GETRF returns nonzero info." );
423 vmat.data(), vmat.stride_1(),
424 (ordinal_type*)ipiv.data(),
428 INTREPID2_TEST_FOR_EXCEPTION( info != 0,
430 ">>> ERROR: (Intrepid2::Basis_HDIV_TRI_In_FEM) lapack.GETRI returns nonzero info." );
432 for (ordinal_type i=0;i<cardVecPn;++i)
433 for (ordinal_type j=0;j<card;++j){
435 for(ordinal_type k=0; k< card; ++k)
436 s += V1(i,k)*vmat(k,j);
440 this->coeffs_ = Kokkos::create_mirror_view(
typename DT::memory_space(), coeffs);
441 Kokkos::deep_copy(this->coeffs_ , coeffs);
443 this->dofCoords_ = Kokkos::create_mirror_view(
typename DT::memory_space(), dofCoords);
444 Kokkos::deep_copy(this->dofCoords_, dofCoords);
446 this->dofCoeffs_ = Kokkos::create_mirror_view(
typename DT::memory_space(), dofCoeffs);
447 Kokkos::deep_copy(this->dofCoeffs_, dofCoeffs);
453 const ordinal_type posScDim = 0;
454 const ordinal_type posScOrd = 1;
455 const ordinal_type posDfOrd = 2;
457 OrdinalTypeArray1DHost tagView(&tags[0][0], card*tagSize);
461 this->setOrdinalTagData(this->tagToOrdinal_,
464 this->basisCardinality_,