143 const subcellBasisHostType& subcellBasis,
144 const cellBasisHostType& cellBasis,
145 const ordinal_type subcellId,
146 const ordinal_type subcellOrt,
147 const bool inverse) {
149#ifdef HAVE_INTREPID2_DEBUG
150 Debug::check_getCoeffMatrix_HDIV(subcellBasis,cellBasis,subcellId,subcellOrt);
153 using value_type =
typename OutputViewType::non_const_value_type;
154 using host_device_type = Kokkos::HostSpace::device_type;
159 const shards::CellTopology cellTopo = cellBasis.getBaseCellTopology();
160 const shards::CellTopology subcellTopo = subcellBasis.getBaseCellTopology();
161 const ordinal_type cellDim = cellTopo.getDimension();
162 const ordinal_type subcellDim = subcellTopo.getDimension();
163 const auto subcellBaseKey = subcellTopo.getBaseKey();
164 const ordinal_type numCellBasis = cellBasis.getCardinality();
165 const ordinal_type numSubcellBasis = subcellBasis.getCardinality();
166 const ordinal_type ndofSubcell = cellBasis.getDofCount(subcellDim,subcellId);
173 auto latticeDegree = (subcellBaseKey == shards::Triangle<>::key) ?
174 cellBasis.getDegree()+2 : cellBasis.getDegree()+1;
177 Kokkos::DynRankView<value_type,host_device_type> refPtsSubcell(
"refPtsSubcell", ndofSubcell, subcellDim);
179 INTREPID2_TEST_FOR_EXCEPTION( latticeSize != ndofSubcell,
181 ">>> ERROR (Intrepid::OrientationTools::getCoeffMatrix_HDIV): " \
182 "Lattice size should be equal to the onber of subcell internal DoFs");
189 Kokkos::DynRankView<value_type,host_device_type> refPtsCell(
"refPtsCell", ndofSubcell, cellDim);
194 Kokkos::DynRankView<value_type,host_device_type> tangentsAndNormal(
"trJacobianF", cellDim, cellDim );
196 auto sideNormal = Kokkos::subview(tangentsAndNormal, cellDim-1, Kokkos::ALL());
204 Kokkos::DynRankView<value_type,host_device_type> cellBasisValues(
"cellBasisValues", numCellBasis, ndofSubcell, cellDim);
205 cellBasis.getValues(cellBasisValues, refPtsCell, OPERATOR_VALUE);
208 Kokkos::DynRankView<value_type,host_device_type> subCellValues(
"subCellValues", numSubcellBasis, ndofSubcell);
209 subcellBasis.getValues(subCellValues, refPtsSubcell, OPERATOR_VALUE);
218 Kokkos::DynRankView<value_type,Kokkos::LayoutLeft,host_device_type>
219 PsiMat(
"PsiMat", ndofSubcell, ndofSubcell),
220 PhiMat(
"PhiMat", ndofSubcell, ndofSubcell),
224 auto cellTagToOrdinal = cellBasis.getAllDofOrdinal();
225 auto subcellTagToOrdinal = subcellBasis.getAllDofOrdinal();
227 for (ordinal_type i=0;i<ndofSubcell;++i) {
228 const ordinal_type ic = cellTagToOrdinal(subcellDim, subcellId, i);
229 const ordinal_type isc = subcellTagToOrdinal(subcellDim, 0, i);
230 for (ordinal_type j=0;j<ndofSubcell;++j) {
232 for (ordinal_type k=0;k<cellDim;++k)
237 RefMat = inverse ? PhiMat : PsiMat;
238 OrtMat = inverse ? PsiMat : PhiMat;
242 Teuchos::LAPACK<ordinal_type,value_type> lapack;
243 ordinal_type info = 0;
244 Kokkos::DynRankView<ordinal_type,host_device_type> pivVec(
"pivVec", ndofSubcell);
246 lapack.GESV(ndofSubcell, ndofSubcell,
255 std::stringstream ss;
256 ss <<
">>> ERROR (Intrepid::OrientationTools::getCoeffMatrix_HDIV): "
257 <<
"LAPACK return with error code: "
259 INTREPID2_TEST_FOR_EXCEPTION(
true, std::runtime_error, ss.str().c_str() );
265 const double eps = tolerence();
266 for (ordinal_type i=0;i<ndofSubcell;++i) {
267 auto intmatii = std::round(OrtMat(i,i));
268 OrtMat(i,i) = (std::abs(OrtMat(i,i) - intmatii) < eps) ? intmatii : OrtMat(i,i);
269 for (ordinal_type j=i+1;j<ndofSubcell;++j) {
270 auto matij = OrtMat(i,j);
272 auto intmatji = std::round(OrtMat(j,i));
273 OrtMat(i,j) = (std::abs(OrtMat(j,i) - intmatji) < eps) ? intmatji : OrtMat(j,i);
275 auto intmatij = std::round(matij);
276 OrtMat(j,i) = (std::abs(matij - intmatij) < eps) ? intmatij : matij;
298 const Kokkos::pair<ordinal_type,ordinal_type> range(0, ndofSubcell);
299 auto suboutput = Kokkos::subview(output, range, range);
300 auto tmp = Kokkos::create_mirror_view_and_copy(
typename OutputViewType::device_type::memory_space(), OrtMat);
301 Kokkos::deep_copy(suboutput, tmp);