Skip to content

Commit 14eec4f

Browse files
committed
mesh OnSurfVeloIncr
1 parent 9a52665 commit 14eec4f

File tree

1 file changed

+10
-27
lines changed

1 file changed

+10
-27
lines changed

src/pmpo_c.cpp

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ void getMPData(MPMesh_ptr p_mpmesh,
269269
const int nComps,
270270
const int numMPs,
271271
double* mpDataOut){
272+
Kokkos::Timer timer;
272273
checkMPMeshValid(p_mpmesh);
273274
auto p_MPs = ((polyMPO::MPMesh*)p_mpmesh)->p_MPs;
274275
PMT_ALWAYS_ASSERT(nComps == polyMPO::mpSliceToNumEntries<mpSlice>());
@@ -287,6 +288,7 @@ void getMPData(MPMesh_ptr p_mpmesh,
287288
p_MPs->parallel_for(getData, "getMPData");
288289
kkViewHostU<double**> arrayHost(mpDataOut,nComps,numMPs);
289290
Kokkos::deep_copy(arrayHost, mpDataCopy);
291+
pumipic::RecordTime("PolyMPO_getMPData", timer.seconds());
290292
}
291293

292294
using setMPFunc = void (*)(MPMesh_ptr, const int, const int, const double*);
@@ -596,36 +598,17 @@ void polympo_getMeshElmMass_f(MPMesh_ptr p_mpmesh, const int nCells, double* elm
596598
}
597599

598600
void polympo_setMeshVtxOnSurfVeloIncr_f(MPMesh_ptr p_mpmesh, const int nComps, const int nVertices, const double* array) {
599-
//check mpMesh is valid
600-
checkMPMeshValid(p_mpmesh);
601-
auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh;
602-
kkViewHostU<const double*[vec2d_nEntries]> arrayHost(array,nVertices);
603-
604-
auto vtxField = p_mesh->getMeshField<polyMPO::MeshF_OnSurfVeloIncr>();
605-
606-
//check the size
607-
PMT_ALWAYS_ASSERT(nComps == vec2d_nEntries);
608-
PMT_ALWAYS_ASSERT(static_cast<size_t>(nVertices*vec2d_nEntries)==vtxField.size());
609-
610-
//copy the host array to the device
611-
Kokkos::deep_copy(vtxField,arrayHost);
601+
const double* dataIn[nComps];
602+
for(int j=0; j<nComps; j++)
603+
dataIn[j] = &array[j * nVertices];
604+
setMeshData<polyMPO::MeshF_OnSurfVeloIncr>(p_mpmesh, nComps, nVertices, dataIn);
612605
}
613606

614607
void polympo_getMeshVtxOnSurfVeloIncr_f(MPMesh_ptr p_mpmesh, const int nComps, const int nVertices, double* array) {
615-
//check mpMesh is valid
616-
checkMPMeshValid(p_mpmesh);
617-
auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh;
618-
kkVec2dViewHostU arrayHost(array,nVertices);
619-
620-
auto vtxField = p_mesh->getMeshField<polyMPO::MeshF_OnSurfVeloIncr>();
621-
622-
//check the size
623-
PMT_ALWAYS_ASSERT(nComps == vec2d_nEntries);
624-
PMT_ALWAYS_ASSERT(p_mesh->getNumVertices() == nVertices);
625-
PMT_ALWAYS_ASSERT(static_cast<size_t>(nVertices*vec2d_nEntries)==vtxField.size());
626-
627-
//copy the device array to the host
628-
Kokkos::deep_copy(arrayHost, vtxField);
608+
double* dataIn[nComps];
609+
for(int j=0; j<nComps; j++)
610+
dataIn[j] = &array[j * nVertices];
611+
getMeshData<polyMPO::MeshF_OnSurfVeloIncr>(p_mpmesh, nComps, nVertices, dataIn);
629612
}
630613

631614
void polympo_setMeshVtxOnSurfDispIncr_f(MPMesh_ptr p_mpmesh, const int nComps, const int nVertices, const double* array) {

0 commit comments

Comments
 (0)