diff --git a/packages/panzer/adapters-stk/example/CurlLaplacianExample/Example_CurlSolution_impl.hpp b/packages/panzer/adapters-stk/example/CurlLaplacianExample/Example_CurlSolution_impl.hpp index 6bbea230436d..170528cacdd5 100644 --- a/packages/panzer/adapters-stk/example/CurlLaplacianExample/Example_CurlSolution_impl.hpp +++ b/packages/panzer/adapters-stk/example/CurlLaplacianExample/Example_CurlSolution_impl.hpp @@ -88,18 +88,22 @@ template void CurlSolution::evaluateFields(typename Traits::EvalData workset) { using panzer::index_t; - for (index_t cell = 0; cell < workset.num_cells; ++cell) { - for (int point = 0; point < solution.extent_int(1); ++point) { + auto ip_coordinates = this->wda(workset).int_rules[ir_index]->ip_coordinates.get_static_view(); + auto solution_v = solution.get_static_view(); + auto solution_curl_v = solution_curl.get_static_view(); - const double & x = this->wda(workset).int_rules[ir_index]->ip_coordinates(cell,point,0); - const double & y = this->wda(workset).int_rules[ir_index]->ip_coordinates(cell,point,1); + Kokkos::parallel_for (workset.num_cells, KOKKOS_LAMBDA (const index_t cell) { + for (int point = 0; point < solution_v.extent_int(1); ++point) { - solution(cell,point,0) = -(y-1.0)*y + cos(2.0*M_PI*x)*sin(2.0*M_PI*y); - solution(cell,point,1) = -(x-1.0)*x + sin(2.0*M_PI*x)*cos(2.0*M_PI*y); + const double & x = ip_coordinates(cell,point,0); + const double & y = ip_coordinates(cell,point,1); - solution_curl(cell,point) = -2.0*x+2.0*y; + solution_v(cell,point,0) = -(y-1.0)*y + cos(2.0*M_PI*x)*sin(2.0*M_PI*y); + solution_v(cell,point,1) = -(x-1.0)*x + sin(2.0*M_PI*x)*cos(2.0*M_PI*y); + + solution_curl_v(cell,point) = -2.0*x+2.0*y; } - } + }); } //********************************************************************** diff --git a/packages/panzer/adapters-stk/example/MixedCurlLaplacianExample/Example_CurlSolution_impl.hpp b/packages/panzer/adapters-stk/example/MixedCurlLaplacianExample/Example_CurlSolution_impl.hpp index 6bbea230436d..170528cacdd5 100644 --- a/packages/panzer/adapters-stk/example/MixedCurlLaplacianExample/Example_CurlSolution_impl.hpp +++ b/packages/panzer/adapters-stk/example/MixedCurlLaplacianExample/Example_CurlSolution_impl.hpp @@ -88,18 +88,22 @@ template void CurlSolution::evaluateFields(typename Traits::EvalData workset) { using panzer::index_t; - for (index_t cell = 0; cell < workset.num_cells; ++cell) { - for (int point = 0; point < solution.extent_int(1); ++point) { + auto ip_coordinates = this->wda(workset).int_rules[ir_index]->ip_coordinates.get_static_view(); + auto solution_v = solution.get_static_view(); + auto solution_curl_v = solution_curl.get_static_view(); - const double & x = this->wda(workset).int_rules[ir_index]->ip_coordinates(cell,point,0); - const double & y = this->wda(workset).int_rules[ir_index]->ip_coordinates(cell,point,1); + Kokkos::parallel_for (workset.num_cells, KOKKOS_LAMBDA (const index_t cell) { + for (int point = 0; point < solution_v.extent_int(1); ++point) { - solution(cell,point,0) = -(y-1.0)*y + cos(2.0*M_PI*x)*sin(2.0*M_PI*y); - solution(cell,point,1) = -(x-1.0)*x + sin(2.0*M_PI*x)*cos(2.0*M_PI*y); + const double & x = ip_coordinates(cell,point,0); + const double & y = ip_coordinates(cell,point,1); - solution_curl(cell,point) = -2.0*x+2.0*y; + solution_v(cell,point,0) = -(y-1.0)*y + cos(2.0*M_PI*x)*sin(2.0*M_PI*y); + solution_v(cell,point,1) = -(x-1.0)*x + sin(2.0*M_PI*x)*cos(2.0*M_PI*y); + + solution_curl_v(cell,point) = -2.0*x+2.0*y; } - } + }); } //********************************************************************** diff --git a/packages/panzer/disc-fe/src/evaluators/Panzer_Dirichlet_Residual_EdgeBasis.cpp b/packages/panzer/disc-fe/src/evaluators/Panzer_Dirichlet_Residual_EdgeBasis.cpp index be8ce12a4fb0..c0d66e884c16 100644 --- a/packages/panzer/disc-fe/src/evaluators/Panzer_Dirichlet_Residual_EdgeBasis.cpp +++ b/packages/panzer/disc-fe/src/evaluators/Panzer_Dirichlet_Residual_EdgeBasis.cpp @@ -40,6 +40,8 @@ // *********************************************************************** // @HEADER +#include "Kokkos_View_Fad.hpp" + #include "PanzerDiscFE_config.hpp" #include "Panzer_ExplicitTemplateInstantiation.hpp" diff --git a/packages/panzer/disc-fe/src/evaluators/Panzer_Dirichlet_Residual_EdgeBasis.hpp b/packages/panzer/disc-fe/src/evaluators/Panzer_Dirichlet_Residual_EdgeBasis.hpp index 546be53a038b..1933f4023661 100644 --- a/packages/panzer/disc-fe/src/evaluators/Panzer_Dirichlet_Residual_EdgeBasis.hpp +++ b/packages/panzer/disc-fe/src/evaluators/Panzer_Dirichlet_Residual_EdgeBasis.hpp @@ -98,8 +98,8 @@ class DirichletResidual_EdgeBasis PointValues2 pointValues; Teuchos::RCP > orientations; - Intrepid2::RefSubcellParametrization::ConstViewType edgeParam; //edge parametrization - Intrepid2::RefSubcellParametrization::ConstViewType faceParam; //face parametrization + Intrepid2::RefSubcellParametrization::ConstViewType edgeParam; //edge parametrization + Intrepid2::RefSubcellParametrization::ConstViewType faceParam; //face parametrization }; // end of class DirichletResidual_EdgeBasis diff --git a/packages/panzer/disc-fe/src/evaluators/Panzer_Dirichlet_Residual_EdgeBasis_impl.hpp b/packages/panzer/disc-fe/src/evaluators/Panzer_Dirichlet_Residual_EdgeBasis_impl.hpp index a43bc534ce3e..d08826f0aea3 100644 --- a/packages/panzer/disc-fe/src/evaluators/Panzer_Dirichlet_Residual_EdgeBasis_impl.hpp +++ b/packages/panzer/disc-fe/src/evaluators/Panzer_Dirichlet_Residual_EdgeBasis_impl.hpp @@ -122,10 +122,10 @@ postRegistrationSetup( const int edgeDim = 1; const int faceDim = 2; if(cellTopo.getDimension() > edgeDim) - edgeParam = Intrepid2::RefSubcellParametrization::get(edgeDim, cellTopo.getKey()); + edgeParam = Intrepid2::RefSubcellParametrization::get(edgeDim, cellTopo.getKey()); if(cellTopo.getDimension() > faceDim) - faceParam = Intrepid2::RefSubcellParametrization::get(faceDim, cellTopo.getKey()); + faceParam = Intrepid2::RefSubcellParametrization::get(faceDim, cellTopo.getKey()); } //********************************************************************** @@ -157,9 +157,14 @@ evaluateFields( const WorksetDetails & details = workset; //const bool is_normalize = true; - auto work = Kokkos::createDynRankView(residual.get_static_view(),"work", 4, cellDim); + auto work = Kokkos::create_mirror_view(Kokkos::createDynRankView(residual.get_static_view(),"work", 4, cellDim)); // compute residual + auto residual_h = Kokkos::create_mirror_view(residual.get_static_view()); + auto dof_h = Kokkos::create_mirror_view(dof.get_static_view()); + auto value_h = Kokkos::create_mirror_view(value.get_static_view()); + Kokkos::deep_copy(dof_h, dof.get_static_view()); + Kokkos::deep_copy(value_h, value.get_static_view()); switch (subcellDim) { case 1: { // 2D element Tri and Quad if (intrepid_basis->getDofCount(1, subcellOrd)) { @@ -169,6 +174,7 @@ evaluateFields( const int ndofsEdge = intrepid_basis->getDofCount(1, subcellOrd); const int numEdges = cellTopo.getEdgeCount(); /* */ int edgeOrts[4] = {}; + for(index_t c=0;cat(details.cell_local_ids[c]).getEdgeOrientation(edgeOrts, numEdges); @@ -180,11 +186,11 @@ evaluateFields( for (int i=0;igetDofOrdinal(1, subcellOrd, i); - auto J = Kokkos::subview(worksetJacobians, c, b, Kokkos::ALL(), Kokkos::ALL()); + auto J = Kokkos::create_mirror_view(Kokkos::subview(worksetJacobians, c, b, Kokkos::ALL(), Kokkos::ALL())); Intrepid2::Kernels::Serial::matvec_product(phyEdgeTan, J, ortEdgeTan); for(int d=0;d