175 const subcellBasisHostType& subcellBasis,
176 const cellBasisHostType& cellBasis,
177 const ordinal_type subcellId,
178 const ordinal_type subcellOrt) {
180#ifdef HAVE_INTREPID2_DEBUG
181 Debug::check_getCoeffMatrix_HDIV(subcellBasis,cellBasis,subcellId,subcellOrt);
184 using value_type =
typename OutputViewType::non_const_value_type;
185 using host_device_type = Kokkos::HostSpace::device_type;
190 const shards::CellTopology cellTopo = cellBasis.getBaseCellTopology();
191 const shards::CellTopology subcellTopo = subcellBasis.getBaseCellTopology();
192 const ordinal_type cellDim = cellTopo.getDimension();
193 const ordinal_type subcellDim = subcellTopo.getDimension();
194 const auto subcellBaseKey = subcellTopo.getBaseKey();
195 const ordinal_type numCellBasis = cellBasis.getCardinality();
196 const ordinal_type numSubcellBasis = subcellBasis.getCardinality();
197 const ordinal_type ndofSubcell = cellBasis.getDofCount(subcellDim,subcellId);
204 auto latticeDegree = (subcellBaseKey == shards::Triangle<>::key) ?
205 cellBasis.getDegree()+2 : cellBasis.getDegree()+1;
208 Kokkos::DynRankView<value_type,host_device_type> refPtsSubcell(
"refPtsSubcell", ndofSubcell, subcellDim);
210 INTREPID2_TEST_FOR_EXCEPTION( latticeSize != ndofSubcell,
212 ">>> ERROR (Intrepid::OrientationTools::getCoeffMatrix_HDIV): " \
213 "Lattice size should be equal to the onber of subcell internal DoFs");
220 Kokkos::DynRankView<value_type,host_device_type> refPtsCell(
"refPtsCell", ndofSubcell, cellDim);
225 Kokkos::DynRankView<value_type,host_device_type> tangentsAndNormal(
"trJacobianF", cellDim, cellDim );
227 auto sideNormal = Kokkos::subview(tangentsAndNormal, cellDim-1, Kokkos::ALL());
235 Kokkos::DynRankView<value_type,host_device_type> cellBasisValues(
"cellBasisValues", numCellBasis, ndofSubcell, cellDim);
236 cellBasis.getValues(cellBasisValues, refPtsCell, OPERATOR_VALUE);
239 Kokkos::DynRankView<value_type,host_device_type> subCellValues(
"subCellValues", numSubcellBasis, ndofSubcell);
240 subcellBasis.getValues(subCellValues, refPtsSubcell, OPERATOR_VALUE);
249 Kokkos::DynRankView<value_type,Kokkos::LayoutLeft,host_device_type>
250 PsiMat(
"PsiMat", ndofSubcell, ndofSubcell),
251 PhiMat(
"PhiMat", ndofSubcell, ndofSubcell);
253 auto cellTagToOrdinal = cellBasis.getAllDofOrdinal();
254 auto subcellTagToOrdinal = subcellBasis.getAllDofOrdinal();
256 for (ordinal_type i=0;i<ndofSubcell;++i) {
257 const ordinal_type ic = cellTagToOrdinal(subcellDim, subcellId, i);
258 const ordinal_type isc = subcellTagToOrdinal(subcellDim, 0, i);
259 for (ordinal_type j=0;j<ndofSubcell;++j) {
261 for (ordinal_type k=0;k<cellDim;++k)
266 auto RefMat = PsiMat;
267 auto OrtMat = PhiMat;
271 Teuchos::LAPACK<ordinal_type,value_type> lapack;
272 ordinal_type info = 0;
273 Kokkos::DynRankView<ordinal_type,host_device_type> pivVec(
"pivVec", ndofSubcell);
275 lapack.GESV(ndofSubcell, ndofSubcell,
284 std::stringstream ss;
285 ss <<
">>> ERROR (Intrepid::OrientationTools::getCoeffMatrix_HDIV): "
286 <<
"LAPACK return with error code: "
288 INTREPID2_TEST_FOR_EXCEPTION(
true, std::runtime_error, ss.str().c_str() );
294 const double eps = tolerence();
295 for (ordinal_type i=0;i<ndofSubcell;++i) {
296 auto intmatii = std::round(PhiMat(i,i));
297 PhiMat(i,i) = (std::abs(PhiMat(i,i) - intmatii) < eps) ? intmatii : PhiMat(i,i);
298 for (ordinal_type j=i+1;j<ndofSubcell;++j) {
299 auto matij = PhiMat(i,j);
301 auto intmatji = std::round(PhiMat(j,i));
302 PhiMat(i,j) = (std::abs(PhiMat(j,i) - intmatji) < eps) ? intmatji : PhiMat(j,i);
304 auto intmatij = std::round(matij);
305 PhiMat(j,i) = (std::abs(matij - intmatij) < eps) ? intmatij : matij;
327 const Kokkos::pair<ordinal_type,ordinal_type> range(0, ndofSubcell);
328 auto suboutput = Kokkos::subview(output, range, range);
329 auto tmp = Kokkos::create_mirror_view_and_copy(
typename OutputViewType::device_type::memory_space(), PhiMat);
330 Kokkos::deep_copy(suboutput, tmp);