@@ -1075,11 +1075,16 @@ void polympo_getMeshElmMass_f(MPMesh_ptr p_mpmesh, const int nCells, double* elm
10751075 pumipic::RecordTime (" PolyMPO_getMeshElmMass" , timer.seconds ());
10761076}
10771077
1078+ // Increments in vertex velcoity and displacement
10781079void polympo_setMeshVtxOnSurfVeloIncr_f (MPMesh_ptr p_mpmesh, const int nComps, const int nVertices, const double * array) {
1080+
1081+ Kokkos::Timer timer;
10791082 // check mpMesh is valid
10801083 checkMPMeshValid (p_mpmesh);
10811084 auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh ;
1082- kkViewHostU<const double *[vec2d_nEntries]> arrayHost (array,nVertices);
1085+ kkViewHostU<const double **> arrayHost (array,nComps,nVertices);
1086+ Kokkos::View<double **> array_d (" meshVelIncrDevice" ,nComps,nVertices);
1087+ Kokkos::deep_copy (array_d, arrayHost);
10831088
10841089 auto vtxField = p_mesh->getMeshField <polyMPO::MeshF_OnSurfVeloIncr>();
10851090
@@ -1088,24 +1093,11 @@ void polympo_setMeshVtxOnSurfVeloIncr_f(MPMesh_ptr p_mpmesh, const int nComps, c
10881093 PMT_ALWAYS_ASSERT (static_cast <size_t >(nVertices*vec2d_nEntries)==vtxField.size ());
10891094
10901095 // copy the host array to the device
1091- Kokkos::deep_copy (vtxField,arrayHost);
1092- }
1093-
1094- void polympo_getMeshVtxOnSurfVeloIncr_f (MPMesh_ptr p_mpmesh, const int nComps, const int nVertices, double * array) {
1095- // check mpMesh is valid
1096- checkMPMeshValid (p_mpmesh);
1097- auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh ;
1098- kkVec2dViewHostU arrayHost (array,nVertices);
1099-
1100- auto vtxField = p_mesh->getMeshField <polyMPO::MeshF_OnSurfVeloIncr>();
1101-
1102- // check the size
1103- PMT_ALWAYS_ASSERT (nComps == vec2d_nEntries);
1104- PMT_ALWAYS_ASSERT (p_mesh->getNumVertices () == nVertices);
1105- PMT_ALWAYS_ASSERT (static_cast <size_t >(nVertices*vec2d_nEntries)==vtxField.size ());
1106-
1107- // copy the device array to the host
1108- Kokkos::deep_copy (arrayHost, vtxField);
1096+ Kokkos::parallel_for (" set mesh dispIncr" , nVertices, KOKKOS_LAMBDA (const int iVtx){
1097+ vtxField (iVtx,0 ) = array_d (0 ,iVtx);
1098+ vtxField (iVtx,1 ) = array_d (1 ,iVtx);
1099+ });
1100+ pumipic::RecordTime (" PolyMPO_setMeshVtxOnSurfVelIncr" , timer.seconds ());
11091101}
11101102
11111103void polympo_setMeshVtxOnSurfDispIncr_f (MPMesh_ptr p_mpmesh, const int nComps, const int nVertices, const double * array) {
@@ -1131,6 +1123,29 @@ void polympo_setMeshVtxOnSurfDispIncr_f(MPMesh_ptr p_mpmesh, const int nComps, c
11311123 pumipic::RecordTime (" PolyMPO_setMeshVtxOnSurfDispIncr" , timer.seconds ());
11321124}
11331125
1126+
1127+ void polympo_getMeshVtxOnSurfVeloIncr_f (MPMesh_ptr p_mpmesh, const int nComps, const int nVertices, double * array) {
1128+ // check mpMesh is valid
1129+ checkMPMeshValid (p_mpmesh);
1130+ auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh ;
1131+ kkDbl2dViewHostU arrayHost (array,nComps,nVertices);
1132+ Kokkos::View<double **> array_d (" meshVelIncrDevice" ,nComps,nVertices);
1133+
1134+ auto vtxField = p_mesh->getMeshField <polyMPO::MeshF_OnSurfVeloIncr>();
1135+
1136+ // check the size
1137+ PMT_ALWAYS_ASSERT (nComps == vec2d_nEntries);
1138+ PMT_ALWAYS_ASSERT (p_mesh->getNumVertices () == nVertices);
1139+ PMT_ALWAYS_ASSERT (static_cast <size_t >(nVertices*vec2d_nEntries)==vtxField.size ());
1140+
1141+ // copy the device array to the host
1142+ Kokkos::parallel_for (" get mesh dispIncr" , nVertices, KOKKOS_LAMBDA (const int iVtx){
1143+ array_d (0 ,iVtx) = vtxField (iVtx,0 );
1144+ array_d (1 ,iVtx) = vtxField (iVtx,1 );
1145+ });
1146+ Kokkos::deep_copy (arrayHost, array_d);
1147+ }
1148+
11341149void polympo_getMeshVtxOnSurfDispIncr_f (MPMesh_ptr p_mpmesh, const int nComps, const int nVertices, double * array) {
11351150 // check mpMesh is valid
11361151 checkMPMeshValid (p_mpmesh);
0 commit comments