48 #ifndef __INTREPID2_HVOL_TRI_CN_FEM_DEF_HPP__
49 #define __INTREPID2_HVOL_TRI_CN_FEM_DEF_HPP__
58 template<EOperator opType>
59 template<
typename outputViewType,
60 typename inputViewType,
61 typename workViewType,
62 typename vinvViewType>
63 KOKKOS_INLINE_FUNCTION
65 Basis_HVOL_TRI_Cn_FEM::Serial<opType>::
66 getValues( outputViewType output,
67 const inputViewType input,
69 const vinvViewType vinv ) {
71 constexpr ordinal_type spaceDim = 2;
73 card = vinv.extent(0),
74 npts = input.extent(0);
77 ordinal_type order = 0;
79 if (card == Intrepid2::getPnCardinality<spaceDim>(p) ) {
85 typedef typename Kokkos::DynRankView<typename workViewType::value_type, typename workViewType::memory_space> viewType;
86 auto vcprop = Kokkos::common_view_alloc_prop(work);
87 auto ptr = work.data();
90 case OPERATOR_VALUE: {
91 const viewType phis(Kokkos::view_wrap(ptr, vcprop), card, npts);
92 workViewType dummyView;
94 Impl::Basis_HGRAD_TRI_Cn_FEM_ORTH::
95 Serial<opType>::getValues(phis, input, dummyView, order);
97 for (ordinal_type i=0;i<card;++i)
98 for (ordinal_type j=0;j<npts;++j) {
99 output.access(i,j) = 0.0;
100 for (ordinal_type k=0;k<card;++k)
101 output.access(i,j) += vinv(k,i)*phis.access(k,j);
107 const viewType phis(Kokkos::view_wrap(ptr, vcprop), card, npts, spaceDim);
108 ptr += card*npts*spaceDim*get_dimension_scalar(work);
109 const viewType workView(Kokkos::view_wrap(ptr, vcprop), card, npts, spaceDim+1);
110 Impl::Basis_HGRAD_TRI_Cn_FEM_ORTH::
111 Serial<opType>::getValues(phis, input, workView, order);
113 for (ordinal_type i=0;i<card;++i)
114 for (ordinal_type j=0;j<npts;++j)
115 for (ordinal_type k=0;k<spaceDim;++k) {
116 output.access(i,j,k) = 0.0;
117 for (ordinal_type l=0;l<card;++l)
118 output.access(i,j,k) += vinv(l,i)*phis.access(l,j,k);
131 const ordinal_type dkcard = getDkCardinality<opType,spaceDim>();
132 const viewType phis(Kokkos::view_wrap(ptr, vcprop), card, npts, dkcard);
133 workViewType dummyView;
135 Impl::Basis_HGRAD_TRI_Cn_FEM_ORTH::
136 Serial<opType>::getValues(phis, input, dummyView, order);
138 for (ordinal_type i=0;i<card;++i)
139 for (ordinal_type j=0;j<npts;++j)
140 for (ordinal_type k=0;k<dkcard;++k) {
141 output.access(i,j,k) = 0.0;
142 for (ordinal_type l=0;l<card;++l)
143 output.access(i,j,k) += vinv(l,i)*phis.access(l,j,k);
148 INTREPID2_TEST_FOR_ABORT(
true,
149 ">>> ERROR (Basis_HVOL_TRI_Cn_FEM): Operator type not implemented");
154 template<
typename SpT, ordinal_type numPtsPerEval,
155 typename outputValueValueType,
class ...outputValueProperties,
156 typename inputPointValueType,
class ...inputPointProperties,
157 typename vinvValueType,
class ...vinvProperties>
159 Basis_HVOL_TRI_Cn_FEM::
160 getValues( Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
161 const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
162 const Kokkos::DynRankView<vinvValueType, vinvProperties...> vinv,
163 const EOperator operatorType) {
164 typedef Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValueViewType;
165 typedef Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPointViewType;
166 typedef Kokkos::DynRankView<vinvValueType, vinvProperties...> vinvViewType;
167 typedef typename ExecSpace<typename inputPointViewType::execution_space,SpT>::ExecSpaceType ExecSpaceType;
170 const auto loopSizeTmp1 = (inputPoints.extent(0)/numPtsPerEval);
171 const auto loopSizeTmp2 = (inputPoints.extent(0)%numPtsPerEval != 0);
172 const auto loopSize = loopSizeTmp1 + loopSizeTmp2;
173 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
175 typedef typename inputPointViewType::value_type inputPointType;
177 const ordinal_type cardinality = outputValues.extent(0);
178 const ordinal_type spaceDim = 2;
180 auto vcprop = Kokkos::common_view_alloc_prop(inputPoints);
181 typedef typename Kokkos::DynRankView< inputPointType, typename inputPointViewType::memory_space> workViewType;
183 switch (operatorType) {
184 case OPERATOR_VALUE: {
185 workViewType work(Kokkos::view_alloc(
"Basis_HVOL_TRI_Cn_FEM::getValues::work", vcprop), cardinality, inputPoints.extent(0));
186 typedef Functor<outputValueViewType,inputPointViewType,vinvViewType, workViewType,
187 OPERATOR_VALUE,numPtsPerEval> FunctorType;
188 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints, vinv, work) );
193 workViewType work(Kokkos::view_alloc(
"Basis_HVOL_TRI_Cn_FEM::getValues::work", vcprop), cardinality*(2*spaceDim+1), inputPoints.extent(0));
194 typedef Functor<outputValueViewType,inputPointViewType,vinvViewType, workViewType,
195 OPERATOR_D1,numPtsPerEval> FunctorType;
196 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints, vinv, work) );
200 typedef Functor<outputValueViewType,inputPointViewType,vinvViewType, workViewType,
201 OPERATOR_D2,numPtsPerEval> FunctorType;
202 workViewType work(Kokkos::view_alloc(
"Basis_HVOL_TRI_Cn_FEM::getValues::work", vcprop), cardinality*outputValues.extent(2), inputPoints.extent(0));
203 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints, vinv, work) );
214 INTREPID2_TEST_FOR_EXCEPTION(
true , std::invalid_argument,
215 ">>> ERROR (Basis_HVOL_TRI_Cn_FEM): Operator type not implemented" );
222 template<
typename SpT,
typename OT,
typename PT>
225 const EPointType pointType ) {
227 constexpr ordinal_type spaceDim = 2;
229 this->basisCardinality_ = Intrepid2::getPnCardinality<spaceDim>(order);
230 this->basisDegree_ = order;
231 this->basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Triangle<3> >() );
232 this->basisType_ = BASIS_FEM_FIAT;
233 this->basisCoordinates_ = COORDINATES_CARTESIAN;
235 const ordinal_type card = this->basisCardinality_;
238 Kokkos::DynRankView<scalarType,typename SpT::array_layout,Kokkos::HostSpace>
239 dofCoords(
"HVOL::Tri::Cn::dofCoords", card, spaceDim);
242 const ordinal_type offset = 1;
244 this->basisCellTopology_,
245 order+spaceDim+offset, offset,
248 this->dofCoords_ = Kokkos::create_mirror_view(
typename SpT::memory_space(), dofCoords);
249 Kokkos::deep_copy(this->dofCoords_, dofCoords);
253 const ordinal_type lwork = card*card;
254 Kokkos::DynRankView<scalarType,Kokkos::LayoutLeft,Kokkos::HostSpace>
255 vmat(
"HVOL::Tri::Cn::vmat", card, card),
256 work(
"HVOL::Tri::Cn::work", lwork),
257 ipiv(
"HVOL::Tri::Cn::ipiv", card);
259 Impl::Basis_HGRAD_TRI_Cn_FEM_ORTH::getValues<Kokkos::HostSpace::execution_space,Parameters::MaxNumPtsPerBasisEval>(vmat, dofCoords, order, OPERATOR_VALUE);
261 ordinal_type info = 0;
262 Teuchos::LAPACK<ordinal_type,scalarType> lapack;
264 lapack.GETRF(card, card,
265 vmat.data(), vmat.stride_1(),
266 (ordinal_type*)ipiv.data(),
269 INTREPID2_TEST_FOR_EXCEPTION( info != 0,
271 ">>> ERROR: (Intrepid2::Basis_HVOL_TRI_Cn_FEM) lapack.GETRF returns nonzero info." );
274 vmat.data(), vmat.stride_1(),
275 (ordinal_type*)ipiv.data(),
279 INTREPID2_TEST_FOR_EXCEPTION( info != 0,
281 ">>> ERROR: (Intrepid2::Basis_HVOL_TRI_Cn_FEM) lapack.GETRI returns nonzero info." );
284 Kokkos::DynRankView<scalarType,typename SpT::array_layout,Kokkos::HostSpace>
285 vinv(
"HVOL::Line::Cn::vinv", card, card);
287 for (ordinal_type i=0;i<card;++i)
288 for (ordinal_type j=0;j<card;++j)
289 vinv(i,j) = vmat(j,i);
291 this->vinv_ = Kokkos::create_mirror_view(
typename SpT::memory_space(), vinv);
292 Kokkos::deep_copy(this->vinv_ , vinv);
297 constexpr ordinal_type tagSize = 4;
298 const ordinal_type posScDim = 0;
299 const ordinal_type posScOrd = 1;
300 const ordinal_type posDfOrd = 2;
302 constexpr ordinal_type maxCard = Intrepid2::getPnCardinality<spaceDim, Parameters::MaxOrder>();
303 ordinal_type tags[maxCard][tagSize];
306 numElemDof = this->basisCardinality_;
308 ordinal_type elemId = 0;
309 for (ordinal_type i=0;i<this->basisCardinality_;++i) {
311 tags[i][0] = spaceDim;
313 tags[i][2] = elemId++;
314 tags[i][3] = numElemDof;
321 this->setOrdinalTagData(this->tagToOrdinal_,
324 this->basisCardinality_,
Header file for the Intrepid2::Basis_HGRAD_TRI_Cn_FEM_ORTH class.
Kokkos::View< ordinal_type *,typename ExecSpaceType::array_layout, Kokkos::HostSpace > ordinal_type_array_1d_host
View type for 1d host array.
static constexpr ordinal_type MaxOrder
The maximum reconstruction order.
Basis_HVOL_TRI_Cn_FEM(const ordinal_type order, const EPointType pointType=POINTTYPE_EQUISPACED)
Constructor.