@@ -110,7 +110,6 @@ void polympo_createMPs_f(MPMesh_ptr p_mpmesh,
110110 fprintf (stderr," The minElmID is incorrect! Offset is wrong!\n " );
111111 exit (1 );
112112 }
113- printf (" Offset %d \n " , offset);
114113
115114 std::vector<int > active_mpIDs (numMPs);
116115 std::vector<int > active_mp2Elm (numMPs);
@@ -126,7 +125,7 @@ void polympo_createMPs_f(MPMesh_ptr p_mpmesh,
126125 auto mpsPerElm_d = create_mirror_view_and_copy (mpsPerElm, numElms);
127126 auto active_mp2Elm_d = create_mirror_view_and_copy (active_mp2Elm.data (), numActiveMPs);
128127 auto active_mpIDs_d = create_mirror_view_and_copy (active_mpIDs.data (), numActiveMPs);
129-
128+
130129 delete ((polyMPO::MPMesh*)p_mpmesh)->p_MPs ;
131130 ((polyMPO::MPMesh*)p_mpmesh)->p_MPs =
132131 new polyMPO::MaterialPoints (numElms, numActiveMPs, mpsPerElm_d, active_mp2Elm_d, active_mpIDs_d, elm2global);
@@ -198,7 +197,7 @@ void polympo_startRebuildMPs_f(MPMesh_ptr p_mpmesh,
198197 }
199198}
200199
201- void polympo_startRebuildMPs_f2 (MPMesh_ptr p_mpmesh,
200+ void polympo_startRebuildMPs2_f (MPMesh_ptr p_mpmesh,
202201 const int sizeMP2elm,
203202 const int * elem_ids,
204203 const int nMPs_delete,
@@ -235,7 +234,7 @@ void polympo_startRebuildMPs_f2(MPMesh_ptr p_mpmesh,
235234 int numDeletedMPs = pumipic::getLastValue (numDeletedMPs_d);
236235 assert (nMPs_delete==numDeletedMPs);
237236 p_MPs->startRebuild (mp2Elm, nMPs_add, recvMPs_elm_d, recvMPs_ids_d);
238- pumipic::RecordTime (" polympo_startRebuildMPs_f2 " , timer.seconds ());
237+ pumipic::RecordTime (" polympo_startRebuildMPs2_f " , timer.seconds ());
239238}
240239
241240
@@ -297,7 +296,7 @@ void polympo_getMPCurElmID_f(MPMesh_ptr p_mpmesh,
297296
298297 auto getElmId = PS_LAMBDA (const int &, const int & mp, const int & mask){
299298 if (mask){
300- mpCurElmIDCopy (mpAppID (mp)) = mpCurElmID (mp)+elmIDoffset;
299+ mpCurElmIDCopy (mpAppID (mp)) = mpCurElmID (mp)+elmIDoffset;
301300 }
302301 };
303302 p_MPs->parallel_for (getElmId, " get mpCurElmID" );
@@ -380,7 +379,6 @@ void polympo_setMPTgtPositions_f(MPMesh_ptr p_mpmesh,
380379 auto p_MPs = ((polyMPO::MPMesh*)p_mpmesh)->p_MPs ;
381380 PMT_ALWAYS_ASSERT (nComps == vec3d_nEntries);
382381 PMT_ALWAYS_ASSERT (numMPs >= p_MPs->getCount ());
383- // printf("NumMPs %d %d \n", numMPs, p_MPs->getCount());
384382 // PMT_ALWAYS_ASSERT(numMPs >= p_MPs->getMaxAppID());
385383 kkViewHostU<const double **> mpPositionsIn_h (mpPositionsIn,nComps,numMPs);
386384
@@ -950,9 +948,6 @@ void polympo_setMeshDualTriangleArea_f(MPMesh_ptr p_mpmesh, const int nVertices,
950948 checkMPMeshValid (p_mpmesh);
951949 auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh ;
952950
953- // check the size
954- PMT_ALWAYS_ASSERT (p_mesh->getNumVertices ()==nVertices);
955-
956951 // copy the host array to the device
957952 auto dualArea = p_mesh->getMeshField <polyMPO::MeshF_DualTriangleArea>();
958953 auto h_dualArea = Kokkos::create_mirror_view (dualArea);
@@ -968,9 +963,6 @@ void polympo_getMeshDualTriangleArea_f(MPMesh_ptr p_mpmesh, const int nVertices,
968963 checkMPMeshValid (p_mpmesh);
969964 auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh ;
970965
971- // check the size
972- PMT_ALWAYS_ASSERT (p_mesh->getNumVertices ()==nVertices);
973-
974966 // copy the device to host
975967 auto dualArea = p_mesh->getMeshField <polyMPO::MeshF_DualTriangleArea>();
976968 auto h_dualArea = Kokkos::create_mirror_view_and_copy (Kokkos::HostSpace (), dualArea);
@@ -1183,28 +1175,28 @@ void polympo_getMeshVtxOnSurfDispIncr_f(MPMesh_ptr p_mpmesh, const int nComps, c
11831175
11841176bool polympo_push1P_f (MPMesh_ptr p_mpmesh){
11851177 checkMPMeshValid (p_mpmesh);
1186- bool is_migrating=((polyMPO::MPMesh*)p_mpmesh) ->push1P ();
1178+ bool is_migrating=((polyMPO::MPMesh*)p_mpmesh)->push1P ();
11871179 return is_migrating;
11881180}
11891181
11901182void polympo_push_ahead_f (MPMesh_ptr p_mpmesh){
11911183 checkMPMeshValid (p_mpmesh);
1192- ((polyMPO::MPMesh*)p_mpmesh) ->push_ahead ();
1184+ ((polyMPO::MPMesh*)p_mpmesh)->push_ahead ();
11931185}
11941186
11951187void polympo_push_swap_f (MPMesh_ptr p_mpmesh){
11961188 checkMPMeshValid (p_mpmesh);
1197- ((polyMPO::MPMesh*)p_mpmesh) ->push_swap ();
1189+ ((polyMPO::MPMesh*)p_mpmesh)->push_swap ();
11981190}
11991191
12001192void polympo_push_swap_pos_f (MPMesh_ptr p_mpmesh){
12011193 checkMPMeshValid (p_mpmesh);
1202- ((polyMPO::MPMesh*)p_mpmesh) ->push_swap_pos ();
1194+ ((polyMPO::MPMesh*)p_mpmesh)->push_swap_pos ();
12031195}
12041196
12051197void polympo_push_f (MPMesh_ptr p_mpmesh){
12061198 checkMPMeshValid (p_mpmesh);
1207- ((polyMPO::MPMesh*)p_mpmesh) ->push ();
1199+ ((polyMPO::MPMesh*)p_mpmesh)->push ();
12081200}
12091201
12101202// TODO skeleton of reconstruction functions
@@ -1248,21 +1240,34 @@ void polympo_setReconstructionOfStress_f(MPMesh_ptr p_mpmesh, const int order, c
12481240
12491241
12501242// With MPI communication done via MPAS
1251- void polympo_vtxSubAssemblyIceArea_f (MPMesh_ptr p_mpmesh, int size1, int size2, double * array, int comp ){
1243+ void polympo_vtxSubAssemblyIceArea_f (MPMesh_ptr p_mpmesh, int size1, int size2, int comp, double * array ){
12521244 checkMPMeshValid (p_mpmesh);
12531245 auto mpmesh = ((polyMPO::MPMesh*)p_mpmesh);
1254- mpmesh->subAssemblyVtx1 <polyMPO::MeshF_VtxMass>(size1, size2, array, comp);
1246+ auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh ;
1247+ PMT_ALWAYS_ASSERT (size1 <= maxVtxsPerElm);
1248+ PMT_ALWAYS_ASSERT (size2 == p_mesh->getNumElements ()+1 );
1249+ PMT_ALWAYS_ASSERT (comp == 0 || comp== 1 );
1250+ mpmesh->subAssemblyVtx1 <polyMPO::MeshF_VtxMass>(size1, size2, comp, array);
12551251}
1256- void polympo_vtxSubAssemblyVelocity_f (MPMesh_ptr p_mpmesh, int size1, int size2, double * array, int comp){
1252+
1253+ void polympo_vtxSubAssemblyVelocity_f (MPMesh_ptr p_mpmesh, int size1, int size2, int comp, double * array){
12571254 checkMPMeshValid (p_mpmesh);
12581255 auto mpmesh = ((polyMPO::MPMesh*)p_mpmesh);
1259- mpmesh->subAssemblyVtx1 <polyMPO::MeshF_Vel>(size1, size2, array, comp);
1256+ auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh ;
1257+ PMT_ALWAYS_ASSERT (size1 <= maxVtxsPerElm);
1258+ PMT_ALWAYS_ASSERT (size2 == p_mesh->getNumElements ()+1 );
1259+ PMT_ALWAYS_ASSERT (comp == 0 || comp== 1 );
1260+ mpmesh->subAssemblyVtx1 <polyMPO::MeshF_Vel>(size1, size2, comp, array);
12601261}
1262+
12611263void polympo_subAssemblyCoeffs_f (MPMesh_ptr p_mpmesh, int dim1, int dim2, double * m11, double * m12, double * m13, double * m14,
12621264 double * m22, double * m23, double * m24,
12631265 double * m33, double * m34,
12641266 double * m44){
12651267 checkMPMeshValid (p_mpmesh);
1268+ auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh ;
1269+ PMT_ALWAYS_ASSERT (dim1 <= maxVtxsPerElm);
1270+ PMT_ALWAYS_ASSERT (dim2 == p_mesh->getNumElements ()+1 );
12661271 auto mpmesh = ((polyMPO::MPMesh*)p_mpmesh);
12671272 mpmesh->subAssemblyCoeffs (dim1, dim2, m11, m12, m13, m14, m22, m23, m24, m33, m34, m44);
12681273}
@@ -1321,8 +1326,6 @@ void polympo_setVtxGlobal_f(MPMesh_ptr p_mpmesh, const int nVertices, const int*
13211326 for (int i = 0 ; i < nVertices; i++) {
13221327 arrayHost (i) = array[i] - 1 ; // TODO right now elmID offset is set after MPs initialized
13231328 }
1324- // check the size
1325- // PMT_ALWAYS_ASSERT(nVertices == p_mesh->getNumVertices());
13261329
13271330 Kokkos::View<int *> vtxGlobal (" vtxGlobal" ,nVertices);
13281331 Kokkos::deep_copy (vtxGlobal, arrayHost);
@@ -1331,7 +1334,7 @@ void polympo_setVtxGlobal_f(MPMesh_ptr p_mpmesh, const int nVertices, const int*
13311334
13321335int polympo_getMPCount_f (MPMesh_ptr p_mpmesh) {
13331336 auto p_MPs = ((polyMPO::MPMesh*)p_mpmesh)->p_MPs ;
1334- return p_MPs->getCount (); // This returns the int you're after
1337+ return p_MPs->getCount ();
13351338}
13361339
13371340void polympo_enableTiming_f (){
0 commit comments